1👍
✅
You need to set up directives for your media that will allow apache to directly serve static/media files instead of passing the request to django. Here’s an example VirtualHost configuration that you can use.
<VirtualHost *:80>
ServerAdmin webmaster@{{ maildomain }}
ServerName {{ fqdn }}
WSGIDaemonProcess {{ projectname }} python-path=/var/www/{{ projectname }}/environ/lib/python{{ pyversion }}/site-packages
WSGIProcessGroup {{ projectname }}
WSGIScriptAlias / /var/www/{{ projectname }}/project/wsgi.py
<Directory /var/www/{{ projectname }}/static/>
Order deny,allow
Allow from all
</Directory>
<Directory /var/www/{{ projectname }}/files/>
Order deny,allow
Allow from all
</Directory>
Alias /static /var/www/{{ projectname }}/static/
Alias /files /var/www/{{ projectname }}/files/
ErrorLog /var/log/apache2/{{ projectname }}/logs/errors.log
CustomLog /var/log/apache2/{{ projectname }}/logs/access.log combined
</VirtualHost>
Source:stackexchange.com