How do you debug unresponsive Django?

I am learning how to deploy a Django site using git. I have a development, staging and production environment. They are all on my laptop.

OS and Servers: Ubuntu 14.04, gunicorn, nginx.

Dev env is located in / webapps / mysite -dev /. The env view is located at / webapps / mysite -staging /. The env production is located in / webapps / mysite -production /. I also have 3 separate users and the directories above are the home directories for those users.

In env development my site is working absolutely fine. With both Django development server and cannon.

From development environment: git push staging staging

Capturing after receiving makes the migration changes the environmental information in the files.

Then I started the development server python manage.py runserver

It starts to work. No mistakes.

Then I try to download http://127.0.0.1:8000 but my site's homepage is not loading and loading is infinite.

top

shows that the python process is consuming between 50% and 80% of the CPU.

python process takes around 50% of CPU

I stop the server with Ctrl+C, but the python process is not running, so I have to kill it. The same happens when using a cannon.

It looks like an endless loop, but I have no idea where the error is.

I tried to put pdb.set_trace()

and simple return HttpResponse("Hello world")

in the first line of my home page view. Nothing. It seems like the control over the program just doesn't open at all.

My question is: How do you debug Django when there are no error messages in either the terminal or the browser?

+3


source to share


1 answer


It looks like the development server is not starting from your browser. Maybe try to bind your django development server to a specific port python manage.py runserver 0.0.0.0:8000

and try to access your site from http://127.0.0.1:8000



0


source







All Articles