Skip to content
Snippets Groups Projects
Commit 359b3bf9 authored by Sebastian Lobinger's avatar Sebastian Lobinger
Browse files

update basic structure for exampleApp - correct some misstakes

no use of dict get method in create_hub to force exceptions on creation
process
parent ba2dd33a
Branches
Tags
1 merge request!10Resolve "Example App schreiben"
#from .sams_classes import SAMSHub
import yaml, os, glob
from sams_classes import SAMSHub, SAMSApp
from flask import Flask
def create_hub():
with open('ExampleApp/config/config.yaml', 'r') as f:
hubConf = yaml.load(f.read())
hub = SAMSHub(name='main', config=hubConf.get('ExampleApp',
{ 'default_language': 'en', 'main_app': 'Main'}))
hub = SAMSHub(name= __name__, config=hubConf['exampleApp'])
hub.flaskApp.config.update(hubConf.get('flask', {}))
for appName in hubConf.get('apps', []):
with open('ExampleApp/' + appName + '/manifest.yaml') as f:
for appName in hubConf['apps']:
with open(appName.replace('.', '/') + '/manifest.yaml') as f:
manifest = yaml.load(f.read())
langDict = {'en': {}}
for yaml_file in search_yaml_files('ExampleApp' + '/' + appName + '/lang/'):
for yaml_file in search_yaml_files(appName.replace('.', '/') + '/lang/'):
with open(yaml_file) as f:
singleLang = yaml.load(f.read)
singleLang = yaml.load(f.read())
langDict.update(
{os.path.splitext(os.path.basename(yaml_file))[0]: singleLang})
hub.addApp(SAMSApp(name = appName, manifest = manifest, langDict = langDict))
......
flask:
DEBUG: true
jinja2_strict_undefined: true
samsHUB:
exampleApp:
default_language: de
apps:
- ExampleApp.Main
- ExampleApp.Extra
main_app: ExampleApp.Main
\ No newline at end of file
main_app: 'ExampleApp.Main'
apps:
- 'ExampleApp.Main'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment