tags:

views:

71

answers:

3

I am running django simple server via manage.py runserver. With a client code I create a list of resources (approx 50 I would estimate). Occasionally (apparently random) the server restarts itself for no apparent reason, like when a .py file has been modified, and the client code dies (but this is another story). The operations happen on the MySQL backend, so no .py file is modified during the creation of resources, therefore I cannot really explain the reason behind the restart.

Does anybody has a clue, or can give me hints to find the reason behind this annoying behavior ?

A: 

You are running Django's development server, which is not a for-production stable server, it is just for development. This is from the docs:

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that's how it's gonna stay. We're in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.) The development server automatically reloads Python code for each request, as needed. You don't need to restart the server for code changes to take effect.

Look at here.

shanyu
Yup, that I know. but I am still in the development phase. I wouldn't say I am stressing it to production levels...
Stefano Borini
Then it should be OK to you that it restarts itself when you modify the code. Isn't this a totally expected behavior?
shanyu
No. I am not modifying any source files while I am running the client!
Stefano Borini
-1, his question has nothing to do with production and you don't answer the question.
Matt Baker
Right, I apparently misunderstood the question.
shanyu
+2  A: 

The only reason I can come up with is that you or someone else has a text editor up which autosaves to one of the files. Have you double checked that no file time stamps have been updated before the server restarts?

If you could include a dump of what the restart message is, perhaps that could aid in debugging it.

lemonad
I'm in agreement, seems like something is triggering the auto-reload
Matt Baker
+2  A: 

Use this to run the dev server:

manage.py runserver --noreload
Gabriel Ross
It actually works. Thanks. Still I am not modifying anything. Does not matter. It matter that it works ;)
Stefano Borini