From 3825493976b08d1c9be2ee7c0b2d2056c5d7cc69 Mon Sep 17 00:00:00 2001 From: Sebastian Lobinger <sebastian.lobinger@fu-berlin.de> Date: Wed, 31 May 2017 09:14:15 +0200 Subject: [PATCH] created example_App.py add ExampleApp module --- .../ExampleApp => ExampleApp}/Wrappers.py | 0 ExampleApp/__init__.py | 22 +++++++++++++++++++ .../config/config.yaml | 0 .../config/modules.yaml | 0 .../ExampleApp => ExampleApp}/exceptions.py | 0 .../languages/de.yaml | 0 .../ExampleApp => ExampleApp}/manifest.yaml | 0 .../modules/.gitkeep | 0 .../modules/hallo_module/__init__.py | 0 .../modules/hallo_module/languages/de.yaml | 0 .../modules/hallo_module/languages/en.yaml | 0 .../modules/hallo_module/manifest.yaml | 0 .../hallo_module/templates/hallo_module.html | 0 .../hallo_module/templates/subview.html | 0 .../modules/hallo_module/urls.py | 0 .../modules/hallo_module/views.py | 0 .../ExampleApp => ExampleApp}/static/.gitkeep | 0 .../static/style.css | 0 .../templates/.gitkeep | 0 .../templates/base-struct.html | 0 .../templates/home.html | 0 .../templates/login.html | 0 {old-stuff/ExampleApp => ExampleApp}/views.py | 0 app.py | 5 ----- example_app.py | 3 +++ old-stuff/ExampleApp/__init__.py | 17 -------------- old-stuff/app.py | 5 +++-- 27 files changed, 28 insertions(+), 24 deletions(-) rename {old-stuff/ExampleApp => ExampleApp}/Wrappers.py (100%) create mode 100644 ExampleApp/__init__.py rename {old-stuff/ExampleApp => ExampleApp}/config/config.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/config/modules.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/exceptions.py (100%) rename {old-stuff/ExampleApp => ExampleApp}/languages/de.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/manifest.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/.gitkeep (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/__init__.py (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/languages/de.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/languages/en.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/manifest.yaml (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/templates/hallo_module.html (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/templates/subview.html (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/urls.py (100%) rename {old-stuff/ExampleApp => ExampleApp}/modules/hallo_module/views.py (100%) rename {old-stuff/ExampleApp => ExampleApp}/static/.gitkeep (100%) rename {old-stuff/ExampleApp => ExampleApp}/static/style.css (100%) rename {old-stuff/ExampleApp => ExampleApp}/templates/.gitkeep (100%) rename {old-stuff/ExampleApp => ExampleApp}/templates/base-struct.html (100%) rename {old-stuff/ExampleApp => ExampleApp}/templates/home.html (100%) rename {old-stuff/ExampleApp => ExampleApp}/templates/login.html (100%) rename {old-stuff/ExampleApp => ExampleApp}/views.py (100%) delete mode 100644 app.py create mode 100644 example_app.py delete mode 100644 old-stuff/ExampleApp/__init__.py diff --git a/old-stuff/ExampleApp/Wrappers.py b/ExampleApp/Wrappers.py similarity index 100% rename from old-stuff/ExampleApp/Wrappers.py rename to ExampleApp/Wrappers.py diff --git a/ExampleApp/__init__.py b/ExampleApp/__init__.py new file mode 100644 index 0000000..e7acfa0 --- /dev/null +++ b/ExampleApp/__init__.py @@ -0,0 +1,22 @@ +#from .sams_classes import SAMSHub +import yaml, os, glob + +# with open('config/config.yaml', 'r') as f: +# hubConf = yaml.load(f.read()) +# hub = SAMSHub(config=hubConf.get( +# 'ExampleApp', +# { 'default_language': 'en', 'main_app': 'Main'} +# )) +# hub.flaskApp.config.update(hubConf.get('flask', {})) +# for appName in hubConf.get('apps', []): +# with open('../' + appName + '/manifest.yaml') as f: +# manifest = yaml.load(f.read()) +# # it is possible for the exampleApp to manipulate the manifest if needed +# # manifest.update({}) <-- or whatever +# hub.addApp(SAMSApp(name = appName, manifest = manifest, langDict = langDict)) + +def search_yaml_files(path): + matchingFiles = [] + extensions = ['.yaml', '.yml'] + for path in glob.glob(path + '*.yaml'): + print(path + '\n') \ No newline at end of file diff --git a/old-stuff/ExampleApp/config/config.yaml b/ExampleApp/config/config.yaml similarity index 100% rename from old-stuff/ExampleApp/config/config.yaml rename to ExampleApp/config/config.yaml diff --git a/old-stuff/ExampleApp/config/modules.yaml b/ExampleApp/config/modules.yaml similarity index 100% rename from old-stuff/ExampleApp/config/modules.yaml rename to ExampleApp/config/modules.yaml diff --git a/old-stuff/ExampleApp/exceptions.py b/ExampleApp/exceptions.py similarity index 100% rename from old-stuff/ExampleApp/exceptions.py rename to ExampleApp/exceptions.py diff --git a/old-stuff/ExampleApp/languages/de.yaml b/ExampleApp/languages/de.yaml similarity index 100% rename from old-stuff/ExampleApp/languages/de.yaml rename to ExampleApp/languages/de.yaml diff --git a/old-stuff/ExampleApp/manifest.yaml b/ExampleApp/manifest.yaml similarity index 100% rename from old-stuff/ExampleApp/manifest.yaml rename to ExampleApp/manifest.yaml diff --git a/old-stuff/ExampleApp/modules/.gitkeep b/ExampleApp/modules/.gitkeep similarity index 100% rename from old-stuff/ExampleApp/modules/.gitkeep rename to ExampleApp/modules/.gitkeep diff --git a/old-stuff/ExampleApp/modules/hallo_module/__init__.py b/ExampleApp/modules/hallo_module/__init__.py similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/__init__.py rename to ExampleApp/modules/hallo_module/__init__.py diff --git a/old-stuff/ExampleApp/modules/hallo_module/languages/de.yaml b/ExampleApp/modules/hallo_module/languages/de.yaml similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/languages/de.yaml rename to ExampleApp/modules/hallo_module/languages/de.yaml diff --git a/old-stuff/ExampleApp/modules/hallo_module/languages/en.yaml b/ExampleApp/modules/hallo_module/languages/en.yaml similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/languages/en.yaml rename to ExampleApp/modules/hallo_module/languages/en.yaml diff --git a/old-stuff/ExampleApp/modules/hallo_module/manifest.yaml b/ExampleApp/modules/hallo_module/manifest.yaml similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/manifest.yaml rename to ExampleApp/modules/hallo_module/manifest.yaml diff --git a/old-stuff/ExampleApp/modules/hallo_module/templates/hallo_module.html b/ExampleApp/modules/hallo_module/templates/hallo_module.html similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/templates/hallo_module.html rename to ExampleApp/modules/hallo_module/templates/hallo_module.html diff --git a/old-stuff/ExampleApp/modules/hallo_module/templates/subview.html b/ExampleApp/modules/hallo_module/templates/subview.html similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/templates/subview.html rename to ExampleApp/modules/hallo_module/templates/subview.html diff --git a/old-stuff/ExampleApp/modules/hallo_module/urls.py b/ExampleApp/modules/hallo_module/urls.py similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/urls.py rename to ExampleApp/modules/hallo_module/urls.py diff --git a/old-stuff/ExampleApp/modules/hallo_module/views.py b/ExampleApp/modules/hallo_module/views.py similarity index 100% rename from old-stuff/ExampleApp/modules/hallo_module/views.py rename to ExampleApp/modules/hallo_module/views.py diff --git a/old-stuff/ExampleApp/static/.gitkeep b/ExampleApp/static/.gitkeep similarity index 100% rename from old-stuff/ExampleApp/static/.gitkeep rename to ExampleApp/static/.gitkeep diff --git a/old-stuff/ExampleApp/static/style.css b/ExampleApp/static/style.css similarity index 100% rename from old-stuff/ExampleApp/static/style.css rename to ExampleApp/static/style.css diff --git a/old-stuff/ExampleApp/templates/.gitkeep b/ExampleApp/templates/.gitkeep similarity index 100% rename from old-stuff/ExampleApp/templates/.gitkeep rename to ExampleApp/templates/.gitkeep diff --git a/old-stuff/ExampleApp/templates/base-struct.html b/ExampleApp/templates/base-struct.html similarity index 100% rename from old-stuff/ExampleApp/templates/base-struct.html rename to ExampleApp/templates/base-struct.html diff --git a/old-stuff/ExampleApp/templates/home.html b/ExampleApp/templates/home.html similarity index 100% rename from old-stuff/ExampleApp/templates/home.html rename to ExampleApp/templates/home.html diff --git a/old-stuff/ExampleApp/templates/login.html b/ExampleApp/templates/login.html similarity index 100% rename from old-stuff/ExampleApp/templates/login.html rename to ExampleApp/templates/login.html diff --git a/old-stuff/ExampleApp/views.py b/ExampleApp/views.py similarity index 100% rename from old-stuff/ExampleApp/views.py rename to ExampleApp/views.py diff --git a/app.py b/app.py deleted file mode 100644 index e68e1eb..0000000 --- a/app.py +++ /dev/null @@ -1,5 +0,0 @@ -#from test_app import hub - -#hub.app.run(debug = True) -from importlib import import_module -import_module('foo') \ No newline at end of file diff --git a/example_app.py b/example_app.py new file mode 100644 index 0000000..e77d90a --- /dev/null +++ b/example_app.py @@ -0,0 +1,3 @@ +from .ExampleApp import hub + +hub.flaskApp.run() \ No newline at end of file diff --git a/old-stuff/ExampleApp/__init__.py b/old-stuff/ExampleApp/__init__.py deleted file mode 100644 index a4bd174..0000000 --- a/old-stuff/ExampleApp/__init__.py +++ /dev/null @@ -1,17 +0,0 @@ -from ..sams_classes import SAMSHub -import yaml - -with open('config/config.yaml', 'r') as f: - hubConf = yaml.load(f.read()) -hub = SAMSHub(config=hubConf.get( - 'ExampleApp', - { 'default_language': 'en', 'main_app': 'Main'} -)) -hub.flaskApp.config.update(hubConf.get('flask', {})) -for appName in hubConf.get('apps', []): - with open('../' + appName + '/manifest.yaml') as f: - manifest = yaml.load(f.read()) - # it is possible for the exampleApp to manipulate the manifest if needed - # manifest.update({}) <-- or whatever -""" TODO: loadDictFromYAMLFiles """ - hub.addApp(SAMSApp(name = appName, manifest = manifest, langDict = langDict)) \ No newline at end of file diff --git a/old-stuff/app.py b/old-stuff/app.py index 68af58e..99f3b53 100644 --- a/old-stuff/app.py +++ b/old-stuff/app.py @@ -1,3 +1,4 @@ -from ExampleApp import hub +from ExampleApp import search_yaml_files -hub.flaskApp.run() +# hub.flaskApp.run() +search_yaml_files('./ExampleApp/config/') \ No newline at end of file -- GitLab