Forums

Error running WSGI application, ModuleNotFoundError: No module named 'django', File "/var/www/asfianridho_pythonanywhere_com_wsgi.py", line 34, in <module>, from django.core.wsgi import get_wsgi_application

This file contains the WSGI configuration required to serve up your

web application at http://asfianRidho.pythonanywhere.com/

It works by setting the variable 'application' to a WSGI handler of some

description.

+++++++++++ GENERAL DEBUGGING TIPS +++++++++++

getting imports and sys.path right can be fiddly!

We've tried to collect some general tips here:

https://www.pythonanywhere.com/wiki/DebuggingImportError

Below are templates for Django and Flask. You should update the file

appropriately for the web framework you're using, and then

click the 'Reload /yourdomain.com/' button on the 'Web' tab to make your site

live.

+++++++++++ DJANGO +++++++++++

To use your own django app use code like this:

import os import sys

assuming your django settings file is at '/home/asfianRidho/mysite/mysite/settings.py'

and your manage.py is is at '/home/asfianRidho/mysite/manage.py'

path = '/home/asfianRidho/web_profile_edo' if path not in sys.path: sys.path.append(path)

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

then:

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

I'm guessing you're using a virtualenv for your web app and you have not installed django into your virtualenv.