mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2026-04-25 09:25:55 +03:00
[GH-ISSUE #1718] Django Static files serving #1277
Labels
No labels
awaiting feedback
bug
cannot reproduce
dns provider request
duplicate
enhancement
enhancement
enhancement
good first issue
help wanted
invalid
need more info
no certbot plugin available
product-support
pull-request
question
stale
troll
upstream issue
v2
v2
v2
v3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nginx-proxy-manager-NginxProxyManager#1277
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Maxino22 on GitHub (Jan 2, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1718
Hello am new to nginx proxy manger and soo far i have understood the workflow however in the location section am having a bit of trouble.. am running a django app with gunicorn which only handles python code hence my static files(javaScript & CSS) are not being served..
i want to include them in the location area but every time I do it the host goes offline... if I used an nginx config file traditionally this is what it would look like
I want the proxy params , media and static to be included in location but I can't find a way... kindly assist
@chaptergy commented on GitHub (Jan 2, 2022):
The way I understand you are trying to do it is not possible. I'm assuming you run the django app with gunicorn in a container? Then npm has no access to the files you are trying to serve. Furthermore static file serving is not supported officially by npm, there only is a feature request for it. You should theoretically be able to have static file serving by mounting the files into the container and using the advanced config, but we can't officially support this, you might want to try the reddit community.
But as a tip: only the three non-
/locations are relevant, the/location and stuff above the locations are automatically generated. You also want to use the advanced config, as the custom locations generate code for proxying, not for file serving. But pasting the three locations into the advanced tab and mounting the files into the npm container should work.@Maxino22 commented on GitHub (Jan 3, 2022):
Thank you very much for replying . I honestly did not understand but I found a work around using whitehorse to serve my statics directly from the python. I tried looking at the credit community for answers but none of them were to detail. finally I would like some assist on redirecting as the HTTP versions of my domain are still accessible and the www does not redirect to non www .... i saw redirect host but documentation and online searches don't quite show
@chaptergy commented on GitHub (Jan 3, 2022):
Create a redirect host for
www.example.comand redirect it toexample.comusually with a301redirect. If you know, that this redirect will change in the future, use a302redirect to indicate it is temporary.To make sure you only use HTTPS just enable Force SSL and HSTS in your proxy host.
@Maxino22 commented on GitHub (Jan 3, 2022):
Wow thank you that actually worked
@keniobats commented on GitHub (Sep 30, 2022):
@Maxino22 Hi! any updates on this? I'm facing the same issue. Couldn't find any references to "whitehorse" you mention. Thanks!
@Maxino22 commented on GitHub (Sep 30, 2022):
sorry mate its not whitehorse rather white noise... it makes running django quite easy.... http://whitenoise.evans.io/en/stable/ ... it will be easy read the docs i beleive will solve problem
@keniobats commented on GitHub (Sep 30, 2022):
Thanks @Maxino22 I'll give it a shot!
@keniobats commented on GitHub (Oct 1, 2022):
I've already solved with Whitenoise, thanks @Maxino22 !!!
@Maxino22 commented on GitHub (Oct 2, 2022):
you welcome... Glad i could help 🔥
@snake-soft commented on GitHub (Dec 17, 2022):
It can cause problems when adding an advanced configuration and enable "cache assets".
I got a 404 trying to load asset files (Django static and media).
It works after disabling "cache assets".
@mr-engin3er commented on GitHub (Sep 23, 2024):
This solved my issue.