|
@@ -12,3 +12,25 @@ Copy settings.py.example to settings.py, change the conf to your local settings
|
12
|
12
|
mysql
|
13
|
13
|
> CREATE DATABASE `lodel2` CHARACTER SET utf8 COLLATE utf8_general_ci;
|
14
|
14
|
> GRANT ALL ON `lodel2`.* TO "lodel"@"localhost";
|
|
15
|
+
|
|
16
|
+** Generate the code for LeObject API
|
|
17
|
+
|
|
18
|
+```python
|
|
19
|
+# -*- coding: utf-8 -*-
|
|
20
|
+
|
|
21
|
+from EditorialModel.model import Model
|
|
22
|
+from leobject.lefactory import LeFactory
|
|
23
|
+from EditorialModel.backend.json_backend import EmBackendJson
|
|
24
|
+from leobject.datasources.ledatasourcesql import LeDataSourceSQL
|
|
25
|
+
|
|
26
|
+OUTPUT = 'leobject/dyn.py'
|
|
27
|
+
|
|
28
|
+em = Model(EmBackendJson('EditorialModel/test/me.json'))
|
|
29
|
+
|
|
30
|
+pycode = LeFactory.generate_python(EmBackendJson, {'json_file':'EditorialModel/test/me.json'}, LeDataSourceSQL, {})
|
|
31
|
+
|
|
32
|
+print(pycode)
|
|
33
|
+
|
|
34
|
+with open(OUTPUT, 'w+') as fp:
|
|
35
|
+ fp.write(pycode)
|
|
36
|
+```
|