0
所以基本上我已经在aps和mod wsgi的vps上部署了我的应用程序。对于我的静态文件我用{%URL%}模板标签是这样的:django网址模板标签相关网址
<link href="{% static "bootstrap.min.css" %}" rel="stylesheet">
的Django没有加载静态文件,因为它产生相对URL,这样我通过
<link href="/{% static "bootstrap.min.css" %}" rel="stylesheet">
固定它但是现在,当我进入/管理页面时,它不会再加载静态文件,这是因为相关的url。我怎样才能解决这个问题 ?
这里是我的MOD WSGI:
import os
import sys
import site
# Add the app's directory to the PYTHONPATH
sys.path.append('/home/tshirtnation')
sys.path.append('/home/tshirtnation/tshirtnation')
os.environ['DJANGO_SETTINGS_MODULE'] = 'tshirtnation.settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
而且我的Apache配置:
#Listen 80
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName 5.199.166.109
WSGIDaemonProcess ts threads=25
WSGIProcessGroup ts
Alias /static /home/tshirtnation/staticfiles
WSGIScriptAlias//home/tshirtnation/index.wsgi
</VirtualHost>
让我知道你需要什么。
@丹那是不正确的。 mod_wsgi是文档推荐的一个支持良好且稳定的组合。 (你可能会想到mod-python,这是不支持或推荐的。) –
@Marijus你应该从settings.py中发布相关的STATIC_ *值。 –
@DanielRoseman你是对的 - 删除不混淆人 –