Skip to content

Instantly share code, notes, and snippets.

@shonenada
Created May 9, 2014 15:30
Show Gist options
  • Save shonenada/03d511196bbb9ba2592b to your computer and use it in GitHub Desktop.
Save shonenada/03d511196bbb9ba2592b to your computer and use it in GitHub Desktop.
import os
from flask import Flask
def create_app(import_name=None, config=None):
app = Flask(import_name or __name__)
app.config.from_object('$project_name.settings')
if isinstance(config, dict):
app.config.update(config)
elif config:
app.config.from_pyfile(os.path.abspath(config))
return app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment