Error running WSGI application

964 views
Skip to first unread message

Kadir Guloglu

unread,
May 26, 2018, 2:02:51 PM5/26/18
to Django users

Hi friends. 


 Can I help we please. My project getting exception.


WSGI File:

import os

import sys


path = os.path.expanduser('~/otomabak')

if path not in sys.path:

    sys.path.append(path)


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


from django.core.wsgi import get_wsgi_application

from django.contrib.staticfiles.handlers import StaticFilesHandler

application = StaticFilesHandler(get_wsgi_application())



Server Error : 

2018-05-26 17:43:02,582: Error running WSGI application
2018-05-26 17:43:02,583: ModuleNotFoundError: No module named 'otomabak.settings'
2018-05-26 17:43:02,583:   File "/var/www/kadirguloglu_pythonanywhere_com_wsgi.py", line 12, in <module>
2018-05-26 17:43:02,583:     application = StaticFilesHandler(get_wsgi_application())
2018-05-26 17:43:02,583: 
2018-05-26 17:43:02,583:   File "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-05-26 17:43:02,583:     django.setup(set_prefix=False)
2018-05-26 17:43:02,584: 
2018-05-26 17:43:02,584:   File "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
2018-05-26 17:43:02,584:     configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2018-05-26 17:43:02,584: 
2018-05-26 17:43:02,584:   File "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py", line 56, in __getattr__
2018-05-26 17:43:02,584:     self._setup(name)
2018-05-26 17:43:02,584: 
2018-05-26 17:43:02,584:   File "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py", line 43, in _setup
2018-05-26 17:43:02,584:     self._wrapped = Settings(settings_module)
2018-05-26 17:43:02,585: 
2018-05-26 17:43:02,585:   File "/home/kadirguloglu/otomabak/otomabakenv/lib/python3.6/site-packages/django/conf/__init__.py", line 106, in __init__
2018-05-26 17:43:02,585:     mod = importlib.import_module(self.SETTINGS_MODULE)
2018-05-26 17:43:02,585: ***************************************************
2018-05-26 17:43:02,585: If you're seeing an import error and don't know why,
2018-05-26 17:43:02,585: we have a dedicated help page to help you debug: 
2018-05-26 17:43:02,585: https://help.pythonanywhere.com/pages/DebuggingImportError/
2018-05-26 17:43:02,585: ***************************************************



Thanks for help

Joseph Mutumi

unread,
Jun 4, 2018, 12:19:43 PM6/4/18
to django-users@googlegroups com
Hello,


And make sure your directory structure is as recommended:

/home/myusername
`-- myproject/
    |-- __init__.py
    `-- myproject/
        |-- __init__.py
        `-- settings.py
If it is not, then correct the sys.path.append(path) in your wsgi file to where ever it is e.g.: sys.path.append(os.path.dirname(path))

Hope it helps.

Kind regards

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/560746fa-8d6f-4a45-ae44-43ee8bf53eb6%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages