Blame
|
1 | # GUNICORN Static Files |
||||||
| 2 | ||||||||
| 3 | ## Which server looks where |
|||||||
| 4 | ||||||||
| 5 | ### development server |
|||||||
| 6 | `manage.py runserver` looks everywhere (e.g. for admin static files in .venv) |
|||||||
| 7 | ||||||||
| 8 | ### gunicorn |
|||||||
| 9 | `gunicorn` looks in *staticfiles* if defined in `configs.py` by defining `STATIC_ROOT = BASE_DIR / "staticfiles"` |
|||||||
| 10 | ||||||||
| 11 | ### nginx |
|||||||
| 12 | `nginx` needs definition in |
|||||||
| 13 | ``` |
|||||||
| 14 | location /static/ { |
|||||||
| 15 | alias /home/<user>/<dir>/<dir>/staticfiles/; |
|||||||
| 16 | } |
|||||||
| 17 | ``` |
|||||||
| 18 | - important are the slashes! |
|||||||
| 19 | ||||||||
| 20 | :::info |
|||||||
| 21 | If access rights are missing: `sudo chmod o+x /home/<user>` should be enough |
|||||||
| 22 | ::: |
|||||||
| 23 | ||||||||
| 24 | :::info |
|||||||
| 25 | add `staticfiles/` to `.gitignore` |
|||||||
| 26 | ::: |
|||||||
