cms*_*mgr 5 django nginx django-grappelli gunicorn
我在Ubuntu服务器上运行django 1.4和grappelli 2.4.3,我在生产时通过Windows网络系统查看.当我使用RDP在Ubuntu机器上查看它时,在开发服务器上一切正常.
settings.py的相关部分是:
STATIC_ROOT = os.path.join(os.path.dirname(__file__), '../03_static_files/collected/')
STATIC_URL = '/static/'
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.
os.path.join(os.path.dirname(__file__), '../03_static_files/'),
os.path.join(os.path.dirname(__file__), '../03_static_files/admin/'),
os.path.join(os.path.dirname(__file__), '../03_static_files/filebrowser/'),
os.path.join(os.path.dirname(__file__), '../03_static_files/grappelli/'),
)
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
# apps I added but didn't create
'south',
'grappelli',
'filebrowser',
'tinymce',
'haystack',
'gunicorn',
'debug_toolbar',
'taggit',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
# apps I created
'community',
'fts',
'guidance',
'news',
)
Run Code Online (Sandbox Code Playgroud)
我跑了,collectstatic但管理网站显然只是部分渲染.它肯定会拿起一些CSS,因为有些元素是样式化的.但它并没有吸引其他人,因为它看起来很混乱.我的Nginx或Gunicorn错误日志都没有显示任何404,如果我直接将浏览器指向他们,我可以下载所有的css和js文件.
管理站点目前在IE8和IE9中都是这样的:

该网站的其他一切运行良好.Django调试工具栏说(工作)开发服务器版本和上面的生产版本呈现相同的模板.删除grappelli时,正常的django admin会正常显示.我试过更改我的Nginx配置文件
location /admin/media/ {
root /path/to/django/contrib;
}
Run Code Online (Sandbox Code Playgroud)
至
location /admin/media/ {
root /path/to/grappelli;
}
Run Code Online (Sandbox Code Playgroud)
没有变化.谁能告诉我哪里出错了?
我最好的客人不看你的settings.py是你的应用程序“grappelli”是在django\xc2\xb4s admin之后安装的,而不是之前。查看安装文档中的警告
\n\n显然,您的 css 和 js 是正确的,但 \xc2\xb4t 渲染效果不佳,因为您的应用程序正在渲染 django.contrib.admin 的模板。
\n\n请确保先放置抓钩:
\n\nINSTALLED_APPS = (\n \'django.contrib.auth\',\n \'django.contrib.contenttypes\',\n \'django.contrib.sessions\',\n \'django.contrib.sites\',\n \'django.contrib.messages\',\n \'django.contrib.staticfiles\',\n \'grappelli\',\n \'django.contrib.admin\',\n)\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
2063 次 |
| 最近记录: |