Skip to content

Instantly share code, notes, and snippets.

@alexhrescale
Created August 15, 2016 05:13
Show Gist options
  • Save alexhrescale/22861f1ea17c4601ece241881597c08b to your computer and use it in GitHub Desktop.
Save alexhrescale/22861f1ea17c4601ece241881597c08b to your computer and use it in GitHub Desktop.
how to set up your own script, bypassing the manage.py dance
from __future__ import unicode_literals
import os, sys, django
from theproject import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'theproject.settings')
django.setup()
# now import normally, e.g.
from django.core.management.base import BaseCommand
# ... whatever else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment