Answer the question
In order to leave comments, you need to log in
Django + MySQL + Windows = Error?
Already spent a lot of time trying to pair Django with MySQL on Windows.
Mistake:
Unhandled exception in thread started by <bound method Command.inner_run of <dja
ngo.contrib.staticfiles.management.commands.runserver.Command object at 0x000000
00031B22B0>>
Traceback (most recent call last):
File "c:\Python27\lib\site-packages\django\core\management\commands\runserver.
py", line 92, in inner_run
self.validate(display_num_errors=True)
File "c:\Python27\lib\site-packages\django\core\management\base.py", line 280,
in validate
num_errors = get_validation_errors(s, app)
File "c:\Python27\lib\site-packages\django\core\management\validation.py", lin
e 28, in get_validation_errors
from django.db import models, connection
File "c:\Python27\lib\site-packages\django\db\__init__.py", line 40, in <modul
e>
backend = load_backend(connection.settings_dict['ENGINE'])
File "c:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __geta
ttr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "c:\Python27\lib\site-packages\django\db\utils.py", line 93, in __getitem
__
backend = load_backend(db['ENGINE'])
File "c:\Python27\lib\site-packages\django\db\utils.py", line 27, in load_back
end
return import_module('.base', backend_name)
File "c:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in im
port_module
__import__(name)
File "c:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 17
, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 20: ordinal
not in range(128)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME' : 'pytest',
'USER': 'root',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '3306',
}
}
Answer the question
In order to leave comments, you need to log in
I had the same problem, the reason was the uninstalled mysqldb library on windows. This solved the problem.
Check that there is no Cyrillic alphabet anywhere, anywhere:
-% PATH% and other environment variables
- computer name
- CLSID from Python associations
- perhaps in the settings of the muscle and its firewood
In general, judging by what they write on the Internet, it's cheaper to raise a virtual linux than to debug it :(
In our office, Django and Muskul are spinning on Windows, the flight is normal.
Error in this statement:
>>> import MySQLdb as Database
Open interactive Python and run this code.
Question - do you have classic Python or ActivePython? The latter stores packages by default not in site-packages, but somewhere in the asshole of Windows, when starting Jungi through Apache / IIS, this path may not be picked up.
open c:\Python27\lib\site-packages\django\db\backends\mysql\base.py, in line 16 paste
import pdb
pdb.set_trace()
print e
. What will happen?
Check the python paths for Cyrillic characters:
python manage.py shell
>>> import sys
>>> print sys.path
Hello.
Help me with a problem. Under windows 7 32bit installed python 2.7.8, django 1.7.1, mysql. Everything seems to work, the site opens and pulls data from the database, but in the shell console when I execute such a command
from django.db import connection
cursor = connection.cursor()
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
ImproperlyConfigured: Error loading MySQLdb module: this is MySQLdb version (1, 2, 3, 'final', 0), but _mysql is version (1, 3, 4, 'final', 1)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question