ᅠ ᅠ
And where to find the request itself - I have no idea
ᅠ ᅠ
ᅠ ᅠ
curl -I youwebsite/static/file/75847.mp4
Using the URLconf defined in json_site.urls, Django tried these URL patterns, in this order:
admin/
post/
api/create_post/ [name='create_post']
api/get_views/ [name='get_views_api']
api/delete_posts/ [name='delete_posts_by_link']
The current path, static/file/75847.mp4, didn’t match any of these.
Muflone
Muflone
Make sure to restart the web server
ᅠ ᅠ
Muflone
Django must not receive at all those requests
If Django is receiving them then nginx is passing the requests to it
Muflone
ᅠ ᅠ
Muflone
You could also delete your whole project, still nginx will serve them
Muflone
Restart the web server as a begin
ᅠ ᅠ
sudo systemctl restart nginx
ᅠ ᅠ
gunicorn json_site.wsgi:application --bind 127.0.0.1:8000
ᅠ ᅠ
Not Found: /static/css/styles.css
Muflone
What address are you requesting with the browser?
ᅠ ᅠ
domain.com/post/37372
Muflone
Domain with no ports?
ᅠ ᅠ
I used nginx to hide the ip of the server under the domain name, before this everything worked without nginx
ᅠ ᅠ
port 8000
ᅠ ᅠ
domain/
Muflone
Ok, then stop nginx and check if the application still answers
ᅠ ᅠ
Muflone
Read the nginx logs
I'm 99% sure nginx has no permissions to read files into /root
ᅠ ᅠ
Muflone
Probably in /var/log
Muflone
You need to read the nginx messages, in particular permission errors
I have nothing to search
Muflone
The /root directory is for root user only
nginx most probably is running with a different user, not authorized to dive into /root
ᅠ ᅠ
ᅠ ᅠ
"location" directive is not allowed here in /etc/nginx/sites-enabled/django-app.conf:1
Muflone
ᅠ ᅠ
errors log
ᅠ ᅠ
No more bugs
Muflone
Then what fixed?
ᅠ ᅠ
Then what fixed?
I just worked according to the instructions of chatgpt, then deleted that file because it didn't work
ᅠ ᅠ
Now there are only 3 errors about visiting the site while nginx is not running
Muflone
I don't get.
What was that file? It was a previous error?
Muflone
Your paste had a different file name
Muflone
Then what you changed now to fix ?
ᅠ ᅠ
We have been sitting on this problem for too long. Maybe it will be easier if I do everything as it was before, and in order to put the domain there are other ways without nginx?
Muflone
Oh ok, you wrote no more bugs
Muflone
It's a permission error, move the files in /var/www
Muflone
And change location accordingly
ᅠ ᅠ
i need make collectstatic?
Muflone
You use collectstatic only once and then you move the files where nginx wants
ᅠ ᅠ
Because I repeat, static files are constantly added and I can't do a collectstatic all the time
Muflone
Muflone
static files don't change, at all, never, so you collect them only when you change them
Media root is used for files added/uploaded from the user
ᅠ ᅠ
Maybe all the same there are options for how to put a beautiful domain on the server without this tedious thing with nginx?
ᅠ ᅠ
Muflone
Static and media files will have to be served from nginx, separate them from the application and move them in a folders accessible from nginx
ᅠ ᅠ
Maxim
Muflone
Django and gunicorn are not valid web servers
ᅠ ᅠ
Maxim
Doragonsureiyā
Muflone
Lol
ᅠ ᅠ
ᅠ ᅠ
so why not?
Muflone
It's not safe, it's not reliable, it has no performances, it carries a lot of risks, plus I bet you're running it as root
Maxim
so why not?
two arguments: performance and security
Muflone
so why not?
https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/#debug
ᅠ ᅠ
Thanks for the unsuccessful help, I'll try to start over
Muflone
move the static files, nginx cannot read from /root
I told you thrice