3 ms·
> Does this still mean you have to restart your local web application after any change you made to it? I heard that some developers automate that, so that every
by acdha 3y ago
> Does this still mean you have to restart your local web application after any change you made to it? I heard that some developers automate that, so that everytime they save a file, the web application is restarted. That seems pretty expensive in terms of resource consumption.
All of the popular frameworks automatically reload. It’s not instantaneous but with e.g. Django it was less than the time I needed to switch windows a decade ago and it hadn’t gotten worse. If you’re used to things like NextJS it will likely be noticeably faster.
- qwertox 3y agoWith `reload(module)` you don't even have to restart the server if you structure it properly. Think server.py and server_handlers.py, where server.py contains logic to detect a modification of server_handlers.py (like via inotify) and the base handlers which then call the "modifiable" handlers in server_handlers.py. This is not limited to servers (anything that loops or reacts to events) and can be nested multiple levels deep and is among the top 3 reasons of why i use Python. Reloading is instantaneous and can gracefully handle errors in the file (just print an err messge or stack trace and keep running the old code)