Skip to content

Instantly share code, notes, and snippets.

@wchan2
Last active May 12, 2016 02:11
Show Gist options
  • Save wchan2/da80f228d0bd33b11f2133718f3b3391 to your computer and use it in GitHub Desktop.
Save wchan2/da80f228d0bd33b11f2133718f3b3391 to your computer and use it in GitHub Desktop.
Large Flask Applications
__pycache__
*.pyc

Large Flask Applications

There are several ways to organize large applications but in my opinion this is one of the ways that I think the applications are more maintainable. The way in this gist varies from the way proposed in the Flask documentation.

Features

  • Centralize the routes into a single file by importing the routing functions
  • Create different controller functions inside a controllers.py or even a separate controllers package
  • Create a folder for the different views if applicable
  • Create a folder for static files if thats applicable
def index():
return 'Hello World'
Flask==0.10.1
itsdangerous==0.24
Jinja2==2.8
MarkupSafe==0.23
Werkzeug==0.11.9
from flask import Flask
from controllers import index
app = Flask(__name__)
app.route('/')(index)
app.run(debug=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment