Forums

mod = importlib.import_module(self.SETTINGS_MODULE)

Hello, can someone help me figure out what I must fix in order for my website to work?

I have tried going through the debugging page and my static pathing is correct

here is my error code:

2017-12-19 22:48:47,561: Error running WSGI application
2017-12-19 22:48:47,561: ModuleNotFoundError: No module named 'Skeletonv3'
2017-12-19 22:48:47,562:   File "/var/www/gassymule_pythonanywhere_com_wsgi.py", line 12, in <module>
2017-12-19 22:48:47,562:     application = StaticFilesHandler(get_wsgi_application())
2017-12-19 22:48:47,562: 
2017-12-19 22:48:47,562:   File "/home/Gassymule/Skeletonv3.1/myvenv/lib/python3.6/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2017-12-19 22:48:47,562:     django.setup(set_prefix=False)
2017-12-19 22:48:47,563: 
2017-12-19 22:48:47,563:   File "/home/Gassymule/Skeletonv3.1/myvenv/lib/python3.6/site-packages/django/__init__.py", line 22, in setup
2017-12-19 22:48:47,563:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2017-12-19 22:48:47,563: 
2017-12-19 22:48:47,563:   File "/home/Gassymule/Skeletonv3.1/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
2017-12-19 22:48:47,563:     self._setup(name)
2017-12-19 22:48:47,563: 
2017-12-19 22:48:47,563:   File "/home/Gassymule/Skeletonv3.1/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 41, in _setup
2017-12-19 22:48:47,564:     self._wrapped = Settings(settings_module)
2017-12-19 22:48:47,564: 
2017-12-19 22:48:47,564:   File "/home/Gassymule/Skeletonv3.1/myvenv/lib/python3.6/site-packages/django/conf/__init__.py", line 110, in __init__
2017-12-19 22:48:47,564:     mod = importlib.import_module(self.SETTINGS_MODULE)
2017-12-19 22:48:47,564: ***************************************************
2017-12-19 22:48:47,564: If you're seeing an import error and don't know why,
2017-12-19 22:48:47,564: we have a dedicated help page to help you debug: 
2017-12-19 22:48:47,564: https://help.pythonanywhere.com/pages/DebuggingImportError/
2017-12-19 22:48:47,564: ***************************************************

Here is my wsgi file:

import os
import sys

path = os.path.expanduser('~/skeletonv3')
if path not in sys.path:
    sys.path.append(path)

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

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

My settings.py file is located at:

/home/Gassymule/Skeletonv3.1/skeletonv3/skeletonv3/settings.py

and my wsgi.py file is located at

/var/www/gassymule_pythonanywhere_com_wsgi.py

Can anyone help me with this? I cannot find the solution on the internet.

Have you installed the module Skeletonv3 ?

I am not quite sure what you mean by that? I followed the django girls tutorial:

https://tutorial.djangogirls.org/en/deploy/

and the most that I can think of is that I pulled my code from github.

Do I have to run a bash command to install the module? Secondly, I don't know why it is capitalising "Skeletonv3", the only file that has a capital is Skeletonv3.1, the django directories are both named skeletonv3.

It seems like somewhere in your code you are importing Skeletonv3. That is probably a typo on your part.

I figured it out. I feel like such a foolish boy lol.

the mistake I was making was just not having the correct path. I changed it from

path = '/home/Gassymule/Skeletonv3.1/skeletonv3/skeletonv3'

into

path = '/home/Gassymule/Skeletonv3.1/skeletonv3'

here is my wsgi file,

# +++++++++++ DJANGO +++++++++++
# To use your own Django app use code like this:
import os
import sys

# assuming your Django settings file is at '/home/myusername/mysite/mysite/settings.py'
path = '/home/Gassymule/Skeletonv3.1/skeletonv3'
if path not in sys.path:
    sys.path.append(path)

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

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

Aha! That makes sense. Glad you worked it out.