maz solie
maz solie's

maz solie's

Gunicorn, Inlets, Whitenoise

maz solie's photo
maz solie
·Sep 22, 2020·

1 min read

Subscribe to my newsletter and never miss my upcoming articles

Play this article

Ok, tldr; I need to test gunicorn vs runserver in my local development. Normally gunicorn will not handle the static files serving, since it's nginx or other web server thing. But, in case of inlets, I don't want to setup a web server just to serve the static files, since the is handling this serving + inlets quite well.

The problem is not really clear, since some javascript and css are loaded from static folder without any problem, but for images it gives 404 status. So, after some trials and errors, I have it resolved by utilising the whitenoise package. What I need is just adding the whitenoise into the middleware part of the setting, like so:

  # ...
  # ...

If you go to the documentation site, maybe you need to edit some references to the static folder, but in my case, adding the above line is enough.

Now, gunicorn (or the wsgi) is serving the static files correctly, and using inlets to expose the local port to public is now running perfectly.

Share this