【发布时间】:2014-02-26 14:31:43
【问题描述】:
我正在尝试在 apache/centos 6 上启动一个 django 站点并使用服务器上的 apache 提供内容
settings.py
DEBUG = False
STATIC_ROOT = '/home/etzsales/public_html/detectphonenumbers/static/'
STATIC_URL = 'http://sailstree.com/static/'
我在安装的应用程序中也有静态。
但我得到所有图像、css、js 的 404
我可以从我的静态文件夹中收集静态,现在它位于 STATIC_ROOT 文件夹中
在我的 html 页面中,例如 base.html
{% load static from staticfiles %}
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link rel="stylesheet" href="{{ STATIC_URL }}css/blueimp-gallery.min.css">
注意我尝试了静态标签以及 static_url 设置
我得到的只是 404,如果我打开链接就会显示
没有找到请求的网址
Apache 是在为我的静态服务还是我遗漏了什么
我的 apache 乱七八糟,如果你需要,我可以发布,但这些是最重要的
WSGIScriptAlias / /home/etzsales/public_html/detectphonenumbers/detectphonenumbers/wsgi.py
<VirtualHost 50.62.213.44:80>
ServerName www.ip-50-62-213-44.ip.secureserver.net
ServerAlias www.ip-50-62-213-44.ip.secureserver.net
# Alias /robots.txt /var/www/django/mysite/static/robots.txt
# Alias /favicon.ico /var/www/django/mysite/static/favicon.ico
Alias /static/admin/ /usr/lib/python2.6/site-packages/django/contrib/admin/media/
Alias /static/ /home/etzsales/public_html/detectphonenumbers/static/
Alias /media/ /home/etzsales/public_html/detectphonenumbers/media/
<Directory /home/etzsales/public_html/detectphonenumbers/>
Order allow,deny
Allow from all
</Directory>
<Directory /home/etzsales/public_html/detectphonenumbers/media/>
Order deny,allow
Allow from all
</Directory>
<Directory /home/etzsales/public_html/detectphonenumbers/static/>
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
请有人帮助我,因为我在过去 2 天里一直在努力解决这个问题 谢谢大家,
另外,如果提供的信息不充分,请告诉我,我会发布完整的 apache httpd.conf
谢谢大家
【问题讨论】: