这些天,我设置了apache2和mod_wsgi来保存我的django站点,但是当我用hello world django站点测试时,apache2显示了与服务器django提出的不同接口,即manage.py runserver
< / p>
django服务器显示here
并且apache显示there
所以,我不知道我是否对apache做错了什么?
答案 0 :(得分:0)
您尚未正确告诉Apache静态媒体资产的位置。请参阅以下所述的Alias指令:
答案 1 :(得分:0)
这很简单,你必须将django admin静态文件链接到你的apache2使用的生产文件。
let say that your web production files are in /var/www/www.localhost.com/
in the settings.py files add the path ADMIN_MEDIA_PREFIX = '/localhost/admin_media/'
now you have to link the static file to django default admin static files :
by using [apps_path_to_admin_static]$ sudo ln -s [path to django]/static/admin
example :
ali@host:/var/www/www.localhost.com/localhost/static$ sudo ln - s
/usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin
in apache2 virtualhost add the path:
Alias /admin_media /var/www/www.localhost.com/localhost/static/admin_media