dockerizing-django icon indicating copy to clipboard operation
dockerizing-django copied to clipboard

/usr/src/app/static doesn't copy across from local

Open mmichealjroberts opened this issue 6 years ago • 1 comments

I can't seem to copy /static inside my project directory to /usr/src/app/static ... my css/js/img inside static are all missing.

All I seem to find is admin and rest_framework directories. Nothing else.

mmichealjroberts avatar Jun 04 '19 20:06 mmichealjroberts

I'm not sure whether this is the exact same situation but this is what worked with my setup:

My problem was that the static files resulted in 404-Errors. The /usr/src/app/static directory was filled properly on the web-container, but was empty/non-existant under nginx. In the docker-compose.yml file the static volume is mounted once under /usr/src/app/static for web and once under /www/static for nginx.

For me the exchanging the /static-alias did the job (which makes sence since static is served by the nginx-container):

I've replaced

location /static {
    alias /usr/src/app/static;
}

with

location /static {
    alias /www/static;
}

and after rebuilding nginx it worked fine.

donhauser avatar Mar 29 '21 16:03 donhauser