steffen
steffen

Reputation: 8958

Why do I have to restart or reload the webserver when I make changes in django?

If I don't reload the webserver (apache) after making changes to source files in my django application, the browser displays erratic content, sometines errors.

Why is that? (Just out of interest)

And more importantly: can I switch it of during development?

Upvotes: 0

Views: 261

Answers (1)

wRAR
wRAR

Reputation: 25693

In most deployment scenarios there is a Python interpreter running in the web server or next to it, and it has your code loaded into memory. If the code is changed, the loaded parts are not reloaded automatically (but some updated parts may be loaded if they were not loaded previously, hence errors) and there is no clean way to fully reload all code without destroying all objects, so restarting the interpreter is the only way.

You can use the Django development server with the autorestart option, but that's still uses restarting.

Upvotes: 4

Related Questions