I have a Python CLI program with SQL database models and want to add an interface with an MVC framework (like Django). What is the best way to link my program to the framework if I have already defined my models?
I also:
- Rewrite the model so that it shares with both Django and my program
- Write a layer that interacts between Django and my program.
- Remove the model from My Program and let Django handle it
Choice # 1: General Model
My Program
/ | \
Binaries Model Classes
|
Django
/ \
View Controller
Option # 2: creating a bridge library
My Program
/ | \
Binaries Model Classes
|
My-Bridge
|
Django
/ | \
View Model Controller
Choice # 3: using Django for most jobs and removing the model from my program
Classes
\
My Program
/ |
Binaries |
|
My-Bridge
|
Django
/ | \
View Model Controller
I avoid choosing No. 1 (creating a generic model) because I don't know how to create a generic model using Django ORM and SQLAlchemy.
№ 2 ( ), , Django . , Django , MVC.
№ 3 ( ), ORM SQLAlchemy, SQLAlchemy My-Program.
, , ? , CLI?