Last active
May 5, 2022 09:03
-
-
Save adamghill/3b5eeba503f0d00f9c5298ecc10c748b to your computer and use it in GitHub Desktop.
Watch .env file for changes in a Django app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.apps import AppConfig | |
from django.conf import settings | |
from django.utils.autoreload import autoreload_started | |
class Config(AppConfig): | |
name = "random_app_name" | |
def ready(self): | |
autoreload_started.connect(watch_env) | |
def watch_env(sender, **kwargs): | |
sender.watch_dir(settings.BASE_DIR, ".env") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment