Apache2中无法识别Django 2.0静态文件

2024-04-19 11:27:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我的网站是在线的,但它找不到静态文件/ 配置好像都还可以,找不到错误。。。你知道吗

我没有服务器的管理员权限,所以有点糟糕。。 但是,至少他们把他们的配置传给我了。。你知道吗

Apache配置:

<VirtualHost *>
        ServerAdmin suporte@pop-rs.rnp.br
        DocumentRoot /home/metis/public_html/
        ServerName agata.pgie.ufrgs.br
        ServerAlias www.agata.pgie.ufrgs.br
        #ErrorLog /var/log/apache2/agata-error.log
        #CustomLog /var/log/apache2/agata-access.log common

        <Directory /home/metis/public_html/static>
               Require all granted
        </Directory>

        <Directory /home/metis/public_html/AGATA/textMiningProject>
               <Files wsgi.py>
                       Require all granted
               </Files>
        </Directory>

        WSGIDaemonProcess agata python-path=/home/metis/public_html/AGATA python-home=/home/metis/public_html/AGATA/agataenv
        WSGIProcessGroup agata
        WSGIScriptAlias / /home/metis/public_html/AGATA/textMiningProject/wsgi.py
</VirtualHost>

Django版本:2.0 设置.py你知道吗

静态文件(CSS、JavaScript、图像)

https://docs.djangoproject.com/en/1.11/howto/static-files/

STATIC_PATH = os.path.join(BASE_DIR,'static')

STATIC_URL = '/static/' # You may find this is already defined as such.

STATIC_ROOT = '/home/metis/public_html/static'

STATICFILES_DIRS = [
    STATIC_PATH
]

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

MEDIA_URL = '/media/'

它被要求管理员插入以下内容,结果没有变化。。你知道吗

    Alias /media/ /home/metis/public_html/AGATA/media
Alias /static/ /home/metis/public_html/static

<Directory /home/metis/public_html/static>

…

    Order allow,deny
    Allow from all
</Directory>

有人能帮忙吗?你知道吗

编辑1: collectatic的输出:

0 static files copied to '/home/metis/public_html/static', 166 unmodified.

站点上的错误:

simple-sidebar.css Failed to load resource: the server responded with a status of 404 (Not Found)


Tags: pathpybrloghomehtmlstaticpublic