Django 生产中的静态文件404
部署我的应用程序后,没有加载任何静态文件。当我检查开发工具时,它们都是404 我运行了Django 生产中的静态文件404,django,Django,部署我的应用程序后,没有加载任何静态文件。当我检查开发工具时,它们都是404 我运行了python3 manage.py collectstatic 设置.py STATIC_URL = '/static/' STATIC_ROOT = '/srv/example/static/' “我的静态文件夹”具有以下权限和所有权: drwxr-xr-x 8根根目录4096 11月17日23:28静态 My/etc/apache2/sites enabled/example.conf: <Vir
python3 manage.py collectstatic
设置.py
STATIC_URL = '/static/'
STATIC_ROOT = '/srv/example/static/'
“我的静态文件夹”具有以下权限和所有权:
drwxr-xr-x 8根根目录4096 11月17日23:28静态
My/etc/apache2/sites enabled/example.conf
:
<VirtualHost *:80>
ErrorLog ${APACHE_LOG_DIR}/example-error.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
WSGIDaemonProcess example processes=2 threads=25 python-ho>
WSGIProcessGroup example
WSGIScriptAlias / /srv/example/example/wsgi.py
Alias /robots.txt /srv/example/static/robots.txt
Alias /favicon.ico /srv/example/static/favicon.ico
Alias /static /srv/example/static/
Alias /media /srv/example/media/
<Directory /srv/example/example>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /srv/example/static>
Require all granted
</Directory>
<Directory /srv/example/media>
Require all granted
</Directory>
</VirtualHost>
ErrorLog${APACHE_LOG_DIR}/example-error.LOG
CustomLog${APACHE_LOG_DIR}/example-access.LOG组合
WSGIDaemonProcess示例进程=2个线程=25个python ho>
WSGIProcessGroup示例
WSGIScriptAlias//srv/example/example/wsgi.py
别名/robots.txt/srv/example/static/robots.txt
别名/favicon.ico/srv/example/static/favicon.ico
别名/static/srv/example/static/
别名/media/srv/example/media/
要求所有授权
要求所有授权
要求所有授权
apache日志是否显示返回404的入站请求?是的,在我的
access.log
too中它们是404。您认为这是您的应用程序的编码问题吗?如果是配置问题,可能应该将其传输到serverfault
?我的静态文件在文件夹中,并且我尝试在没有运气的情况下删除后面的斜杠/static/文件夹应该属于组www data只是组还是用户和组?因为我现在将其作为两者,并且404www数据仍然是Apache所属的组。如果路径中的所有文件夹都属于组www数据,并且具有组的读取权限,则该文件夹应该可以工作(如果没有其他问题)