39 lines
931 B
Python
39 lines
931 B
Python
import logging
|
|
import logging.config
|
|
from flask import Flask
|
|
|
|
from common.utils.celery_utils import make_celery, init_celery
|
|
from common.extensions import db
|
|
from config.logging_config import LOGGING
|
|
|
|
|
|
def create_app(config_file=None):
|
|
app = Flask(__name__)
|
|
|
|
if config_file is None:
|
|
app.config.from_object('config.config.DevConfig')
|
|
else:
|
|
app.config.from_object(config_file)
|
|
|
|
logging.config.dictConfig(LOGGING)
|
|
app.embed_tuning_logger = logging.getLogger('embed_tuning')
|
|
|
|
register_extensions(app)
|
|
|
|
celery = make_celery(app.name, app.config)
|
|
init_celery(celery, app)
|
|
|
|
from . import tasks
|
|
|
|
app.logger.info("EveAI Worker Server Started Successfully")
|
|
app.logger.info("-------------------------------------------------------------------------------------------------")
|
|
|
|
return app, celery
|
|
|
|
|
|
def register_extensions(app):
|
|
db.init_app(app)
|
|
|
|
|
|
app, celery = create_app()
|