i'am facing a vicious issue accessing static files correctly deployed with collectstatic-
the files are normally viewed in dev mode - but in prod mode noway!
here is my conf:
-Python 3.9 (for specific requirements packages)
-Django 3.2.9
- django app located in VBOX VM /HOME/PycharmProjects/djangoapp (VM is hosted & bridged on a physical ubuntu server)
- I use daphne 3.0.2 for asgi /home/PycharmProjects/djangoapp/venv39/bin/daphne -b 0.0.0.0 -p 9099 djangoapp.asgi:application
- i use apache :
-> to serve static files in the VM
-> as a reverse proxy to root requests from outside to the VM
My settings.py
...
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = '/var/www/media/'
..
DEBUG = False
......................
Appache (IN VM):
Alias /static/ /var/www/static/
<Directory /var/www/static/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Fichiers médias
Alias /media/ /var/www/media/
<Directory /var/www/media/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
# Autres configurations pour l'application (si besoin)
ProxyPass / http://127.0.0.1:9099/
ProxyPassReverse / http://127.0.0.1:9099/
</VirtualHost>
i grant permission to VM_apache to acces static /media folders with : sudo chown -R www-data:www-data /var/www/static /var/www/media
in local dev mode all things are ok- but passing to Prod - the app is going on except static files (404 for all the files)
Config Issue? Permission? Ubuntu ?