【发布时间】:2014-11-24 08:24:42
【问题描述】:
所以我看到很多关于 Apache 不提供 Django 管理静态文件的信息,但由于某种原因,Apache 不提供任何静态文件。它理解并找到模板,但没有加载图像、css 或 javascript。
编辑 2:更新了两个文件以显示新设置
编辑:我添加了 STATIC_ROOT 并且我能够收集静态文件,但在服务器重新启动后它仍然无法提供它们。
我试过 ./manage.py collectstatic 并得到这个错误:
ImproperlyConfigured("You're using the staticfiles app "
django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without
having set the STATIC_ROOT setting to a filesystem path.
我的 settings.py 文件在这里:
https://github.com/rchurch4/stackquestions/blob/master/settings.py
我的 nxt4.com.conf 文件在这里:
https://github.com/rchurch4/stackquestions/blob/master/nxt4.com.conf
如果有人能告诉我具体如何配置它,以便 Apache 为 django 的静态文件提供服务,那就太好了。我正在使用 mysql 数据库在 AWS 上运行 Ubuntu。服务器上站点的文件路径是:/home/ubuntu/nxt4.com/nxt4/
提前致谢
【问题讨论】:
-
您说您已添加
STATIC_ROOT- 您尚未将其添加到您链接的settings.py。另外,显示您的实际设置? -
实际设置是什么意思?对 Web 服务器来说是全新的,所以越具体越好。如果通过实际设置您的意思是 /etc/apache2/sites-enabled/nxt4.com.conf,那么它是在我输入此评论后将立即启动的最新编辑...
标签: django apache ubuntu amazon-web-services httpd.conf