def create_app(self):
     self.app = app
     self.app.config.from_object(Config)
     self.app.config.update(SQLALCHEMY_BINDS={
         'octopus_db': Config.SQLALCHEMY_DATABASE_URI,
         'octopus_inner': "sqlite:///{0}/config.db".format(get_work_dir())
     })
     return self.app
Пример #2
0
    def create_app(self):
        self.app = app
        self.app.config.from_object(Config)
        self.app.config.update(SQLALCHEMY_BINDS={
            'octopus_db': Config.SQLALCHEMY_DATABASE_URI,
            'octopus_inner': "sqlite:///{0}/config.db".format(get_work_dir())
        })

        # json 正确显示中文,而不是unicode
        self.app.config.update(RESTFUL_JSON=dict(ensure_ascii=False))
        return self.app
Пример #3
0
from octopus.views.api.mgt.innerdb import mgt_idb_bp, IDB, InfaEnvs

## markdown
# from flaskext.markdown import Markdown

__author__ = "Arthur Li"
__email__ = "*****@*****.**"
__version__ = "1.0.0"

app = Flask(__name__)
app.config.from_object(Config)
db.init_app(app)
app.config.update(
    SQLALCHEMY_BINDS={
        'octopus_db': Config.SQLALCHEMY_DATABASE_URI,
        'octopus_inner': "sqlite:///{0}/config.db".format(get_work_dir())
    })

# json 正确显示中文,而不是unicode
app.config.update(RESTFUL_JSON=dict(ensure_ascii=False))

# Markdown(app)
# @app.route("/")
# def index():
#     contents = ""
#     with open("README.md", 'r') as freadme:
#         for i in  freadme.readlines():
#             contents += str(i)
#     template = '{{mystr|markdown}}'
#     print(type(contents))
#     return render_template_string(template, mystr = contents)
Пример #4
0
# -*- coding:utf-8 -*-
import logging.config
import os
import logging
from octopus.common.path_utils import get_work_dir

LOG_CONF_FILE = os.path.join(get_work_dir(), "log.conf")
logging.config.fileConfig(LOG_CONF_FILE)

rootLogger = logging.getLogger("root")
mainLogger = logging.getLogger("main")

# Import the log level
# from logging import DEBUG, INFO, WARNING, ERROR, FATAL, CRITICAL