Skip to content

Instantly share code, notes, and snippets.

@Alir3z4
Created September 7, 2012 15:30
Show Gist options
  • Save Alir3z4/3667183 to your computer and use it in GitHub Desktop.
Save Alir3z4/3667183 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
base_path = sys.argv.pop()
sys.path.insert(0, base_path)
from fix_getpass import fixGetpass
import os
from django.core.management import execute_manager
# Fucking hack to set local env for django debug
# yeah
os.environ.setdefault("DJANGO_DEBUG", "true")
os.environ.setdefault("DJANGO_SECRET_KEY", "5a4swd1dx46wad4awd5aw*#$&@#@54asx")
try:
from runpy import run_module
except ImportError:
from runpy_compat import run_module
manage_file = os.getenv('PYCHARM_DJANGO_MANAGE_MODULE')
if not manage_file:
manage_file = 'manage'
if __name__ == "__main__":
fixGetpass()
run_module(manage_file, None, '__main__', True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment