The Python Oracle

Django React Nginx serving admin static files

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Meditation

--

Chapters
00:00 Django React Nginx Serving Admin Static Files
01:35 Accepted Answer Score 3
02:09 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;
}