I've a tiny web app built on Django that has some static files collected by python manage.py collectstatic
. I'm using a lightweight server, Waitress
When I run my server using the script
from waitress import serve
from <my app>.wsgi import application
if __name__ == '__main__':
serve(application, host = '0.0.0.0', port='8000')
the app loads up to http:localhost:8000
but I notice the static files are not present. From the terminal, I can read
Not Found: /static/<my app>/styles.min.css
WARNING:django.request:Not Found: /static/<my app>/styles.min.css
Not Found: /static/<my app>/buttonhover.css
WARNING:django.request:Not Found: /static/<my app>/buttonhover.css
Not Found: /static/<my app>/script.min.js
Do I need something in addition to Waitress to serve the static files? Do I need a reverse proxy like nginx running alongside Waitress? If so, are there Python reverse proxies available?
I found a solution using the White Noise library.
Do I need something in addition to Waitress to serve the static files?
Yes. Kinda. You do need something to help Django find the static files, or upload them to a container online like AWS S3.
Do I need a reverse proxy like nginx running alongside Waitress?
No. White Noise is a simple add on to a Django project which in my opinion pairs it well with Waitress since they're self-contained Python projects.