<div dir="ltr">I tested this method out and it did work with gunicorn. The only ugly part is having to re-define the MIDDLEWARE entirely. I couldn't find a way to simply just add the middleware I wanted in the spot I needed it.<div><br></div><div>Brian any thoughts on supporting this out of the box? I'm happy to do the work but I'd like to know it's desired.<br><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 9, 2018 at 9:11 AM Patrick Creech <<a href="mailto:pcreech@redhat.com">pcreech@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Wed, 2018-10-03 at 16:28 -0400, Eric Helms wrote:<br>
> Howdy,<br>
> <br>
> When switching a deployment over to use gunicorn, DEBUG = TRUE for serving static files stopped working. I endeavored to follow the production install method using collectstatic. This required<br>
> setting STATIC_ROOT which appeared to not be set by default.<br>
> <br>
>  1) Is there a default value for STATIC_ROOT I can set for collectstatic?<br>
>  2) Can gunicorn serve these static files for me?<br>
> <br>
> I realize the documentation calls for serving static files via a webserver like nginx or Apache. However, that becomes a bit overkill in something like a container deployment. If I run a separate<br>
> webserver, then I would run it as a separate container and have to mount the static files volume. This felt like overkill to me to have a persistent volume to store and mount static files instead of<br>
> the application server providing them for the application.<br>
> <br>
> Any thoughts and help are appreciated.<br>
> <br>
> Eric<br>
<br>
Eric,<br>
<br>
I got curious and took a look into your situation.<br>
<br>
I came across this project, suggested to be used by heroku, to achieve the goal you are working towards: <a href="http://whitenoise.evans.io/en/stable/" rel="noreferrer" target="_blank">http://whitenoise.evans.io/en/stable/</a><br>
<br>
It comes with django middleware support out of the box, so all you would need to do is to 'pip install whietnoise' and edit the MIDDLEWARE collection in the settings.py to include it,  You want it to<br>
load AFTER SecurityMiddleware, but BEFORE everything else, so make it the second line, here: <a href="https://github.com/pulp/pulp/blob/master/pulpcore/pulpcore/app/settings.py#L91" rel="noreferrer" target="_blank">https://github.com/pulp/pulp/blob/master/pulpcore/pulpcore/app/settings.py#L91</a><br>
<br>
For your deployment model, it shouldn't be hard to apply a patch to the code at a stage in your container process to inject this middleware into the settings.py<br>
<br>
Otherwise, it's the standard 'staticfiles' process for django,  They have it simplified in step 1 here: <a href="http://whitenoise.evans.io/en/stable/django.html" rel="noreferrer" target="_blank">http://whitenoise.evans.io/en/stable/django.html</a><br>
</blockquote></div></div></div>