From 2a1b0ac6539628303e033aa000784185ad4feb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Fri, 17 Apr 2020 16:51:26 +0200 Subject: [PATCH] skeleton done --- app.py | 31 +++++++++++++++++++++++++++++++ endpoints.py | 10 ++++++++++ redisclient.py | 3 +++ requirements.txt | 3 +++ 4 files changed, 47 insertions(+) create mode 100644 redisclient.py diff --git a/app.py b/app.py index e69de29..f55d8ae 100644 --- a/app.py +++ b/app.py @@ -0,0 +1,31 @@ +import sentry_sdk +from sentry_sdk.integrations.flask import FlaskIntegration +from flask import Flask +import os +from rediscleint import redis_client +from endpoints import IPEndpoint + +""" +Main Flask RESTful API +""" + +__author__ = "@tormakris" +__copyright__ = "Copyright 2020, GoldenPogácsa Team" +__module_name__ = "app" +__version__text__ = "1" + +sentry_sdk.init( + dsn="https://f0eed44d403045468aad035e93986f62@sentry.kmlabz.com/14", + integrations=[FlaskIntegration()] +) + +app = Flask(__name__) +app.config['REDIS_URL'] = os.environ['REDIS_URL'] + +redis_client.init_app(app) + +for view in [IPEndpoint]: + view.register(app, trailing_slash=False) + +if __name__ == "__main__": + app.run(debug=True) diff --git a/endpoints.py b/endpoints.py index e69de29..d21c2ed 100644 --- a/endpoints.py +++ b/endpoints.py @@ -0,0 +1,10 @@ +from redisclient import redis_client +from flask import jsonify +from flask_classful import FlaskView + + +class IPEndpoint(FlaskView): + + def post(self): + """Ez kell neked""" + pass \ No newline at end of file diff --git a/redisclient.py b/redisclient.py new file mode 100644 index 0000000..701805e --- /dev/null +++ b/redisclient.py @@ -0,0 +1,3 @@ +from flask_redis import FlaskRedis + +redis_client = FlaskRedis() \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index d4f8e4c..a612a78 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,5 @@ flask flask-classful +flask-redis +gunicorn +sentry-sdk[flask] \ No newline at end of file