I tried beget and digital ocean, different Django-projects (my own and examples) and every time i try to send request to server from my PC am getting
[05/Oct/2021 12:26:24,844] - Broken pipe from ('94.72.62.225', 53959)
I do same things every time:
python3 -m venv env
. env/bin/activate
pip install -r requirements.txt
python3 manage.py makemigrations
python3 manage.py migrate
set ALLOWED_HOSTS=['*'] in settings.py ( ALLOWED_HOSTS=['server_id'] also checked )
python3 manage.py rusnerver 0.0.0.0:8000
tools to send requests - google chrome, postman, curl
CodePudding user response:
Found the problem. This issue only exists in devserver. The issue won't exist when you set DEBUG=FALSE
. You are running a development server in production, don't do that. Here is a community tutorial which will guide you to set up Django with Postgres and Nginx: here in Production.
This issue was discussed and here's the ticket: django ticket.
In that ticket's comments, there is a quite clear explanation:
According to many sources the 'Broken Pipe' is a normal browser quirk. For example, the browser reads from the socket and then decides that the image it's been reading apparently didn't change. The browser now this (forcefully) closes the connection because it does not need more data. The other end of this socket (the python runserver) now raises a socket exception telling the program that the client 'Broke the socket pipe'.