PythonAnywhere Forums

Error running WSGI application

2016-07-27 02:38:54,358 :Error running WSGI application Traceback (most recent call last): File "/bin/", line 154, in call app_iterator =, start_response) File "/bin/", line 170, in import_error_application raise e ImportError: No module named wsgi

Hi there,

Make sure you have the right version of django? Going to your website, it seems like you have solved this problem and you are onto the next one?



How did this problem been solved? I've gotten the same error in my flask application.


Can any PythonAnyWhere staff help to answer this topic?

The django version mismatch I mentioned is in the For django 1.7+, this is correct:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

for django <1.7, this is correct:

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

For flask, you want to import your app (ie. the app = Flask(__name__) that you have somewhere) and then save it as application in your

This is the settings that worked for me - this goes in your WSGI configuration file.

if path not in sys.path:

from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

Hi, can u please check this up for my site: Getting the following error msg: Error running WSGI application OSError: write error GeneratorExit

Those are safe to ignore:

A clarification -- those errors are normally safe to ignore, if you're only seeing them occasionally. If you're seeing lots of them (say, one per second) then it may be a signal that your web app is running too slowly. This could be caused by many different things -- a frequent cause is if you write a view that, when it is accessed, it makes a request to an external site, and that external site is running slowly. Or it could be a bug elsewhere in your code making it do an infinite loop -- or something like that.