def create_app(): app = Flask(__name__, static_url_path='', static_folder='../web/static') app.secret_key = 'hack me' DB.init() bcrypt.init_app(app) register_blueprint(app) return app
def create_app(config): app = Flask(__name__) app.json_encoder = CustomJSONEncoder CORS(app) DB.init() register_blueprints(app) return app
def create_app(config): app = Flask(__name__) DB.init() register_blueprints(app) for job_name in ['job1', 'job2', 'job3']: new_job = Job(name=job_name) new_job.insert() return app
def create_app(config): app = Flask(__name__) DB.init() scheduler = Scheduler(seconds=900) with app.app_context(): scheduler.start_scheduler() register_blueprints(app) return app
def create_app(config_name): app = Flask(__name__) app.config.from_object( app_config[config_name] ) #Updates the values from the given object : Load Configuration Defaults logging.basicConfig(filename='flask.log', level=logging.DEBUG, format='%(asctime)s %(levelname)s : %(message)s') DB.init() register_blueprints(app) return app
def create_app(new): app = Flask(__name__) bootstrap = Bootstrap(app) app.config.from_object(Config) #根据config启用mongodb if Config.MongoDbEnable: DB.init() for job_name in ['job1', 'job2', 'job3']: new_job = Job(name=job_name) new_job.insert() sentence2vec.init() NewsData.init() register_blueprints(app) return app
def create_app(test_config=None): app = Flask(__name__, instance_relative_config=True) app.config.from_mapping(SECRET_KEY='dev', ) 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 DB.init() register_blueprints(app) app.json_encoder = JSONEncoder return app
def create_app(): app = Flask(__name__) bootstrap = Bootstrap(app) app.config.from_object(Config) # 根据config启用mongodb if Config.MongoDbEnable: DB.init() register_blueprints(app) # 启动爬虫定时任务 if Config.WebCrawlerEnable: scheduler = APScheduler() # 注册app scheduler.init_app(app) scheduler.start() # 启用数据处理 if Config.ProcessDataEnable: RatingProcessSchd() Response.init() return app
from flask import Flask from app.database import DB from flask_login import LoginManager from flask_mail import Mail from dotenv import load_dotenv import os load_dotenv() absolute_path = os.path.abspath(os.path.dirname(__file__)) # print(absolute_path) # print(os.path.exists("app/static/images/male.jpg")) app = Flask(__name__) DB.init() app.config['UPLOADED_PHOTOS_DEST'] = os.path.join(absolute_path, 'static/images') app.config['SECRET_KEY'] = os.getenv('SECRET_KEY') login_manager = LoginManager(app) app.config['MAIL_SERVER'] = 'smtp.mailtrap.io' app.config['MAIL_PORT'] = 2525 app.config['MAIL_USERNAME'] = os.getenv('MAIL_USERNAME') app.config['MAIL_PASSWORD'] = os.getenv('MAIL_PASSWORD') app.config['MAIL_DEFAULT_SENDER'] = 'mail@hangouts' app.config['MAIL_SUPPRESS_SEND'] = True # change this to true to actually send mail = Mail(app) # from app.controllers import routes from app.controllers import userRoutes
def create_app(config): app = Flask(__name__) DB.init() register_blueprints(app) return app
def Init(): DB.init() SentimentClassification.Init() pass