Use watchfiles in Django’s autoreloader.
Requirements
Python 3.7 to 3.10 supported.
Django 2.2 to 4.0 supported.
Installation
Install with pip:
python -m pip install django-watchfilesAdd 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.
Metadata
Release files for makavafal-django-watchfiles 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| makavafal-django-watchfiles-0.0.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| makavafal_django_watchfiles-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.4 kB
Release files / makavafal-django-watchfiles-0.0.1.tar.gz
| Download URL | makavafal-django-watchfiles-0.0.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00d197ed04543bf2270f9ff8b50c433e03fe30d6282b81f14eeab27e1a1b5728
|
|
BLAKE2b-256 checksum How to use checksums |
6b848ab47ffd8c4bd0afe70745c5a2cb35f11bf1d776f417d7444e11f7b0e177
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|
Release files / makavafal_django_watchfiles-0.0.1-py3-none-any.whl
| Download URL | makavafal_django_watchfiles-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3b399397faf2f50a7be986180d985a9b8e8395053f9d7297b8f77bd00c27a53
|
|
BLAKE2b-256 checksum How to use checksums |
970cf88e942424d7a98eb594dbf11e28fbb7d31633888d9e3b38df7925e19d8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.0
|