Python LiveReload

2.7.1 · active · verified Sun Apr 12

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.

Warnings

Install

Imports

Quickstart

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.

import os
from livereload import Server, shell

# Create a dummy index.html for demonstration
with open('index.html', 'w') as f:
    f.write('<!DOCTYPE html>\n<html><head><title>LiveReload Test</title></head><body><h1>Hello, LiveReload!</h1></body></html>')

server = Server()
server.watch('*.html')
server.serve(open_url_delay=1)

view raw JSON →