The Flask-DropIn makes organizing large flask application easier. You can break your to multiple
dropins, which is similiar concept as Django's app, and Flask-DropIn will automatically pick them
up, and assemble different parts into your flask application.
Read the full documentation.
Install with pip and easy_install
pip install flask-dropin
or download the latest version from version control
git clone https://github.com/zh012/flask-dropin.git cd flask-dropin python setup.py develop
Create a Flask application
Create a folder
testapp, and a file
app.py in the folder with following content
from flask import Flask from flask_dropin import DropInManager app = Flask(__name__) app.config['DROPINS'] = ['home'] dropin = DropInManager(app) if __name__ == '__main__': app.run(debug=True)
Create another file
home.py in the same folder
from flask import Blueprint, jsonify web = Blueprint('home_web', __name__, url_prefix='/web') @web.route('/') def landing(): return 'Hello world!' api = Blueprint('home_api', __name__, url_prefix='/api') @api.route('/version') def myprofile(): return jsonify(version='0.0.0') blueprints = [web, api]
Run this app
Now, open the urls
in browser, you will find that the blueprints are registered to the app automatically.