11👍
✅
I faced this issue as well.
i can’t place the static files in /var/www
as Noah suggested.
Solved by adding to apache2.conf
:
<Directory /usr/local/django_apps/myapp/static>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
8👍
Another possibility would be a missing trailing slash in the static root directory. The following configuration was resulting in 403 errors:
WSGIPythonPath /home/foo/app/
WSGIPythonHome /home/foo/.envs/foo
<VirtualHost *:80>
Alias /static/ /home/foo/assets
ServerAdmin foo@bar.com
WSGIScriptAlias / /home/foo/app/wsgi.py
ErrorLog ${APACHE_LOG_DIR}/app_wsgi_error.log
CustomLog ${APACHE_LOG_DIR}/app_wsgi_access.log combined
<Directory /home/foo/app/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
<Directory /home/foo/assets>
Require all granted
</Directory>
</VirtualHost>
After adding a trailing slash to /home/foo/assets
, everything worked perfectly. I hope that helps future Googlers.
1👍
I figured it out. I moved all the files the static and media files to /var/www and apache seems much happier
👤noah
Source:stackexchange.com