forked from allisson/flask-example
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.py
More file actions
33 lines (23 loc) · 701 Bytes
/
application.py
File metadata and controls
33 lines (23 loc) · 701 Bytes
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
# -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.mongoengine import MongoEngine
from flask_mail import Mail
# flask mongoengine
db = MongoEngine()
# flask mail
mail = Mail()
# application factory, see: http://flask.pocoo.org/docs/patterns/appfactories/
def create_app(config_filename):
app = Flask(__name__)
app.config.from_object(config_filename)
# flask mongoengine init
db.init_app(app)
# flask mail init
mail.init_app(app)
# import blueprints
from accounts.views import accounts_app
from pages.views import pages_app
# register blueprints
app.register_blueprint(accounts_app)
app.register_blueprint(pages_app)
return app