STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, "folder name in which you keep your static files")]
STATIC_ROOT = "full path where u want to keep your static files in production"
Before you set up a nginx server, do python manage.py collectstatic
If you using nginx, grant permissions to your static and media files. Go to /home/YourUser/ type in terminal sudo "chown -R :www-data" DjangoProject/" and do the same operation granting permissions to STATIC_ROOT dir and MEDIA_ROOT dir
Nginx server config
location /static {
alias STATIC_ROOT from settings.py;
}
location /media {
alias MEDIA_ROOT from settings.py;
}
Then run sudo service nginx restart, it should work
Thank you very much for your help. I have to apologize I think I was not precise enough. I am a beginner and in a very simple dev environment, which means I am using the local server, not NGINX. Is STATIC_ROOT in a local environment still necessary? If it is, than that was my mistake. Thanks in advance :)
Sodowojnov
mr.INSOMNIA
Alex
Vxvek
Doragonsureiyā
Harsha [M]
cj
Parsa
Authentic
Utsho Sadhak
Michael the wolf 🐺
Chetan
𝘿𝙖𝙫𝙞𝙙
Yummy
Украинский
Learning