关于Django部署到Apache2之后admin的css不见的问题

BabbleDay posted @ 2015年7月05日 02:25 in Web Development with tags django admin css , 1392 阅读

在本地的时候,admin的css是在django的目录下的。当部署到服务器之后,这些静态文件路径需要修正。

方法是在服务器上 /etc/apache2/sites-enables/PersonalWebsite.conf里面写好 路径的Alias 并且 给目录赋予权限:

注意这里alias有先后,不然alias会重叠,就无效了。

WSGIScriptAlias / /home/ubuntu/PersonalWebsite/PersonalWebsite/wsgi.py
WSGIPythonPath /home/ubuntu/PersonalWebsite
<Directory /home/ubuntu/PersonalWebsite/PersonalWebsite>
    <Files wsgi.py>
        Order deny,allow
        Require all granted
    </Files>
</Directory>

Alias /media/ /home/ubuntu/PersonalWebsite/media/ 

Alias /static/admin/ /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin/

Alias /static/ /home/ubuntu/PersonalWebsite/static/

 

<Directory /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin>

    Require all granted

</Directory>

<Directory /home/ubuntu/PersonalWebsite/static> Require all granted </Directory> <Directory /home/ubuntu/PersonalWebsite/media> Require all granted </Directory>

Avatar_small
how to close SBI cre 说:
2022年8月01日 21:57

Customers of State Bank of India can close their active credit card anytime, where the request to close the credit card should be taken through offline or online mode after completion of all necessary checks by the authority. For this the customer may first submit their application for closure of active credit card, then the process will be as follows Once a request has been placed, how to close SBI credit card the customer should cut the SBI Card into two prices and thus the process of cancellation will be done once due amounts being calculated , and SBI provides an easy way to use all its features using Credit Card and if you are willing to get this closed, then you can move with Online Process or Offline Process or closer as preferred.

Avatar_small
Odisha 8th Class Sy 说:
2023年9月18日 23:21

BSE Odisha Provides the Syllabus for All the 8th This new Syllabus are Designed Strategically by a Team of Subject Experts and are Prescribed by the Department of School and Mass Education, Government of Odisha level Syllabus for the Children of Odisha has been developed with the supervision of the Department of School and Mass Education, Government of Odisha.one Needs to have Odisha 8th Class Syllabus 2024 a good Understanding of the Odisha Exam Pattern and Syllabus 2024, If the Students know the Syllabus of the Exam, then they can Direct their Preparation in the best way.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter