From 650ac394c67071bdb796876cf196d1622f906f65 Mon Sep 17 00:00:00 2001 From: beertap Date: Sun, 17 Jul 2022 14:01:38 +0200 Subject: [PATCH] add readme --- README.md | 25 +++++++++++++++++++++++++ beertap/__init__.py | 4 +--- beertap/views.py | 1 + main.py | 3 --- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9b516ff..373297c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # flask-beertap +## How to run + +If you want a production environment set up your `.env` to provide an app key. + +```python +pipenv install +pipenv run python main.py +chromium-browser 127.0.0.1:5000 +``` + +## gpio handler + +Takes care of the needed raspberry pi gpio functions. + +```python +from gpio_handler import create_output + +out = create_output() +out.gpio_test() +out.gpio_set_pulse(channel=1, time_on=2) +``` + +## Author + +Aaron Schmocker diff --git a/beertap/__init__.py b/beertap/__init__.py index 3fdf254..03c6bb3 100644 --- a/beertap/__init__.py +++ b/beertap/__init__.py @@ -1,6 +1,7 @@ import os from flask import Flask +from .views import views flask_app_secret = os.environ.get('APP_SECRET', 'changeme') @@ -10,9 +11,6 @@ def create_app(): ''' app = Flask(__name__) app.config['SECRET_KEY'] = flask_app_secret - - from .views import views - app.register_blueprint(views, url_prefix='/') return app diff --git a/beertap/views.py b/beertap/views.py index d9833fb..12f218c 100644 --- a/beertap/views.py +++ b/beertap/views.py @@ -11,6 +11,7 @@ tap_right=20 # create ouput handler output = create_output() +output.gpio_test() @views.route('/', methods=['GET']) def render(): diff --git a/main.py b/main.py index 9ec248f..1fe9d1d 100644 --- a/main.py +++ b/main.py @@ -1,9 +1,6 @@ from beertap import create_app -from gpio_handler import create_output app = create_app() -output = create_output() if __name__ == "__main__": - output.gpio_test() app.run(debug=True)