The Python Oracle

Django React Nginx serving admin static files

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Thinking It Over

--

Chapters
00:00 Django React Nginx Serving Admin Static Files
01:28 Accepted Answer Score 3
02:10 Thank you

--

Full question
https://stackoverflow.com/questions/4249...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #css #django #nginx

#avk47



ACCEPTED ANSWER

Score 3


Your location /static is wrong. The alias directive substitutes parts of the URI when forming the pathname. The location parameter and the alias parameter should both end with a /, or neither end with a /:

location /static {
    alias /root/se/env/public/static;
}

or:

location /static/ {
    alias /root/se/env/public/static/;
}

In fact, because the alias parameter ends with the location parameter, you should not be using the alias directive at all. See the note at the end of the alias documentation.

location /static {
    root /root/se/env/public;
}