I am trying to deploy my Django project with Heroku, and I know my Procfile is in the wrong location. But, when I move it to the correct directory, the app can't start.
I initially made the Procfile in my app directory instead of my project root directory, and when I try to move the Procfile to the root directory, I get a ModuleNotFoundError from wsgi.py regarding my settings file (I am using a settings folder to separate development and production settings files, so I made it a module, just FYI).
This is my Procfile:
web: gunicorn my_site.my_site.wsgi --log-file -
Here is my wsgi file:
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'my_site.settings.production_settings')
application = get_wsgi_application()
Here is the error I get when I try to run heroku locally:
ModuleNotFoundError: No module named 'my_site.settings'
If I add another directory level to the to the location of my settings file (in wsgi.py):
'my_site.my_site.settings.production_settings'
I then get a new error about an app not being found in my INSTALLED_APPS in my settings. It seems that me changing the location of my Procfile somehow messes up all the directory extensions in my project, which doesn't make any sense. If I keep the Procfile in the original location, everything works, except I can't launch a dyno on heroku because the Procfile's original location isn't the root project directory.
EDIT Here is a pic of the directory structure: Where Procfile used to be Where Procfile is now
The Procfile used to be under 'my_site/my_site/my_site', but then I moved it to be under just 'my_site/'. Is this not the project root directory?