Skip to content

Instantly share code, notes, and snippets.

@nicolasmendoza
Last active August 29, 2015 14:20
Show Gist options
  • Save nicolasmendoza/cc7c7f211214079f9f5b to your computer and use it in GitHub Desktop.
Save nicolasmendoza/cc7c7f211214079f9f5b to your computer and use it in GitHub Desktop.
Adding shell plus + pycharm
import sys
import logging
logging.basicConfig(format="%(levelname)-8s %(asctime)s %(name)s %(message)s", datefmt='%m/%d/%y %H:%M:%S', stream=sys.stdout )
log = logging.getLogger("root")
from django.db.models import get_models
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
logging.config.dictConfig(settings.LOGGING)
log.debug("Logging has been initialized at DEBUG")
log.setLevel( logging.DEBUG)
log.disabled = False
for _class in get_models():
if _class.__name__.startswith("Historical"): continue
log.debug("Registering model {}".format(_class.__name__))
globals()[_class.__name__] = _class
def debug_sql():
from debug_toolbar.management.commands import debugsqlshell
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment