Patr01
Patr01

Reputation: 111

Django Heroku no module named 'my app name'

I'm trying to deploy my first Django app to Heroku. I was able to migrate the database and create a superuser, but now I'm stuck on this:

[2018-05-19 22:51:01 +0000] [4] [INFO] Listening at: http://0.0.0.0:31247 (4)

2018-05-19T22:51:01.283512+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Using worker: sync

2018-05-19T22:51:01.287214+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [INFO] Booting worker with pid: 8

2018-05-19T22:51:01.292792+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [ERROR] Exception in worker process

2018-05-19T22:51:01.292795+00:00 app[web.1]: Traceback (most recent call last):

2018-05-19T22:51:01.292796+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker

2018-05-19T22:51:01.292797+00:00 app[web.1]:     worker.init_process()

2018-05-19T22:51:01.292798+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process

2018-05-19T22:51:01.292800+00:00 app[web.1]:     self.load_wsgi()

2018-05-19T22:51:01.292801+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi

2018-05-19T22:51:01.292802+00:00 app[web.1]:     self.wsgi = self.app.wsgi()

2018-05-19T22:51:01.292803+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi

2018-05-19T22:51:01.292804+00:00 app[web.1]:     self.callable = self.load()

2018-05-19T22:51:01.292806+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load

2018-05-19T22:51:01.292807+00:00 app[web.1]:     return self.load_wsgiapp()

2018-05-19T22:51:01.292808+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp

2018-05-19T22:51:01.292809+00:00 app[web.1]:     return util.import_app(self.app_uri)

2018-05-19T22:51:01.292810+00:00 app[web.1]:   File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app

2018-05-19T22:51:01.292811+00:00 app[web.1]:     __import__(module)

2018-05-19T22:51:01.292816+00:00 app[web.1]: ModuleNotFoundError: No module named 'whispering-shelf-25150'

2018-05-19T22:51:01.292905+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [8] [INFO] Worker exiting (pid: 8)

2018-05-19T22:51:01.329968+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Shutting down: Master

2018-05-19T22:51:01.330127+00:00 app[web.1]: [2018-05-19 22:51:01 +0000] [4] [INFO] Reason: Worker failed to boot.

2018-05-19T22:51:01.413026+00:00 heroku[web.1]: Process exited with status 3

2018-05-19T22:51:07.070132+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=whispering-shelf-25150.herokuapp.com request_id=4b10d0f1-939f-44b6-8ee0-b535cb07f8de fwd="185.5.121.201" dyno= connect= service= status=503 bytes= protocol=https

I developed my application using some tutorials that use mysite in my settings. But now my Heroku app is named whispering-shelf-25150.

What is the relation between those names? For example, should I change every occurence of mysite in settings.py to whispering-shelf-25150?

In my wsgi file I have:

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "whispering-shelf-25150.settings.settings")

Upvotes: 1

Views: 1442

Answers (1)

Chris
Chris

Reputation: 136936

What is the relation between those names? For example, should I change every occurence of mysite in settings.py to whispering-shelf-25150?

The name of your Heroku app is irrelevant. There is no relationship between it and your Python module names.

The name of your settings module must match what's in your project folder, and the name of the top-level folder doesn't matter.

For example, if your directory tree looks like

  • project/ ← ignore this
    • mysite/ ← include this
      • settings.py ← include this
    • some_app/
      • ...

your settings module is mysite.settings.

Upvotes: 1

Related Questions