Skip to content

Instantly share code, notes, and snippets.

@mdiener21
Created April 21, 2017 11:14
Show Gist options
  • Save mdiener21/8092c2abf633c5c9d021a9184308945d to your computer and use it in GitHub Desktop.
Save mdiener21/8092c2abf633c5c9d021a9184308945d to your computer and use it in GitHub Desktop.
Run Django as a script
# add this to top of script with the correct path to your app
import sys, os
sys.path.append('/path/to/your/django/app')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.conf import settings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment