|
@@ -3,6 +3,7 @@
|
3
|
3
|
from loader import *
|
4
|
4
|
import warnings
|
5
|
5
|
|
|
6
|
+
|
6
|
7
|
def refreshdyn():
|
7
|
8
|
import sys
|
8
|
9
|
from EditorialModel.model import Model
|
|
@@ -18,6 +19,7 @@ def refreshdyn():
|
18
|
19
|
# Create the python file
|
19
|
20
|
fact.create_pyfile(em, LeDataSourceSQL, {})
|
20
|
21
|
|
|
22
|
+
|
21
|
23
|
def db_init():
|
22
|
24
|
from EditorialModel.backend.json_backend import EmBackendJson
|
23
|
25
|
from EditorialModel.model import Model
|
|
@@ -25,6 +27,7 @@ def db_init():
|
25
|
27
|
em = Model(EmBackendJson(Settings.em_file))
|
26
|
28
|
em.migrate_handler(mh)
|
27
|
29
|
|
|
30
|
+
|
28
|
31
|
def em_graph(output_file = None, image_format = None):
|
29
|
32
|
from EditorialModel.model import Model
|
30
|
33
|
from EditorialModel.backend.json_backend import EmBackendJson
|
|
@@ -63,3 +66,23 @@ def em_graph(output_file = None, image_format = None):
|
63
|
66
|
os.unlink(dot_file)
|
64
|
67
|
print("Output image written in file : '%s'" % output_file)
|
65
|
68
|
|
|
69
|
+
|
|
70
|
+def dir_init():
|
|
71
|
+ import os
|
|
72
|
+
|
|
73
|
+ # Templates
|
|
74
|
+ print("Creating Base Templates ...")
|
|
75
|
+ templates = {
|
|
76
|
+ 'base': {'file': 'base.html', 'content': '{% extends "templates/base.html" %}'},
|
|
77
|
+ 'base_backend': {'file': 'base_backend.html', 'content': '{% extends "templates/base_backend.html" %}'}
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ current_directory = os.path.dirname(os.path.abspath(__file__))
|
|
81
|
+ templates_directory = os.path.join(current_directory,'templates')
|
|
82
|
+ os.makedirs(templates_directory)
|
|
83
|
+
|
|
84
|
+ for template in templates:
|
|
85
|
+ my_file_path = os.path.join(templates_directory, template['file'])
|
|
86
|
+ with open(my_file_path) as my_file:
|
|
87
|
+ my_file.write(template['content'])
|
|
88
|
+ print("Created %s" % my_file_path)
|