Implementaion of lightweight browser hot-reloading for Python ASGI web apps frameworks like FastAPI using arel
arel can be used to implement development-only hot-reload for non-Python files that are not read from disk on each request. This may include HTML templates, GraphQL schemas, cached rendered Markdown content, etc.
arel watches changes over a set of files. When a file changes, arel notifies the browser (using WebSocket), and an injected client script triggers a page reload. You can register your own reload hooks for any extra server-side operations, such as reloading cached content or re-initializing other server-side resources.
- Clone the repo
git clone https://github.com/ashleymavericks/browser-hot-reloading.git
- Install dependencies
pipenv install
or
pip install -r requirements.txt
- Set environment variable in your shell instance
export DEBUG=True
- Verify it using
echo $DEBUG
- Test this implementation, and further include it in your projects for a better development experience with Python ASGI web frameworks
This project is licensed under the MIT license