-
-
Save erickgnavar/6544351 to your computer and use it in GitHub Desktop.
This file contains 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
#! /usr/bin/env python | |
#coding:utf-8 | |
import sys | |
import os | |
from random import randint, random | |
sys.path.insert(0, os.path.expanduser('PATH_OF_YOUR_DJANGO_PROJECT')) | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings.py' | |
from django.contrib.contenttypes.models import ContentType | |
from django.contrib.auth.models import User | |
from django.db.models.loading import get_models | |
for m in get_models(): | |
exec "from %s import %s" % (m.__module__, m.__name__) | |
# custom models | |
from apps.rp.models.User import CustomUser | |
# printing the queries | |
import logging | |
l = logging.getLogger('django.db.backends') | |
l.setLevel(logging.DEBUG) | |
l.addHandler(logging.StreamHandler()) | |
# sublime virtual env config | |
{ | |
"cmd": ["python", "-u", "$file"], | |
"env": {"PYTHONPATH": "/home/chris/venvs/venv-rp/lib/python2.7/site-packages"}, | |
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)", | |
"selector": "source.python" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment