1

I recently started a Django project. I have been using the SQLite3 database so far for some testing, but now I would like to switch to MySQL. I configured the setting file and ran the first migration, everything went just fine, I checked in MySQL and the tables have been created successfully. I checked on my browser and it was okay there too.

Happy of the results I erase the SQLite3 file from the project folder and I suspected it wasn't being used no more. Well, it seems I was wrong: now when I try to reach my website via browser I get a Internal Server Error error message with no extra information (and yes, I have already DEBUG = TRUE, nothing change).

What could be the problem?

EDIT 1 Now with more code. This is the database part of my setting.py:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'XXX',
        'USER' : 'XXX',
        'PASSWORD' : 'XXX',
        'HOST' : '127.0.0.1',
    }
}

This is the Apache error log:

[Thu Sep 10 16:09:43.899538 2015] [:error] [pid 7503] [remote XXX] mod_wsgi (pid=7503): Target WSGI script 'XXX/api/wsgi.py' cannot be loaded as Python module.
[Thu Sep 10 16:09:43.899757 2015] [:error] [pid 7503] [remote XXX] mod_wsgi (pid=7503): Exception occurred processing WSGI script 'XXX/api/wsgi.py'.
[Thu Sep 10 16:09:43.899962 2015] [:error] [pid 7503] [remote XXX] Traceback (most recent call last):
[Thu Sep 10 16:09:43.900117 2015] [:error] [pid 7503] [remote XXX]   File "XXX/api/wsgi.py", line 16, in <module>
[Thu Sep 10 16:09:43.900423 2015] [:error] [pid 7503] [remote XXX]     application = get_wsgi_application()
[Thu Sep 10 16:09:43.900469 2015] [:error] [pid 7503] [remote XXX]   File "XXX/XXX-env/lib/python3.4/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Thu Sep 10 16:09:43.900652 2015] [:error] [pid 7503] [remote XXX]     django.setup()
[Thu Sep 10 16:09:43.900694 2015] [:error] [pid 7503] [remote XXX]   File "XXX/XXX-env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
[Thu Sep 10 16:09:43.900753 2015] [:error] [pid 7503] [remote XXX]     apps.populate(settings.INSTALLED_APPS)
[Thu Sep 10 16:09:43.900781 2015] [:error] [pid 7503] [remote XXX]   File "XXX/XXX-env/lib/python3.4/site-packages/django/apps/registry.py", line 78, in populate
[Thu Sep 10 16:09:43.900878 2015] [:error] [pid 7503] [remote XXX]     raise RuntimeError("populate() isn't reentrant")
[Thu Sep 10 16:09:43.900961 2015] [:error] [pid 7503] [remote XXX] RuntimeError: populate() isn't reentrant
Edgar Derby
  • 2,543
  • 4
  • 29
  • 48

1 Answers1

2

I finally managed to solve this. The problem was caused by the fact I had the wrong version of WSGI. In order to use WSGI with Python 3.4 mod_WSGI 4.2+ is required.

(I still don't know why the problem began when I erased the db.sqlite3 file.)

See this for more details. I follow samb's step-by-step guide and it worked for me.

Community
  • 1
  • 1
Edgar Derby
  • 2,543
  • 4
  • 29
  • 48