diff options
author | neodarz <neodarz@neodarz.net> | 2019-07-08 15:46:39 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-07-08 15:50:24 +0200 |
commit | bcde164af6aeccc13ee77c0b5e505399994095d3 (patch) | |
tree | bb4bc6b2150d06f1cca935a8af637f95094dad3e /umosapi/__init__.py | |
download | umosapi-bcde164af6aeccc13ee77c0b5e505399994095d3.tar.xz umosapi-bcde164af6aeccc13ee77c0b5e505399994095d3.zip |
Initial commit
All code are mainly copied then adjusted from
https://git.neodarz.net/pro/liberationCenter.git/
Diffstat (limited to 'umosapi/__init__.py')
-rw-r--r-- | umosapi/__init__.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/umosapi/__init__.py b/umosapi/__init__.py new file mode 100644 index 0000000..ac93e1d --- /dev/null +++ b/umosapi/__init__.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +""" + UMoSApi + ~~~~~~~ + + Unity Mongo Save Api is a simple API for save Unity object in Mongo + database. + + :copyright: (c) 2019 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/umosapi", + ) + + 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 |