Python LiveReload is a tool for web developers that automatically reloads webpages in the browser when file changes are detected. It provides a WSGI-compatible server and a command-line utility, focusing on simple, real-time feedback during development. The current version is 2.7.1, with a release cadence that includes bug fixes and minor enhancements.
pip install livereloadVerified import paths — ran on the pinned version, not inferred.
This quickstart creates a simple HTML file, then starts a LiveReload server that watches for changes to any `.html` files in the current directory. It will automatically open a browser tab to `http://localhost:5500` and reload it when files change.
Rewrite your watch rules using the Python API `server.watch()` within a Python script instead of a `Guardfile`.
Use the `delay` parameter in `server.watch(filepath, func=None, delay=None)` to debounce reloads, or specify more granular file patterns to watch.
Ensure that `livereload`'s server and your application's `IOLoop` (if any) are properly managed. Version 2.7.1 includes a fix for IOLoop stopping, but complex `Tornado` integrations may still require careful handling.
Create a Python script (e.g., `serve.py`) that imports `Server` and `shell` and defines your watch rules programmatically, then run it with `python serve.py`.
Configure your reverse proxy to correctly handle WebSocket connections and ensure that the `Host` and `X-Forwarded-Proto` headers are passed through, or specify `liveport` explicitly if needed.
Install the `livereload` package using pip: `pip install livereload`.
Downgrade the `Tornado` library to a version prior to 6.3.0 by specifying it in your requirements or installation command: `pip install 'tornado<6.3.0'`.
Ensure the LiveReload server is running (e.g., `livereload` from the command line or via a Python script calling `server.serve()`). Check that no other application is using the default LiveReload port (35729 or 5500 for `server.serve()`) and that your firewall isn't blocking the connection. If using a custom host/port, ensure consistency between server and client configuration. For Django, ensure `django-livereload-server` is configured correctly.
To force the browser to fetch fresh assets, append a dynamic version query parameter to your static file URLs (e.g., `?version={{ time() }}` in Flask templates) or disable browser caching during development in your browser's developer tools.Ensure `django-livereload-server` is installed (`pip install django-livereload-server`) and `livereload` is added to your `INSTALLED_APPS` in `settings.py` before `django.contrib.staticfiles`.