Im stuck with my WSGI FIle on pythonanywhere.com

402 views
Skip to first unread message

Robert librado

unread,
May 25, 2015, 2:54:54 PM5/25/15
to django-users
939 :Traceback (most recent call last):
2015-05-25 18:45:19,939 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2015-05-25 18:45:19,939 :    self.error_log_file.logger.exception("Error running WSGI application")
2015-05-25 18:45:19,939 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
2015-05-25 18:45:19,940 :    self.error(msg, *args, **kwargs)
2015-05-25 18:45:19,940 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
2015-05-25 18:45:19,940 :    self._log(ERROR, msg, args, **kwargs)
2015-05-25 18:45:19,940 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
2015-05-25 18:45:19,940 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2015-05-25 18:45:19,940 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
2015-05-25 18:45:19,941 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2015-05-25 18:45:19,941 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2015-05-25 18:45:19,941 :    self.threadName = threading.current_thread().name
2015-05-25 18:45:19,941 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2015-05-25 18:45:19,941 :    return _active[_get_ident()]
2015-05-25 18:45:19,941 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2015-05-25 18:45:19,941 :    app_iterator = self.app(environ, start_response)
2015-05-25 18:45:19,941 :  File "/home/pycharm/.virtualenvs/django17/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__
2015-05-25 18:45:19,942 :    self.load_middleware()
2015-05-25 18:45:19,942 :  File "/home/pycharm/.virtualenvs/django17/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 44, in load_middleware
2015-05-25 18:45:19,942 :    mw_class = import_string(middleware_path)
2015-05-25 18:45:19,942 :  File "/home/pycharm/.virtualenvs/django17/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 26, in import_string
2015-05-25 18:45:19,943 :    module = import_module(module_path)
2015-05-25 18:45:19,943 :  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
2015-05-25 18:45:19,943 :    __import__(name)
2015-05-25 18:45:19,943 :ImportError: No module named security



heres the code:


import os
import sys

# assuming your django settings file is at '/home/MYUSERNAME/MYSITE/settings.py'
path = '/home/pycharm/work'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'work.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Jaime

unread,
Jan 1, 2016, 8:31:36 PM1/1/16
to Django users
Oh man! I spent a couple of hours on this. Absolutely ridiculous! Here is what it fixed for my mezzanine's project:

# Remove any references to your home folder (this can break Mezzanine)
while "." in sys.path:
    sys.path.remove(".")
while "" in sys.path:
    sys.path.remove("")

I am writing a post on this. I was following a tutorial and got stuck on this WSGI issue.
Reply all
Reply to author
Forward
0 new messages