|
|
|
|
@ -36,6 +36,18 @@ from cms.engine import themes
|
|
|
|
|
# _info['layout']['footer'] = [{'text':'Powered by QCMS'}]
|
|
|
|
|
|
|
|
|
|
# return _info
|
|
|
|
|
_code = """
|
|
|
|
|
import cms
|
|
|
|
|
#
|
|
|
|
|
# register this in config.plugins: {"demo":["info"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cms.Plugin(mimetype='application/json',methods=['POST','GET'])
|
|
|
|
|
def info (**_args):
|
|
|
|
|
_request= _args['request']
|
|
|
|
|
_config = _args['config']
|
|
|
|
|
return {"version":_config['system']['version'],'title':_config['layout']['header']['title']}"""
|
|
|
|
|
|
|
|
|
|
def make_folder (projectFolder, webroot):
|
|
|
|
|
"""
|
|
|
|
|
This function creates project folders, inside the project folder is the web root folder
|
|
|
|
|
@ -54,18 +66,7 @@ def _icode(_path,_root):
|
|
|
|
|
This function will generate some default plugins to show the users how plugins work and can be used/written
|
|
|
|
|
:path location of the project
|
|
|
|
|
"""
|
|
|
|
|
_code = """
|
|
|
|
|
import cms
|
|
|
|
|
#
|
|
|
|
|
# register this in config.plugins: {"demo":["info"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cms.Plugin(mimetype='application/json',methods=['POST','GET'])
|
|
|
|
|
def info (**_args):
|
|
|
|
|
_request= _args['request']
|
|
|
|
|
_config = _args['config']
|
|
|
|
|
return {"version":_config['system']['version'],'title':_config['layout']['header']['title']}
|
|
|
|
|
"""
|
|
|
|
|
global _code
|
|
|
|
|
loc = os.sep.join([_path,_root,'_plugins','demo.py'])
|
|
|
|
|
f = open(loc,'w')
|
|
|
|
|
f.write(_code)
|
|
|
|
|
@ -89,11 +90,12 @@ def _ilogo (_path):
|
|
|
|
|
f.close()
|
|
|
|
|
_index += 1
|
|
|
|
|
|
|
|
|
|
def _index (_path,root):
|
|
|
|
|
def _index (_path,root,_config):
|
|
|
|
|
"""
|
|
|
|
|
Creating a default index.html for the site given the project root location
|
|
|
|
|
"""
|
|
|
|
|
import cms
|
|
|
|
|
_system = _config['system']
|
|
|
|
|
_html = f"""
|
|
|
|
|
<div align="center">
|
|
|
|
|
<div class="large-text">Thank you for considering QCMS</div>
|
|
|
|
|
@ -119,7 +121,7 @@ def _index (_path,root):
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div class="border border-round">
|
|
|
|
|
<b>QCMS</b> has built-in support for industry standard frameworks
|
|
|
|
|
<b>QCMS</b> has built-in support for industry standard frameworks, and open resources
|
|
|
|
|
<div style="float:right; width:250px;">
|
|
|
|
|
<i class="fa-solid fa-cog fa-spin" style="font-size:125px; color:#ff6500"></i>
|
|
|
|
|
<i class="fa-solid fa-cog fa-spin fa-2x" style="margin-top:-20px; margin-left:-20px; font-size:100px; color:#4682B4"></i>
|
|
|
|
|
@ -128,6 +130,7 @@ def _index (_path,root):
|
|
|
|
|
<i class="fa-solid fa-minus"></i> fontawesome
|
|
|
|
|
<br><i class="fa-solid fa-minus"></i> jQuery
|
|
|
|
|
<br><i class="fa-solid fa-minus"></i> Apexcharts
|
|
|
|
|
<br><i class="fa-solid fa-minus"></i> iconfinder
|
|
|
|
|
</ul>
|
|
|
|
|
<ul>
|
|
|
|
|
As a python/flask enabled framework, there can also be support for the wide range of libraries for various AI/ML projects
|
|
|
|
|
@ -136,8 +139,32 @@ def _index (_path,root):
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>
|
|
|
|
|
<div>
|
|
|
|
|
Add custom python functions and provide access as <b>api</b>
|
|
|
|
|
<div style="display:grid; grid-template-columns: auto 50%; gap:20px; width:80%; margin-left:10%;">
|
|
|
|
|
<div class="border-round border">
|
|
|
|
|
Add custom python functions and provide access as <b>api</b>
|
|
|
|
|
<p>
|
|
|
|
|
<b><i class="fa-solid fa-code"></i> Available API</b>
|
|
|
|
|
<div>
|
|
|
|
|
These functions are made available in the manifest
|
|
|
|
|
</div>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><a href="http://localhost:{_system['app']['port']}/api/system/debug">http://localhost:{_system['app']['port']}/api/system/debug</a></li>
|
|
|
|
|
<li><a href="http://localhost:{_system['app']['port']}/api/demo/info">http://localhost:{_system['app']['port']}/api/demo/info</a></li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<i class="fa-solid fa-terminal"></i> In a terminal window, list the apis online/offline
|
|
|
|
|
<div class="source-code">
|
|
|
|
|
$ qcms api status < project-folder >
|
|
|
|
|
</div>
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="border-round border">
|
|
|
|
|
Custom API are simple python functions, that are loaded in the <b>_plugins</b> folder
|
|
|
|
|
<pre class="source-code" style="font-size:10px">
|
|
|
|
|
{_code}
|
|
|
|
|
</pre>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<div align="center">Learn more about <b>QCMS</b> and at {themes.URL}</div>
|
|
|
|
|
</p>
|
|
|
|
|
@ -167,7 +194,7 @@ def make (**_args) :
|
|
|
|
|
This function create a project folder and within the folder are all the elements needed
|
|
|
|
|
"""
|
|
|
|
|
_config = _args['config']
|
|
|
|
|
_config['plugins'] = {}
|
|
|
|
|
_config['plugins'] = {"demo":["info"]}
|
|
|
|
|
_folder = _args['folder']
|
|
|
|
|
_root = _config['layout']['root'] #-- web root folder
|
|
|
|
|
make_folder(_folder,_root) #-- creating the project folder structure
|
|
|
|
|
@ -176,7 +203,7 @@ def make (**_args) :
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
_ilogo(os.sep.join([_folder,_root])) #-- adding logo
|
|
|
|
|
_index(os.sep.join([_folder,_root]),_root)
|
|
|
|
|
_index(os.sep.join([_folder,_root]),_root,_config)
|
|
|
|
|
_itheme(_folder,_root) #-- adding theme folder
|
|
|
|
|
_icode(_folder,_root) #-- adding the plugins sample code
|
|
|
|
|
|
|
|
|
|
|