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

时间:2018-02-08 13:36:05

标签: python django apache static

我的网站在线,但无法找到静态文件; / 配置似乎都没问题,无法找到错误...

我没有在服务器上拥有管理员权限,所以它很糟糕...... 但是,至少他们通过了他们已经提出的配置..

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 settings.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: collecstatic 的输出:

  

将0个静态文件复制到&#39; / home / metis / public_html / static&#39;,166   未修饰的。

网站上的错误:

  

simple-sidebar.css无法加载资源:服务器响应   状态为404(未找到)

0 个答案:

没有答案