Permalink
Browse files

`coincharts.db` ... access the entire ORM from outside of web framework.

  • Loading branch information...
stnbu committed Sep 2, 2018
1 parent a303a99 commit 026261fb6152ec9a43a934423ffbf99179e836d4
Showing with 24 additions and 0 deletions.
  1. +21 −0 coincharts/db.py
  2. +3 −0 coincharts/models.py
@@ -0,0 +1,21 @@
# -*- mode: python; coding: utf-8 -*-
"""Using Trix(tm), re-export `modules.*` and make models (and ORM) usable outside of web framework.
So, if you have django "app" `foo` installed as a package, from anywhere you should be able to
>>> record = foo.db.SomeTable(**kwargs)
>>> record.save()
et cetera.
"""
import os
import django
from .settings import *
from django.conf import settings
settings.configure(DATABASES=DATABASES)
django.setup()
from .models import *
@@ -22,3 +22,6 @@ def __str__(self):
getattr(self, TIME),
getattr(self, PRICE)
)
class Meta:
app_label = 'coincharts'

0 comments on commit 026261f

Please sign in to comment.