Last active
April 30, 2018 16:07
-
-
Save ssomnoremac/157a2b39b79f913f7baad007cd149c05 to your computer and use it in GitHub Desktop.
app.py for graphene and sqlalchemy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from database import db_session | |
from flask_graphql import GraphQLView | |
from schema import schema | |
app = Flask(__name__) | |
app.debug = True | |
app.add_url_rule('/graphql', view_func=GraphQLView.as_view('graphql', schema=schema, graphiql=True, context={'session': db_session})) | |
@app.teardown_appcontext | |
def shutdown_session(exception=None): | |
db_session.remove() | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment