Skip to content

Instantly share code, notes, and snippets.

@mdiener21
Created December 19, 2014 11:42
Show Gist options
  • Save mdiener21/8ee3dca644967b745707 to your computer and use it in GitHub Desktop.
Save mdiener21/8ee3dca644967b745707 to your computer and use it in GitHub Desktop.
run django api in one python file without starting server
import os
import django
from myapp import models
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
django.setup()
print models.MyModel.objects.get(pk=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment