django server ignores POST requests - python

This is really strange behaviour. When I issue POST request to many times django suddenly starts to ignore them all. I can see then in firebug but debug server shows nothing. Restarting server doesn't help. Even more, when I try to restart server when this happens I always get:
Error: That port is already in use.
Restarting the whole machine helps.
I thought it may be related to
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
error I'm having but event after applying workaround:
import threading
threading._DummyThread._Thread__stop = lambda x: 42
described on Understand python threading bug
I'm still having the same problem.
I don't know ho to diagnose the source of the issue.
Maybe this will be helpful:
OS: ubuntu 12.04 LTS
Processor: Intel® Core™ i7-2720QM CPU # 2.20GHz × 4
Python 2.7.3
Django 1.4.1
Any help would be appreciated.

As a work around, you could use the --nothreading option to disable the use of threading in the dev server.
./manage.py runserver --nothreading

Related

My code raises "httpx.connecttimeout: timed out" exception

Today I was prepairing my project to start on Debian11 VPS server. I'm near level to Junior Python Developer and I don't have any ideas what to do with that. Actually, you could say that I'm just stupid, but my code is working on my Windows Laptop. And exception raises only on Debian server. Thanks for your help!
linux error statement
I tried to change active proxy in my code, but it's still doesn't work on debian and still works on Win
-_-

OSX proxy settings are completely ignored

I am trying to set up my own proxy server in python (the code, running on port 9090) but when I change the configuration on my mac it seems like those configuration are completely ignored
The configurations:
(I of curse hit save and apply)
I also checked and my VPN is not connected...
The really odd thing is that I can even change the Web Proxy Server ip to be invalid things and still hit save and apply:
And of curse these configurations are also ignored
No help from apple forums either
Turns out this is a bug in some OSX versions. Apple fixed this bug in Mojave v10.14.6 so updating to this version fixes the problem.

I am getting this error The DNS operation timed out after 20.000144004821777 seconds when running my app in cygwin instead of my windows terminal

so I am trying to do some background job to run in my flask app , and in order to run the worker, I needed to use cygwin instead of my windows terminal. My application use MongoDb Atlas for documents storage and it works perfectly fine when I "flask run" it from my cmd . But I got the error once I run it or run the worker from cygwin. It is to note that I whitelisted my IP adress and installed the dnspython package , and still got the error.
Any suggestions about what could be the problem? I don't seem to find any answer in previous asked questions . Thank you.
It's because of your dynamic DNS configuration from your ISP. make it static or you can use googleDNS server which is 8.8.8.8 or 8.8.4.4 as your DNS servers.
I hit and resolved this same issue hit today w/ cygwin, python3.8, dnspython 1.16.0 by updating to dnspython 2.0.0 and ensuring there was a valid /etc/resolv.conf in place.

Django: ERR_CONNECTION_REFUSED

I'm actually learning to use the Django framework with PostgreSQL with Docker and docker-compose.
Regularly, when I make a mistake (for example a syntax error in the views.py file), I cannot reach my Django app anymore trough my web browser.
Firefox tells me:
Unable to connect
Firefox can't establish a connection to the server at localhost:8000
Chrome tells me:
This site can’t be reached
localhost refused to connect.
ERR_CONNECTION_REFUSED
I had this several times and I always managed to find the error in my code, to correct it and then everything went well again.
Currently, my code is working fine. But if I encounter this again (and this happens very often), I would like to be able to find the error quickly by myself.
So here is my question:
How can I see which file at which line contains the error ?
I would like to have a correct error message telling me what went wrong instead of that annoying ERR_CONNECTION_REFUSED browser page over and over.
I hope I explained my issue well because I struggled to describe it to Google.
Thanks a lot in advance. :)
FYI:
Ubuntu 18.04.3 LTS Bionic (window manager i3wm)
Docker 19.03.4
docker-compose 1.17.1
python 3.7 (docker image)
Django 2.2.6 (inside the python 3.7 image)
PostgreSQL 12.0 (docker image)
Visual Studio Code 1.39.2
I finally found a solution.
I had the bad habit to run my docker-compose in detached mode.
When attached, the syntax errors are shown directly from the terminal when de container is stopped.
I also added a script where I run my server in a loop. This way, the server will relaunch automatically over and over until I correct the error. I don't have to restart my Django server manually.
Thank you for helping me anyway.

Apache 2.4, Python and Django on Windows

I am using Windows 8.1. and trying to configure XAMPP (apache 2.4, VC11) to work with Python (I have 2.7) and Django (1.7). Have downloaded mod_wsgi (VC9), changed httpd.conf but still getting Apache shut down: Any clues?
Error: Apache shutdown unexpectedly. 06:24:31 [Apache] This may be
due to a blocked port, missing dependencies, 06:24:31 [Apache]
improper privileges, a crash, or a shutdown by another method.
06:24:31 [Apache] Press the Logs button to view error logs and check
06:24:31 [Apache] the Windows Event Viewer for more clues 06:24:31
[Apache] If you need more help, copy and post this 06:24:31 [Apache]
entire log window on the forums
Since you are using python 2.7, Your Apache must be compiled with VC9, You can download the required Apache from - (https://www.apachehaus.com/cgi-bin/download.plx#APACHE24VC09). Make sure you download the 32 bit version if you are running a 32 bit python installation or the 64 bit version if your python installation is 64 bit.

Categories

Resources