refactoring ...
This commit is contained in:
parent
1fa80367a4
commit
579e15f8f7
|
@ -67,4 +67,9 @@ class components :
|
|||
return _data
|
||||
def csv(uri) :
|
||||
return pd.read(uri).to_html()
|
||||
def apply(**_args):
|
||||
"""
|
||||
:uri uri of the mapping function
|
||||
:args arguments of the function
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
class Project :
|
||||
@staticmethod
|
||||
def create (**_args) :
|
||||
_version = "0.0.1" if "version" not in _args else _args['version']
|
||||
_context = "" if 'context' not in _args else _args['context']
|
||||
_logo = "logo.png"
|
||||
_system = {"version":_version,"context":_context,"logo":_logo}
|
||||
_app = {"port":8084,"debug":True}
|
||||
pass
|
||||
|
14
index.py
14
index.py
|
@ -25,6 +25,8 @@ def favicon():
|
|||
@_app.route("/")
|
||||
def _index ():
|
||||
global _config
|
||||
_args = {}
|
||||
try:
|
||||
_args = {'system':_config['system']}
|
||||
_args['layout'] = _config['layout']
|
||||
# _args = dict(_args,**_config['layout'])
|
||||
|
@ -33,7 +35,12 @@ def _index ():
|
|||
_html = cms.components.html(uri,'index')
|
||||
e = Environment(loader=BaseLoader()).from_string(_html)
|
||||
_args['index'] = e.render(**_args)
|
||||
return render_template("index.html",**_args)
|
||||
_index_page = "index.html"
|
||||
except Exception as e:
|
||||
_index_page = "404.html"
|
||||
pass
|
||||
|
||||
return render_template(_index_page,**_args)
|
||||
|
||||
@_app.route('/id/<uid>')
|
||||
def people(uid):
|
||||
|
@ -43,7 +50,7 @@ def people(uid):
|
|||
global _config
|
||||
return "0",200
|
||||
|
||||
@_app.route('/cms/dialog')
|
||||
@_app.route('/dialog')
|
||||
def _dialog ():
|
||||
global _config
|
||||
_uri = os.sep.join([_config['layout']['root'],request.headers['uri']])
|
||||
|
@ -63,7 +70,7 @@ def _dialog ():
|
|||
|
||||
# _html = ( e.render(**_args))
|
||||
|
||||
@_app.route('/cms/page',methods=['POST'])
|
||||
@_app.route('/page',methods=['POST'])
|
||||
def cms_page():
|
||||
"""
|
||||
return the content of a folder formatted for a menu
|
||||
|
@ -103,6 +110,7 @@ if len(sys.argv) > 1:
|
|||
i += 2
|
||||
if __name__ == '__main__' :
|
||||
|
||||
|
||||
_path = SYS_ARGS['config'] if 'config' in SYS_ARGS else 'config.json'
|
||||
if os.path.exists(_path):
|
||||
_config = json.loads((open (_path)).read())
|
||||
|
|
Loading…
Reference in New Issue