开发者

When and why to use Django development server?

I understand that it's simple and doesn't require any installation whatsoever, but are there any other reasons to use it for long-term development instead of Apache with mod_wsgi? As a Django newbie, I just find deployment from development to live (Apache) environment quite cumbersome and annoying, so the question that comes into my mind is: Isn't it simpler to just use mod_wsgi on localhost too? Only mention开发者_开发百科 about this in Django manual I found was:

We've included this with Django so you can develop things rapidly, without having to deal with configuring a production server -- such as Apache -- until you're ready for production.


You sometimes need the production setup locally when you're developing. I've needed it when I was messing with some subdomain related code that tied into the application and needed to mimic my real server locally.

However, for most things, the dev server is a big win. Here are a few points.

  1. Like rebus mentioned, the auto restart.
  2. Tracebacks on the console and useful debugging information.
  3. You can stick pdb.set_trace() into parts of your code and get a debugger prompt while a view method is executing if you want to look at stuff.
  4. The entire stack runs as a single user (you) which you have complete control over.
  5. One command to start and run.

These come with a price which is reduced performance and inability to handle real life traffic. That's why you need a real web server to run it in production.


When I create a simple Django app for local users to populate data into a DB i usually leave it running with the development server. I've never had any problems... If it's in a local server and not exposed to the internet it should be ok to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜