forked from esfoobar/pets-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication.py
41 lines (31 loc) · 954 Bytes
/
application.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from flask import Flask
from flask_mongoengine import MongoEngine
from subprocess import call
import os
from settings import MONGODB_HOST
db = MongoEngine()
def create_app(**config_overrides):
app = Flask(__name__)
# Load config
app.config.from_pyfile('settings.py')
# apply overrides for tests
app.config.update(config_overrides)
# setup db
db.init_app(app)
# import blueprints
from home.views import home_app
from pet.views import pet_app
from app.views import app_app
from store.views import store_app
# register blueprints
app.register_blueprint(home_app)
app.register_blueprint(pet_app)
app.register_blueprint(app_app)
app.register_blueprint(store_app)
return app
def fixtures(test_db, collection, fixture):
command = "mongoimport -h %s \
-d %s \
-c %s \
< %s" % (MONGODB_HOST, test_db, collection, fixture)
call(command, shell=True)