Example #1
0
File: app.py Project: jean/sondra
from flask import Flask

from sondra.auth import Auth
from sondra.flask import api_tree

from sondra.tests.web import documents

app = Flask(__name__)
app.debug = True

app.suite = documents.ConcreteSuite()
api = documents.BaseApp(app.suite)
auth = Auth(app.suite)
auth.create_database()
auth.create_tables()
api.create_database()
api.create_tables()

app.register_blueprint(api_tree, url_prefix="/api")

if __name__ == "__main__":
    app.run()
Example #2
0
from examples.todo import *

from flask import Flask
from sondra.flask import api_tree, init

# Create the Flask instance and the suite.
app = Flask(__name__)
app.debug = True
app.suite = TodoSuite()
init(app)

# Register all the applications.
TodoApp(app.suite)

# Create all databases and tables.
app.suite.validate()  # remember this call?
app.suite.ensure_database_objects()  # and this one?

# Attach the API to the /api/ endpoint.
app.register_blueprint(api_tree, url_prefix="/api")

app.run()