Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to run Django with a MySQL backend
    primarykey
    data
    text
    <p>I'm trying to setup Django with a MySQL backend, previously I've only used sqlite, and I've got a rather odd error. <code>Error was: No module named mysql.base</code></p> <p>I'm running Ubuntu with Nginx and uwsgi, and I have python-mysqldb installed. And following this I've started to get a 502 so I hope thats related because I've not changed any config files.</p> <p>Here is the stacktrace following <code>manage.py inspectdb</code>;</p> <pre><code>Traceback (most recent call last): File "manage.py", line 10, in &lt;module&gt; execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 272, in fetch_command klass = load_command_class(app_name, subcommand) File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 77, in load_command_class module = import_module('%s.management.commands.%s' % (app_name, name)) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module __import__(name) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/inspectdb.py", line 8, in &lt;module&gt; from django.db import connections, DEFAULT_DB_ALIAS File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 40, in &lt;module&gt; backend = load_backend(connection.settings_dict['ENGINE']) File "/usr/local/lib/python2.7/dist-packages/django/db/__init__.py", line 34, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item) File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 93, in __getitem__ backend = load_backend(db['ENGINE']) File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 45, in load_backend raise ImproperlyConfigured(error_msg) django.core.exceptions.ImproperlyConfigured: 'django.db.backends.mysql' isn't an available database backend. Try using 'django.db.backends.XXX', where XXX is one of: u'oracle', u'postgresql_psycopg2', u'sqlite3' Error was: No module named mysql.base </code></pre> <p>Db settings;</p> <pre><code> DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'wdsdj', # Or path to database file if using sqlite3 # The following settings are not used with sqlite3: 'USER': 'mark', 'PASSWORD': 'pass', 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'PORT': '', # Set to empty string for default. } } </code></pre> <p>If I change to sqlite3 then I get no problems from dj;</p> <pre><code># This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Make sure each model has one field with primary_key=True # Feel free to rename the models, but don't rename db_table values or field names. # # Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]' # into your database. from __future__ import unicode_literals from django.db import models </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload