Created
September 3, 2018 23:09
-
-
Save stnbu/26500cf8cbda0255e6b6ae5d6b06b261 to your computer and use it in GitHub Desktop.
Using the Django ORM outside of the web framework
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
# I was able to just put this module alongside `models.py` and use `myapp.db.FooTable(**kwargs).save()` etc outside | |
# of the web framework. With no issues, so far. | |
import django | |
from .settings import * | |
from django.conf import settings | |
settings.configure(DATABASES=DATABASES) | |
django.setup() | |
from .models import * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment