I configure nginx by this link .
But django does not see the statics either in the admin or in the project.

 #settings.py STATIC_URL = '/static/' STATIC_ROOT = 'djangoenv/static' 

ls -al /root

enter image description here

 #nginx server { server_name detsky-sadik.ru; access_log off; location /static/ { alias /djangoenv/static/; } location / { proxy_pass http://detsky-sadik.ru:8001; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } } 

Statics on the server collected. Googling, I tried to add mime.types to /etc/nginx/sites-available/det_sad , but nginx cursed it.
Please help.

  • show nginx'a config, without it you can hardly say something specific - Flowneee
  • Transfer the config from the comment to the question. And it’s immediately obvious that: you give the static in nginx by the absolute path /djangoenv/static/ , but you don’t most likely have djangoenv not at the root of the file system? After all, STATIC_ROOT = 'djangoenv / static' you have this relative path, it means that if you did it in a tutorial, then most likely you should have nginx /opt/djangoenv/static/ - Flowneee
  • I did without opt . After root immediately go to djangoenv/static . That is, in theory, the path is correct. - Pasha Serchenya
  • A very bad idea to litter the root. And so make ls -al / and give a conclusion (put everything into a question, not in a comment), perhaps nginx simply does not have permissions to read this folder - Flowneee
  • And at the same time look, is your djangoenv eating at the root? because STATIC_ROOT = 'djangoenv/static' hints that the folder created by collectstatic will lie somewhere relative to the project folder, and not at the root - Flowneee

1 answer 1

I solved the problem by deleting the droplet and installing a new one with another tutorial. Thank you Flowneee for trying to help :)