Skip to content

Instantly share code, notes, and snippets.

@adamghill
Last active May 5, 2022 09:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamghill/3b5eeba503f0d00f9c5298ecc10c748b to your computer and use it in GitHub Desktop.
Save adamghill/3b5eeba503f0d00f9c5298ecc10c748b to your computer and use it in GitHub Desktop.
Watch .env file for changes in a Django app
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