Forums

Error running WSGI application

Hi guys, I am trying to deploy an existing Django App, but I keep facing issues while running the WSGI file.

The error that I get is "Error Running WSGI Application ModuleNotFoundError: no module name 'mragain'.

mragain is in my project directory under /var/www/website/production/

My wsgi file is configured like this:

import os import sys from django.core.wsgi import get_wsgi_application

add your project directory to the sys.path

path = 'var/www/website/production' if path not in sys.path: sys.path.append(path)

set environment variable to tell django where your settings.py is

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

serve django via WSGI

application = get_wsgi_application()

Does anyone have an idea why it throws this error?

Because 'var/www/website/production' is not where your project directory is. It's at ''/var/www/website/production''

Thanks, Glenn. Totally missed the /. I'll keep quiet now :p