簡體   English   中英

Apache2服務器在同一站點上與django服務器顯示不同的接口

[英]Apache2 server shows different interface with django server , at the same site

這些天來,我設置了apache2和mod_wsgi來保存我的django站點,但是當我用一個hello world django站點進行測試時,apache2顯示了與服務器django的不同接口,即提出了manage.py runserver

django服務器顯示在這里

和apache顯示在那里

因此,我是否對Apache做錯了事?

您沒有正確告訴Apache靜態媒體資產在哪里。 請參閱以下內容中描述的Alias指令:

這可能很簡單,您必須將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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM