这些天,我设置了 apache2 和 mod_wsgi 来保存我的 django 站点,但是当我使用 hello world django 站点进行测试时,apache2 显示与 django 提供的服务器不同的接口,即,manage.py runserver
django 服务器显示在这里
和阿帕奇显示那里
所以,我不知道我是否对apache做错了?
您没有正确告诉 Apache 您的静态媒体资产在哪里。请参阅中描述的别名指令:
这可能很简单,您必须将 django 管理静态文件链接到 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