python - Share model code files between client and server -
i'm developing 2 python flask apps: 1 api server, tied database through flask-sqlalchemy, , other 1 databaseless web frontend, between user , api server.
i'd reuse model code, example, if define "house" object in apiserver, reuse same code define same object in frontend server.
what i'm trying accomplish is, let's add together property "number of windows" "house" object, 1 time , have alter in database model, json code interchanged between apiserver , webfrontend , output of webfrontend.
some possible approachs come mind are:
somewhat automatically derive sqlalchemy database model initial shared model. use as-it-is sqlalchemy model in nondatabase code, can utilize objects if there no database behind.has tried of approachs ? ideas ?
python python-2.7 sqlalchemy flask-sqlalchemy
No comments:
Post a Comment