我的css文件不在Production server
中工作。我部署使用WSGI
。你能解决我的问题吗?谢谢 css link
CSS文件没有出现在生产服务器
<link href="{{ MEDIA_URL}}css/style.css" rel="stylesheet" type="text/css" />
settings.py
CURRENT_PATH = '/home/nibbler/code/project/
MEDIA_ROOT = os.path.join(CURRENT_PATH, 'templates/media')
MEDIA_URL = '/media/'
TEMPLATE_DIRS = (
os.path.join(CURRENT_PATH, 'templates/temp_name'),
)
site-available\default
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName project.org
DocumentRoot "/home/nibbler/code/project/"
ServerName localhost
ErrorLog "/home/nibbler/code/project/logs/apache-error.log"
CustomLog "/home/nibbler/code/project/logs/apache-access.log" common
Options ExecCGI FollowSymLinks MultiViews
AddHandler wsgi-script .wsgi
WSGIDaemonProcess nibbler
WSGIProcessGroup nibbler
Alias /media /home/nibbler/code/project/templates/media/
WSGIScriptAlias//home/nibbler/code/project/apache/django.wsgi
DirectoryIndex index.html index.cgi
AddHandler cgi-script .cgi .pl
</VirtualHost>
urls.py
if settings.DEBUG:
# static files (images, css, javascript, etc.)
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))
MEDIA_ROOT相同。 settings.py中没有结尾的斜杠。 –
@Graham Dumpleton Ive变了。但不工作。 – Kulbir
您是否尝试过访问静态媒体文件?您是否希望他们能够计算出哪些HTTP错误?您是否查看过网页的HTML源代码以查看返回的内容是否正确? DIrectory/Allow如何丢失? –