就像标题所说的,所有404都有:
Page not found (404)
Request Method: GET
Request URL: http://localhost/static/admin/css/base.css
Using the URLconf defined in djcms.urls, Django tried these URL patterns, in this order:
^admin/
The current URL, static/admin/css/base.css, didn't match any of these.
基本上,我只是按照djangproject.com网站,所以除了Django本身没有什么复杂的事情发生。在
我的文件夹结构如下:
^{pr2}$注意:在Apache中启用了FollowSymLinks
以及设置.py看起来像:
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = '/var/www/djcms/static'
# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
#'/var/www/djcms/static',
)
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
ADMIN_MEDIA_PREFIX = '/static/admin/'
我在中尝试了几种不同的静态变量排列设置.py,但到目前为止还没有任何效果,我也没有其他任何东西可以在谷歌上搜索到。在
似乎对
admin
应用程序的静态文件的请求正在命中Django应用程序。我假设您的url定义正确,但是值得使用Django静态文件配置重新检查。在如图in the documentation on static files:
这意味着,您需要设置web服务器(例如Apache)来为Django之外的静态文件提供服务(因此,对该URL的请求甚至不应该到达Django应用程序)。在
还要确保您已经调用了^{} 。在
相关问题 更多 >
编程相关推荐