Forums

Newbie question about wsgi file modifications for existing django project

Hi, I'm having problems accessing my dev server. I tried to follow all the directions in the help files but I still get "Something went wrong :-("

Regarding the edits to the wsgi file, is this the one that shows under the Web tab as WSGI configuration file? (/var/www/myname_pythonanywhere_com_wsgi.py)

FWIW I'm trying to use django 1.6 with python 2.7. I'm currently setting up on a free account to be upgraded if I can get things to work.

Yes, that's the right file.

When you get a "Something went wrong" page, there will be an stack trace in your error log that will usually show you what went wrong.

2014-09-10 13:35:43,782 :Traceback (most recent call last):
2014-09-10 13:35:43,786 :  File "/bin/user_wsgi_wrapper.py", line 123, in __call__
2014-09-10 13:35:43,786 :    self.error_log_file.logger.exception("Error running WSGI application")
2014-09-10 13:35:43,786 :  File "/usr/lib/python2.7/logging/__init__.py", line 1183, in exception
2014-09-10 13:35:43,786 :    self.error(msg, *args, **kwargs)
2014-09-10 13:35:43,786 :  File "/usr/lib/python2.7/logging/__init__.py", line 1176, in error
2014-09-10 13:35:43,787 :    self._log(ERROR, msg, args, **kwargs)
2014-09-10 13:35:43,787 :  File "/usr/lib/python2.7/logging/__init__.py", line 1268, in _log
2014-09-10 13:35:43,787 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2014-09-10 13:35:43,787 :  File "/usr/lib/python2.7/logging/__init__.py", line 1242, in makeRecord
2014-09-10 13:35:43,787 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2014-09-10 13:35:43,787 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2014-09-10 13:35:43,788 :    self.threadName = threading.current_thread().name
2014-09-10 13:35:43,788 :  File "/usr/lib/python2.7/threading.py", line 1158, in currentThread
2014-09-10 13:35:43,801 :    return _active[_get_ident()]
2014-09-10 13:35:43,801 :  File "/bin/user_wsgi_wrapper.py", line 115, in __call__
2014-09-10 13:35:43,801 :    app_iterator = self.app(environ, start_response)
2014-09-10 13:35:43,801 :  File "/bin/user_wsgi_wrapper.py", line 129, in import_error_application
2014-09-10 13:35:43,801 :    raise e
2014-09-10 13:35:43,801 :  File "/var/www/tdkwon_pythonanywhere_com_wsgi.py", line 1
2014-09-10 13:35:43,802 :    activate_this = '/home/tdkwon/env/bin/activate_this.py"

Looks like you have mismatched quotes on the activate_this line.

Almost got this working! I fixed the quotes. But now I get the error:

:ImportError: cannot import name app

I have included this line from the instructions:

from academy import app as application

I guess it can't find app. Where would this be defined?

BTW, my myapp/myapp/wsgi.py has this inside:

import os 14 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "academy.settings") 15 16 from django.core.wsgi import get_wsgi_application 17 application = get_wsgi_application()

It seems like my "app" is actually called "application"?

But I tried to use: "from academy import application" and it said couldn't find it.

FYI I've given up on this. Starting over.

I think this might help -- in the line ""from academy import app as application" academy is the filename and app is what you have called your app.

we have a wiki page on import errors and sys.path issues which might help?