app.py 405 B

123456789101112131415161718
  1. import flask
  2. from flask_accept import accept
  3. import by.config as c
  4. import by.model as m
  5. @c.app.route("/p/<slug>")
  6. @accept("application/json")
  7. def page(slug: str):
  8. return flask.jsonify(m.Page.view_from_slug(slug).to_dict())
  9. @page.support("text/html")
  10. def page_json(slug: str):
  11. return flask.redirect(f'/#{slug}')
  12. @c.app.route("/")
  13. def index():
  14. return flask.send_file('../static/index.html')