|
|
@ -101,7 +101,7 @@ class Fractal(db.Model): |
|
|
|
with app.app_context(): |
|
|
|
db.create_all() |
|
|
|
|
|
|
|
manager = APIManager(app, flask_sqlalchemy_db=db) |
|
|
|
manager = APIManager(app=app, session=db.session) |
|
|
|
connection = Connection(CONF.transport_url) |
|
|
|
|
|
|
|
|
|
|
@ -110,8 +110,8 @@ connection = Connection(CONF.transport_url) |
|
|
|
@app.route('/index/<int:page>', methods=['GET']) |
|
|
|
def index(page=1): |
|
|
|
fractals = Fractal.query.filter( |
|
|
|
(Fractal.checksum != None) & (Fractal.size != None)).paginate( # noqa |
|
|
|
page, 5, error_out=False) |
|
|
|
(Fractal.checksum != None) & (Fractal.size != None)).paginate( |
|
|
|
page=page, per_page=5) |
|
|
|
return flask.render_template('index.html', fractals=fractals) |
|
|
|
|
|
|
|
|
|
|
@ -147,6 +147,6 @@ def main(): |
|
|
|
with app.app_context(): |
|
|
|
manager.create_api(Fractal, methods=['GET', 'POST', 'DELETE', 'PUT'], |
|
|
|
postprocessors={'POST': [generate_fractal]}, |
|
|
|
exclude_columns=['image'], |
|
|
|
exclude=['image'], |
|
|
|
url_prefix='/v1') |
|
|
|
app.run(host=CONF.listen_address, port=CONF.bind_port) |