|
преди 9 години | |
---|---|---|
DataSource | преди 9 години | |
EditorialModel | преди 9 години | |
Lodel | преди 9 години | |
install | преди 9 години | |
leapi | преди 9 години | |
.gitignore | преди 9 години | |
Doxyfile | преди 9 години | |
Makefile | преди 9 години | |
README.md | преди 9 години | |
lint | преди 9 години | |
lodel_init.sh | преди 9 години | |
makemigrations_interactive_rename.patch | преди 9 години | |
refreshdyn.py | преди 9 години | |
requirements.txt | преди 9 години | |
runtest | преди 9 години | |
settings_local.py.example | преди 9 години |
Creating a Lodel “instance”:
use the lodel_init.sh script :
lodel_init.sh INSTANCE_NAME INSTANCE_WANTED_PATH [LODEL2_LIB_PATH]
When you have set the new instance settings ( by editing settings.py in instance directory ) you should be able to create the database structure + dynamic code by running make (without arguments) in the instance directory .
Once the instance is created you can run an interactive python interpreter using :
cd INSTANCE_PATH; python loader.py
If you want to write a script that run is the instance env you have to from loader import *
First test installation :
** install dependencies pip install -r requirements.txt
** Doxygen generation Dependencies : doxygen graphviz doxypy Generation : run doxygen in the root folder (where the Doxyfile is)
** create local config in settings.py Copy settings.py.example to settings.py, change the conf to your local settings
** create DATABASES mysql
CREATE DATABASE
lodel2
CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL ONlodel2
.* TO “lodel”@“localhost”;
** Generate the code for LeObject API
use refreshdyn.py or :
# -*- coding: utf-8 -*-
from EditorialModel.model import Model
from leobject.lefactory import LeFactory
from EditorialModel.backend.json_backend import EmBackendJson
from leobject.datasources.ledatasourcesql import LeDataSourceSQL
OUTPUT = 'leobject/dyn.py'
em = Model(EmBackendJson('EditorialModel/test/me.json'))
pycode = LeFactory.generate_python(EmBackendJson, {'json_file':'EditorialModel/test/me.json'}, LeDataSourceSQL, {})
print(pycode)
with open(OUTPUT, 'w+') as fp:
fp.write(pycode)
** Tools
A Makefile is written with common operations :