Skip to main content

Use watchfiles in Django’s autoreloader.

Project description

https://img.shields.io/github/actions/workflow/status/adamchainz/django-watchfiles/main.yml?branch=main&style=for-the-badge https://img.shields.io/badge/Coverage-100%25-success?style=for-the-badge https://img.shields.io/pypi/v/django-watchfiles.svg?style=for-the-badge https://img.shields.io/badge/code%20style-black-000000.svg?style=for-the-badge pre-commit

Use watchfiles in Django’s autoreloader.


Improve your Django and Git skills with my books.


Requirements

Python 3.8 to 3.12 supported.

Django 3.2 to 5.0 supported.

Installation

  1. Install with pip:

    python -m pip install django-watchfiles
  2. Add django-watchfiles to your INSTALLED_APPS:

    INSTALLED_APPS = [
        ...,
        "django_watchfiles",
        ...,
    ]

That’s it! 😅

Django doesn’t provide an official API for alternative autoreloader classes. Therefore, django-watchfiles monkey-patches django.utils.autoreload to make its own reloader the only available class. You can tell it is installed as runserver will list WatchfilesReloader as in use:

$ ./manage.py runserver
Watching for file changes with WatchfilesReloader
...

Unlike Django’s built-in WatchmanReloader, there is no need for a fallback to StatReloader, since watchfiles implements its own internal fallback to using stat.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-watchfiles-0.1.1.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

django_watchfiles-0.1.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page