سؤال

I'm currently working on a django application. I can't add an element to my database on the admin view. I fill all the information but when I click on save button but the operation doesn't finish and I get a timeout. I use sqlite3 as database.

My question is there any one that know the origin of this problem. If not how could I investigate the problem. When I worked with other language (Java, C ...etc) when I have a problem I can use a debugger. What are the options I have?

هل كانت مفيدة؟

المحلول

This Problem can occur because of following reasons:

  1. (Less Probable) You computation code is too Slow: Which is a rarity because the Timeout is set to about 1 minute or so, and code doesn't take that time to Execute

  2. Your app is waiting on some external resource but it is not Responding. For this you will have to check for the Django logs and check if some external resource error is there

  3. (Most Probable) Database taking too much time: This can occur either because:

    • App can't connect to Database: For this you have to check database logs OR try and connect manually with database through python manage.py dbshell
    • DB Query Taking so much time to execute: You can test this by checking database logs for how much time a query is taking OR you can connect manually via dbshell and make the same query there

Your can also use tools Like django-profiler , Django debug toolbar etc for debugging purposes. and for native python code python debugger

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top