I'm using Apache 2.4 and Python 2.6.8. We have several different virtual
hosts and the DJANGO_SETTINGS_MODULE is defined within each virtual host.
However, the wsgi file gets loaded before the settings.py file. This
works fine under Django 1.5.1 as settings aren't referenced from within the
wsgi. But with 1.6 it does get referenced and therefore raises an
ImproperlyConfigured error. Does anyone have any suggestions to help fix
this issue? Is there anyway I can get the settings module to load before
the wsgi module?
Brian DeWeese
-- apache.conf --
WSGIScriptAlias / /opt/ecn/www/web-sites/wsgi/foo.wsgi
<Directory "/opt/ecn/www/web-sites/wsgi">
Allow from all
</Directory>
WSGIDaemonProcess mysite1 display-name=%{GROUP} processes=10
<VirtualHost *:80>
ServerName mysite1.foo
SetEnv DJANGO_SETTINGS_MODULE mysite1.settings
WSGIProcessGroup mysite1
</VirtualHost>
-- output --
[Fri Nov 08 13:24:02.120637 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] mod_wsgi (pid=20169): Target WSGI script
'/opt/ecn/www/web-sites/wsgi/foo.wsgi' cannot be loaded as Python module.
[Fri Nov 08 13:24:02.120703 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] mod_wsgi (pid=20169): Exception occurred processing WSGI
script '/opt/ecn/www/web-sites/wsgi/foo.wsgi'.
[Fri Nov 08 13:24:02.120735 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] Traceback (most recent call last):
[Fri Nov 08 13:24:02.120767 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/web-sites/wsgi/foo.wsgi", line 8, in
<module>
[Fri Nov 08 13:24:02.120879 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] from django.core.handlers import wsgi as django_wsgi
[Fri Nov 08 13:24:02.120901 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/Django/django/core/handlers/wsgi.py",
line 11, in <module>
[Fri Nov 08 13:24:02.121020 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] from django.core.handlers import base
[Fri Nov 08 13:24:02.121048 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/Django/django/core/handlers/base.py",
line 12, in <module>
[Fri Nov 08 13:24:02.121186 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] from django.db import connections, transaction
[Fri Nov 08 13:24:02.121215 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/Django/django/db/__init__.py", line
83, in <module>
[Fri Nov 08 13:24:02.121314 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] signals.request_started.connect(reset_queries)
[Fri Nov 08 13:24:02.121343 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File
"/opt/ecn/www/Django/django/dispatch/dispatcher.py", line 88, in connect
[Fri Nov 08 13:24:02.121489 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] if settings.DEBUG:
[Fri Nov 08 13:24:02.121520 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/Django/django/conf/__init__.py", line
54, in __getattr__
[Fri Nov 08 13:24:02.121628 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] self._setup(name)
[Fri Nov 08 13:24:02.121656 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] File "/opt/ecn/www/Django/django/conf/__init__.py", line
47, in _setup
[Fri Nov 08 13:24:02.121690 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] % (desc, ENVIRONMENT_VARIABLE))
[Fri Nov 08 13:24:02.121729 2013] [:error] [pid 20169] [remote
127.0.0.1:40192] ImproperlyConfigured: Requested setting DEBUG, but
settings are not configured. You must either define the environment
variable DJANGO_SETTINGS_MODULE or call settings.configure() before
accessing settings.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/c9f822e5-2993-4fce-9f9f-bbd0bef43dd2%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.