#coding=utf-8
#app.py
from flask import Flask
from flask import render_template
from book.book import book_bp
from configs import config
def create_app(config_name):
app = Flask(__name__)
#basic config
app.config.from_object(config[config_name])
#blueprint
app.register_blueprint(book_bp)
#error_handler
handler_errors(app)
return app
def handler_errors(app):
@app.errorhandler(404)
def page_not_found(error):
return render_template("404.html")
#run.py
#coding=utf-8
from app import create_app
app = create_app('default')
if __name__ == "__main__":
app.run(debug=True)