app.py 838 B

12345678910111213141516171819202122232425262728293031323334353637
  1. """
  2. Main entry-point for the TerrAssumptions API server
  3. Running this file directly will launch a development server.
  4. The WSGI-compatible Flask server is exposed from this module as app.
  5. """
  6. import os
  7. from flask import Flask, jsonify
  8. from flask_cors import CORS
  9. from db import db
  10. from game_api import game
  11. app = Flask(__name__)
  12. CORS(app)
  13. app.config["SQLALCHEMY_DATABASE_URI"] = os.environ.get("DATABASE_URI", "sqlite:////tmp/terrassumptions.db")
  14. app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
  15. app.register_blueprint(game, url_prefix="/game")
  16. db.init_app(app)
  17. db.create_all(app=app)
  18. @app.route("/")
  19. def version():
  20. """
  21. Return the version of the API and a status message, "healthy"
  22. """
  23. return jsonify({"version": "1", "status": "healthy"})
  24. if __name__ == "__main__":
  25. app.run("0.0.0.0", 5000, debug=True)