Reputation: 1
I am trying to deploy a django app to heroku through github.
I am getting the following error ImportError: No module named settings.staging
But I have the "staging.py" file under "settings" folder.
My github code is on :https://github.com/PramathaMadhavankutty/we_are_social
folder structure:
root folder/
manage.py
Procfile
settings/
staging.py
...
project-folder/
wsgi.py
wsgi.py
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "we_are_social.settings")
application = get_wsgi_application()
Procfile
web: gunicorn we_are_social.wsgi:application
log file
2016-08-16T21:43:22.513176+00:00 app[web.1]: self.callable = self.load()
2016-08-16T21:43:22.513176+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-08-16T21:43:22.513177+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-08-16T21:43:22.513177+00:00 app[web.1]: return util.import_app(self.app_uri)
2016-08-16T21:43:22.513178+00:00 app[web.1]: application = get_wsgi_application()
2016-08-16T21:43:22.513178+00:00 app[web.1]: File "/app/we_are_social/wsgi.py", line 17, in <module>
2016-08-16T21:43:22.513178+00:00 app[web.1]: __import__(module)
2016-08-16T21:43:22.513179+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/wsgi.py", line 13, in get_wsgi_application
2016-08-16T21:43:22.513179+00:00 app[web.1]: django.setup()
2016-08-16T21:43:22.513180+00:00 app[web.1]: configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
2016-08-16T21:43:22.513180+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
2016-08-16T21:43:22.513179+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/__init__.py", line 17, in setup
2016-08-16T21:43:22.513177+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 357, in import_app
2016-08-16T21:43:22.513182+00:00 app[web.1]: __import__(name)
2016-08-16T21:43:22.513180+00:00 app[web.1]: self._setup(name)
2016-08-16T21:43:22.513181+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
2016-08-16T21:43:22.513181+00:00 app[web.1]: self._wrapped = Settings(settings_module)
2016-08-16T21:43:22.513181+00:00 app[web.1]: mod = importlib.import_module(self.SETTINGS_MODULE)
2016-08-16T21:43:22.513182+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
2016-08-16T21:43:22.513181+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
2016-08-16T21:43:22.536787+00:00 app[web.1]: [2016-08-16 21:43:22 +0000] [3] [INFO] Reason: Worker failed to boot.
2016-08-16T21:43:22.513356+00:00 app[web.1]: [2016-08-16 21:43:22 +0000] [10] [INFO] Worker exiting (pid: 10)
2016-08-16T21:43:22.536539+00:00 app[web.1]: [2016-08-16 21:43:22 +0000] [3] [INFO] Shutting down: Master
2016-08-16T21:43:22.513183+00:00 app[web.1]: ImportError: No module named settings.staging
2016-08-16T21:45:48.063161+00:00 heroku[run.3662]: Process exited with status 0
2016-08-16T21:45:48.038116+00:00 heroku[run.3662]: State changed from up to complete
Can someone please help me to sort this out? Thanks in advance.
Upvotes: 0
Views: 1173
Reputation: 3194
Just create an empty __init__.py
file in your settings folder (you are missing it now). It will indicate that folder is a package and thus files from it can be imoprted
Upvotes: 3