Why is Django so Slow to Refresh Compared to a PHP Site?
This is a nagging issue that I've had with Django.
Compared to a typical PHP site, it takes forever to refresh and see any changes I've made. During development I have Apache set to MaxRequestsPerChild 1
- this is fairly slow but is necessary because you end up viewing 'stale' code witho开发者_JAVA百科ut it. Running the development server is far worse as it restarts and churns away after a one-liner change.
With PHP, changes are instantaneous.
Is there any way to accelerate this on the Django side?
For development, it's rarely useful to be running Django behind a "real" web server like Apache. I understand the frustration with the auto-reloading dev server, but you can always give the --noreload
option if you want to control the restarting yourself. I leave it on because I forget to restart, and the time that it saves me is usually worth a couple frustrating moments while editing.
However, I've never found the development server being the hinderance. Use SQLite while developing. Setting up a "real" database is usually not necessary when coding and testing. And templates will always refresh instantaneously.
精彩评论