Couldn't Find Wsgi Module Deploying Heroku
Trying to deploy my app with this tutorial. Have a ModuleNotFoundError: No module named 'radio.wsgi' message. 2019-08-21T08:08:21.409841+00:00 app[web.1]: __import__(module) 2019-0
Solution 1:
Heroku expects Procfile
to be in the project root. It is easiest to deploy a Django app if manage.py
is in the project root as well. For example, if your project layout was:
├── db.sqlite3
├── manage.py
├── player
├── radio
│ ├── __init__.py
│ ├── __pycache__
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── setup.py
├── static
├── README.md
├── .gitignore
├── requirements.txt
├── runtime.txt
└── Procfile
then you can run:
web: gunicorn radio.wsgi
In your case, your Django project is in the radio
directoy. If you don't want to change the project layout, then you need to add radio
to the python path so that python imports work:
web: gunicorn --pythonpath radio radio.wsgi
Solution 2:
After login from terminal using heroku login
by downloading Heroku CLI, you can deploy on heroku
using git
by following:
git init
git add .
heroku create<app_name>--region <region_name>
git commit-am "SOME MESSAGE"
heroku config:set DEBUG_COLLECTSTATIC=1
heroku ps:scale web=1// (optional)
git push heroku master
The ideal project structure shuold be like this...
radio
├── db.sqlite3
├── manage.py
├── player
├── radio
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
├── setup.py
├── static
├── README.md
├── requirements.txt
├── runtime.txt
└── Procfile
Post a Comment for "Couldn't Find Wsgi Module Deploying Heroku"