Search code examples
djangopythonanywhere

Enable Automatic Reload in Django on PythonAnywhere


I've been wondering if I can enable Auto Reload on a PythonAnywhere-based Django web-server. Right now, when I make any changes to my models or views, I have to reload the complete web-app for changes to be visible.

I would like my changes to be seen immediately. I have no clue if I can disable the --noreload flag that is probably set, or that I can modify it somewhere, but it would be really convenient. (Sometimes, I forget clicking 'Reload Web Server', and I bang my head wondering where the problem is)

Many thanks,

Mats


Solution

  • Because PythonAnywhere does not use the django test server this can not be done simply.

    The file /var/www/wsgi.py is currently set to reload the web server on any modification. Having that file open in a browser tab and hitting save on it would result in a slightly faster server reload.

    Another option is to use a bookmarklet, which you could add to your bookmarks toolbar:

    https://www.pythonanywhere.com/help/#id_reload_webapp_bookmarklet