コード例 #1
0
ファイル: shell.py プロジェクト: ehenneken/adsabs
from flask import render_template

from adsabs import create_app
from config import config

config.LOGGING_LOG_TO_FILE = False
config.LOGGING_LOG_TO_CONSOLE = True
config.LOGGING_LOG_LEVEL = 'INFO'

if not getattr(config, 'SECRET_KEY', None):
    # set a fake one to keep the create_app from barfing
    config.SECRET_KEY = "foo"



app = create_app(config)    
manager = Manager(app)#, with_default_commands=False)

tools_manager = Manager("Tools commands")#, with_default_commands=False)

@manager.command
def run(port=5000):
    """Run server that can be reached from anywhere."""
    app.run(host='0.0.0.0', port=int(port))
    
@manager.command
def create_local_config():
    """Generate a local_config.py with necessary settings"""
    local_config_path = os.path.join(app.root_path, '../config/local_config.py')
    if os.path.exists(local_config_path):
        app.logger.info("local_config.py exists")
コード例 #2
0
ファイル: entry.py プロジェクト: aaccomazzi/adsabs
# -*- coding: utf-8 -*-
"""
    wsgi
    ~~~~

    Deploy with gunicorn.
"""

import sys, os

PROJECT_ROOT = os.path.join(os.path.dirname(__file__))
sys.path.insert(0,PROJECT_ROOT)

from adsabs import create_app
application = create_app()