api.app.create_app()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 16
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 13
nop 1
dl 0
loc 16
rs 9.75
c 0
b 0
f 0
1
import os
2
from flask import Flask
3
from .models import db
4
from .tasks import celery
5
6
7
def create_app(config_module=None):
8
  app = Flask(__name__)
9
  app.config.from_object(config_module or
10
                         os.environ.get('FLASK_CONFIG') or
11
                         'config')
12
  celery.config_from_object(app.config)
13
14
  db.init_app(app)
15
16
  from api.v1_0 import api as api_blueprint
17
  app.register_blueprint(api_blueprint, url_prefix='/api/v1.0')
18
19
  if app.config['USE_TOKEN_AUTH']:
20
    from api.token import token as token_blueprint
21
    app.register_blueprint(token_blueprint, url_prefix='/auth')
22
  return app
23
24