WebFaction
Community site: login faq

I just moved a project to django 1.7 when I restart the server I get an error. It was a pre existing site and running on django 1.5.5, I've edited the wsgi to look like a default django app for 1.7 and it hasn't resolved the issue.

[Tue Nov 10 00:46:13.971109 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112] mod_wsgi (pid=220721): Target WSGI script '/home/kbuzz/webapps/revision/kb/kb/wsgi.py' cannot be loaded as Python module.
[Tue Nov 10 00:46:13.971144 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112] mod_wsgi (pid=220721): Exception occurred processing WSGI script '/home/kbuzz/webapps/revision/kb/kb/wsgi.py'.
[Tue Nov 10 00:46:13.971160 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112] Traceback (most recent call last):
[Tue Nov 10 00:46:13.971179 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]   File "/home/kbuzz/webapps/revision/kb/kb/wsgi.py", line 8, in <module>
[Tue Nov 10 00:46:13.971206 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]     application = get_wsgi_application()
[Tue Nov 10 00:46:13.971217 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/core/wsgi.py", line 14, in get_wsgi_application
[Tue Nov 10 00:46:13.971235 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]     django.setup()
[Tue Nov 10 00:46:13.971244 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/__init__.py", line 21, in setup
[Tue Nov 10 00:46:13.971259 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]     apps.populate(settings.INSTALLED_APPS)
[Tue Nov 10 00:46:13.971268 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/apps/registry.py", line 78, in populate
[Tue Nov 10 00:46:13.971283 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112]     raise RuntimeError("populate() isn't reentrant")
[Tue Nov 10 00:46:13.971298 2015] [wsgi:error] [pid 220721:tid 140129672140544] [remote 127.0.0.1:112] RuntimeError: populate() isn't reentrant

It's tracing back to the wsgi file I have the default settings for the wsgi

import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'kb.settings'

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

UPDATE

I've edited the wsgi to this

import os
import time
import traceback
import signal
from django.core.wsgi import get_wsgi_application

try:
    application = get_wsgi_application()
    print 'WSGI without exception'
except Exception:
    print 'handling WSGI exception'
    # Error loading applications
    if 'mod_wsgi' in sys.modules:
        traceback.print_exc()
        os.kill(os.getpid(), signal.SIGINT)
        time.sleep(2.5)

and now the error log shows sys is missing

[Mon Nov 09 23:31:30.073615 2015] [mpm_worker:notice] [pid 286311:tid 139871310776128] AH00298: SIGHUP received.  Attempting to restart
[Mon Nov 09 23:31:30.123901 2015] [mpm_worker:notice] [pid 286311:tid 139871310776128] AH00292: Apache/2.4.17 (Unix) mod_wsgi/4.4.21 Python/2.7.9 configured -- resuming normal operations
[Mon Nov 09 23:31:30.123915 2015] [core:notice] [pid 286311:tid 139871310776128] AH00094: Command line: '/home/kbuzz/webapps/revision/apache2/bin/httpd.worker -f /home/kbuzz/webapps/revision/apache2/conf/httpd.conf'
[Mon Nov 09 23:31:36.660217 2015] [wsgi:error] [pid 305779:tid 139871132526336] handling WSGI exception
[Mon Nov 09 23:31:36.660263 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081] mod_wsgi (pid=305779): Target WSGI script '/home/kbuzz/webapps/revision/kb/kb/wsgi.py' cannot be loaded as Python module.
[Mon Nov 09 23:31:36.660274 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081] mod_wsgi (pid=305779): Exception occurred processing WSGI script '/home/kbuzz/webapps/revision/kb/kb/wsgi.py'.
[Mon Nov 09 23:31:36.660290 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081] Traceback (most recent call last):
[Mon Nov 09 23:31:36.660305 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081]   File "/home/kbuzz/webapps/revision/kb/kb/wsgi.py", line 13, in <module>
[Mon Nov 09 23:31:36.660355 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081]     if 'mod_wsgi' in sys.modules:
[Mon Nov 09 23:31:36.660371 2015] [wsgi:error] [pid 305779:tid 139871132526336] [remote 127.0.0.1:11081] NameError: name 'sys' is not defined

This is urgent the site has been down for almost a day.

UPDATE

I'm trying to debug the source of why Django isn't working, when i try python2.7 manage.py runserver I get the error below.

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/apps/config.py", line 123, in create
    import_module(entry)
  File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named markup

but when I try from the website the logs brings up this error

[Tue Nov 10 01:09:09.940949 2015] [wsgi:error] [pid 336361:tid 139871122036480] handling WSGI exception
[Tue Nov 10 01:09:09.946153 2015] [wsgi:error] [pid 336361:tid 139871122036480] Traceback (most recent call last):
[Tue Nov 10 01:09:09.946169 2015] [wsgi:error] [pid 336361:tid 139871122036480]   File "/home/kbuzz/webapps/revision/kb/kb/wsgi.py", line 9, in <module>
[Tue Nov 10 01:09:09.946219 2015] [wsgi:error] [pid 336361:tid 139871122036480]     application = get_wsgi_application()
[Tue Nov 10 01:09:09.946230 2015] [wsgi:error] [pid 336361:tid 139871122036480]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/core/wsgi.py", line 14, in get_wsgi_application
[Tue Nov 10 01:09:09.946264 2015] [wsgi:error] [pid 336361:tid 139871122036480]     django.setup()
[Tue Nov 10 01:09:09.946274 2015] [wsgi:error] [pid 336361:tid 139871122036480]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/__init__.py", line 20, in setup
[Tue Nov 10 01:09:09.946314 2015] [wsgi:error] [pid 336361:tid 139871122036480]     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Tue Nov 10 01:09:09.946325 2015] [wsgi:error] [pid 336361:tid 139871122036480]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/conf/__init__.py", line 46, in __getattr__
[Tue Nov 10 01:09:09.946391 2015] [wsgi:error] [pid 336361:tid 139871122036480]     self._setup(name)
[Tue Nov 10 01:09:09.946402 2015] [wsgi:error] [pid 336361:tid 139871122036480]   File "/home/kbuzz/webapps/revision/lib/python2.7/Django-1.7.10-py2.7.egg/django/conf/__init__.py", line 40, in _setup
[Tue Nov 10 01:09:09.946418 2015] [wsgi:error] [pid 336361:tid 139871122036480]     % (desc, ENVIRONMENT_VARIABLE))
[Tue Nov 10 01:09:09.946434 2015] [wsgi:error] [pid 336361:tid 139871122036480] ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
[Tue Nov 10 01:09:12.448861 2015] [wsgi:error] [pid 336361:tid 139871122036480] [remote 127.0.0.1:35656] mod_wsgi (pid=336361): Target WSGI script '/home/kbuzz/webapps/revision/kb/kb/wsgi.py' does not contain WSGI application 'application'.

asked 09 Nov '15, 23:13

six_wars
11311
accept rate: 100%

edited 10 Nov '15, 01:15

Since this is urgent, we advise you to submit a support ticket as soon as you can:

https://my.webfaction.com/open-support-ticket

(10 Nov '15, 00:18) NickR ♦♦

I have a ticket open, I'm working both ends to see if I can get a solution quicker.

(10 Nov '15, 01:16) six_wars
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×910
×337

question asked: 09 Nov '15, 23:13

question was seen: 5,722 times

last updated: 10 Nov '15, 01:16

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM