Django管理员不提供Apache上的静态文件 [英] Django admin not serving static files on Apache
问题描述
当您使用apache提供静态文件时,在/ var / www / html目录中。我经历了与你同样的情况。收藏没有为我工作。我所做的是,将admin应用程序的静态内容复制到/ var / www / html / static / admin
。此管理目录包含四个其他目录 css,fonts,img和js
。在我的情况下apache安装是默认的,所以/ var / www / html是我的公共目录。以下内容可供参考。
服务器
|
-var
|
-www
|
-html
|
- static
|
-admin
| -css
| -fonts
| -img
| -js
您可以尝试上述方法。如果您让知道问题得到解决将是有帮助的。
I've seen similar questions but they are more than 4 years old and the answers doesn't work anymore. I have a site that works correctly on Apache, except for the admin staticfiles. The staticfiles work fine with Django's runserver. I'm kind of lost here, any advice will help.
When you serve static files using apache, static folder is supposed to be in your /var/www/html directory. I had gone through same scenario as yours. collectstatic didnt work for me. What I did was, copied static contents of admin app to /var/www/html/static/admin
. This admin directory contains four other directories css, fonts, img and js
. In my case apache setup was the default so /var/www/html was my public directory. Following can be used for reference.
server
|
-var
|
-www
|
-html
|
- static
|
-admin
|-css
|-fonts
|-img
|-js
You can try aforementioned approach. It would be helpful if you let know issue is resolved.
这篇关于Django管理员不提供Apache上的静态文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!