Forums

WSGI looking for wrong module

Hello,

So I have this problem: I modified the wsgi file in order to look for the module I need, but it continues to search for the default 'mysite.settings', obviously not finding it, giving me an error. This is my wsgi file:

import os 
import sys

path = '/home/mikekuber/GameTheory/GameTheory'

if path not in sys.path:
    sys.path.insert(0,path)

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

from django.core.wsgi import get_wsgi_application

application = get_wsgi_application()

When I reload the site, the error log is showing me this:

Error running WSGI application
ModuleNotFoundError: No module named 'mysite.settings'
   File "/var/www/mikekuber_pythonanywhere_com_wsgi.py", line 16, in <module>
      application = get_wsgi_application()

I don't think it is too relevant, but my files look like this:

home
      mikekuber
             GameTheory
                   GameTheory
                          manage.py
                          GameTheory
                                  settings.py

Could anyone please point to me what the problem here is?

How did you reload the site? You should use the green "Reload" button on the Web page. Generally, if you'll have more of those issues, we have a help page for that: https://help.pythonanywhere.com/pages/DebuggingImportError/.

This is exactly how I reload the site actually. Thank you for responding, I will try and find the answer on the link provided.

Let us know if you need any additional explanation.