api.app   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A create_app() 0 16 2
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