I’m trying to deploy a Django site on the app platform. It keeps failing with:
ModuleNotFoundError: No module named 'thesite.wsgi'
I started the project with django-admin startproject thesite
My run command for the app is gunicorn --worker-tmp-dir /dev/shm thesite.wsgi
And if I run that command from the project root (the same location as manage.py
) on my local machine, everything works.
Any thoughts? I suspect that this is something related to the context where the gunicorn command is running, but I can’t figure out how to get a shell in the same VM/container/whatever that the app is hosted in.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi there,
There are a couple of things that I could suggest here:
Make sure you have a
requirements.txt
orPipfile
in your project’s root directory, listing all the dependencies, includinggunicorn
. The app platform will use this file to install the required packages.Ensure that your directory structure is correct. It should look like this:
Source Directory
is set correctly. If yourmanage.py
and the innerthesite
directory are in the root of your repository, leave theSource Directory
field empty or set it to/
.After try force redeploying your Django app on the app platform.
On another note, here is an example Django project which you could use as a reference:
https://github.com/digitalocean/sample-django
Let me know how it goes!
Best,
Bobby