Remove Nginx-specific static and media serving, and serve media through Django using WhiteNoise and FileResponse.

This commit is contained in:
krek0 2026-04-24 22:26:03 +02:00
parent aa348d2b04
commit 92e1336f80
6 changed files with 46 additions and 23 deletions

View file

@ -17,9 +17,6 @@ run and to maintain.
```bash
sudo apt install git gettext python3-django python3-django-allauth python3-django-crispy-forms python3-docutils python3-exifread python3-pil
# Only for production
sudo apt install nginx uwsgi uwsgi-plugin-python3 python3-certbot-nginx
```
2. **Cloning.**
@ -33,19 +30,8 @@ run and to maintain.
3. **Configuration (production only).**
```bash
# Only for production
sudo mkdir static media
sudo cp docs/maintenance.html static/maintenance.html
sudo chown www-data:www-data -R static media
sudo chmod g+rwx -R static media
sudo chmod +x maintenance_tool.sh
sudo cp docs/uwsgi_photos.ini /etc/uwsgi/apps-available/uwsgi_photos.ini
sudo ln -s /etc/uwsgi/apps-available/uwsgi_photos.ini /etc/uwsgi/apps-enabled/
sudo cp docs/nginx_photos_maintenance /etc/nginx/sites-available/photos.crans.org
sudo ln -s /etc/nginx/sites-available/photos.crans.org /etc/nginx/sites-enabled/
sudo cp docs/letsencrypt_photos.crans.org /etc/letsencrypt/conf.d/photos.crans.org
sudo cp docs/renewal-hooks_post_nginx /etc/letsencrypt/renewal-hooks/post/nginx
sudo certbot --config /etc/letsencrypt/conf.d/photos.crans.org.ini certonly
```
4. **Database (production only).**
@ -82,7 +68,6 @@ run and to maintain.
6. *Enjoy \o/*
In production, the NGINX site should now work.
In development, you can launch the development server using:
```bash