Created
September 25, 2020 17:50
-
-
Save jjorissen52/f41a0df9d1f6ac11443faa70e14234a7 to your computer and use it in GitHub Desktop.
Import Django in Script or Jupyter Notebook
This file contains hidden or 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
import os | |
import dotenv | |
dotenv.read_dotenv(override=True) | |
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "my_project.settings") | |
# django.setup() is called as a side-effect | |
from django.core.wsgi import get_wsgi_application | |
_ = get_wsgi_application() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment