aboutsummaryrefslogtreecommitdiff
path: root/src/lb_app/__init__.py
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-06-16 17:52:31 +0200
committerneodarz <neodarz@neodarz.net>2018-06-16 17:52:31 +0200
commit5bcc1ed9df4e7a6b8086cac3f25a466aee3bebcd (patch)
treef4e72ed3712a148a28a0c11323f1796f7499a336 /src/lb_app/__init__.py
parentcf29b5d4324b03d826615cfbb7f7345c54da1762 (diff)
downloadliberationCenter-5bcc1ed9df4e7a6b8086cac3f25a466aee3bebcd.tar.xz
liberationCenter-5bcc1ed9df4e7a6b8086cac3f25a466aee3bebcd.zip
Add first structure of the application
Diffstat (limited to 'src/lb_app/__init__.py')
-rw-r--r--src/lb_app/__init__.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/lb_app/__init__.py b/src/lb_app/__init__.py
new file mode 100644
index 0000000..cf7fa7e
--- /dev/null
+++ b/src/lb_app/__init__.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""
+ liberationCenter
+ ~~~~~~~~~~~~~~~~
+
+ Small AppCenter for apps.
+
+ :copyright: (c) 2018 by neodarz.
+ :licence: GPLv3, see LICENSE for more details.
+"""
+import os
+
+from flask import (Flask, render_template)
+
+def create_app(test_config=None):
+ app = Flask(__name__, instance_relative_config=True)
+ app.config.from_mapping(
+ SECRET_KEY='dev',
+ MONGO_URI= "mongodb://localhost:27017/liberationCenter",
+ )
+
+ if test_config is None:
+ app.config.from_pyfile('config.py', silent=True)
+ else:
+ app.config.from_mapping(test_config)
+
+ try:
+ os.makedirs(app.instance_path)
+ except OSError:
+ pass
+
+ from . import api
+ app.register_blueprint(api.bp, url_prefix='/api')
+
+ return app