Forums

wsgi settings /path error

Hello, I have the following django project structure in

/home/sebaschm/soccer/django-dashboard-material

 .git/  
 app/   
 authentication/    
 core/  
 media/ 
 nginx/ 
 staticfiles/

"core" has the settings.py and the init.py

My wsgi looks the following:

import os
import sys


path = os.path.expanduser('~soccer/django-dashboard-material')
if path not in sys.path:
    sys.path.insert(0, path)
os.environ['DJANGO_SETTINGS_MODULE'] = 'core.settings'
from django.core.wsgi import get_wsgi_application
from django.contrib.staticfiles.handlers import StaticFilesHandler
application = StaticFilesHandler(get_wsgi_application())

when I try to run the Website I get the following error:

Error running WSGI application
2021-01-31 12:55:32,227: ModuleNotFoundError: No module named 'core'
2021-01-31 12:55:32,227:   File "/var/www/sebaschm_pythonanywhere_com_wsgi.py", line 11, in <module>
2021-01-31 12:55:32,227:     application = StaticFilesHandler(get_wsgi_application())

Can anyone help me, how to configure?

Best regards, Sebastian

[edit by admin: formatting]

Your path is defined incorrectly; ~soccer means "the home directory of the user with the username soccer", but what you're trying to say is "the soccer subdirectory of my own home directory", which is ~/soccer. So the third line in your WSGI file should be this:

path = os.path.expanduser('~/soccer/django-dashboard-material')