Reputation: 1016
Struggling to the Procfile I'm using for heroku working. Trying to learn how to get a basic django website up and running and have built something from scratch. I use windows on my PC to tinker around so decided on using waitress but perhaps gunicorn would be easier?
If I can't work it out I'll just use a template from heroku and build from that but I would rather not get rid of what i've done so far.
This is my directory structure.
Root +---
.git
Include
Lib
Scripts
Scripts
Static
tcl
src +---
� db.sqlite3
� manage.py
�
+---alex1
� � forms.py
� � settings.py
� � urls.py
� � wsgi.py
� � __init__.py
� �
� +---__pycache__
� settings.cpython-36.pyc
� urls.cpython-36.pyc
� wsgi.cpython-36.pyc
� __init__.cpython-36.pyc
�
+---profiles
� admin.py
� apps.py
� forms.py
� models.py
� tests.py
� views.py
� __init__.py
�
+---migrations
� � 0001_initial.py
� � 0002_profile_description.py
� � 0003_auto_20170905_1654.py
� � 0004_auto_20170905_1659.py
� � __init__.py
� �
� +---__pycache__
� 0001_initial.cpython-36.pyc
� 0002_profile_description.cpython-36.pyc
� 0003_auto_20170905_1654.cpython-36.pyc
� 0004_auto_20170905_1659.cpython-36.pyc
� __init__.cpython-36.pyc
�
+---templates
� base.html
� contact.html
�
+---__pycache__
admin.cpython-36.pyc
forms.cpython-36.pyc
models.cpython-36.pyc
views.cpython-36.pyc
__init__.cpython-36.pyc
The error I'm receiving is this
2017-10-08T09:33:38.547463+00:00 app[web.1]: There was an exception (ModuleNotFoundError) importing your module.
2017-10-08T09:33:38.547464+00:00 app[web.1]: It had these arguments:
2017-10-08T09:33:38.547464+00:00 app[web.1]: 1. No module named 'profiles'
And this is my procfile.
web: waitress-serve --port=$PORT profiles.wsgi:application
Thanks everyone - truly appreciate your help
Upvotes: 1
Views: 1244
Reputation: 355
First of all, your wsgi.py file is not inside src/profiles is inside src/alex1. Also, waitress is not finding your app profiles because is not in the python path. I don't know if waitress has a parameter to add stuff into the PYTHONPATH (like gunicorn --pythonpath) but anyway you can do something like this:
web: PYTHONPATH=$(pwd)'/src' waitress-serve --port=$PORT alex1.wsgi:application
I've worked with waitress and I can't see the improvement of using it instead of gunicorn. Some people say it's more performant but in my experience it's just more annoying to use.
Upvotes: 2