add readme

This commit is contained in:
beertap
2022-07-17 14:01:38 +02:00
parent 65a171d4d9
commit 650ac394c6
4 changed files with 27 additions and 6 deletions

View File

@@ -1,2 +1,27 @@
# flask-beertap # 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 <schmocker@puzzle.ch>

View File

@@ -1,6 +1,7 @@
import os import os
from flask import Flask from flask import Flask
from .views import views
flask_app_secret = os.environ.get('APP_SECRET', 'changeme') flask_app_secret = os.environ.get('APP_SECRET', 'changeme')
@@ -10,9 +11,6 @@ def create_app():
''' '''
app = Flask(__name__) app = Flask(__name__)
app.config['SECRET_KEY'] = flask_app_secret app.config['SECRET_KEY'] = flask_app_secret
from .views import views
app.register_blueprint(views, url_prefix='/') app.register_blueprint(views, url_prefix='/')
return app return app

View File

@@ -11,6 +11,7 @@ tap_right=20
# create ouput handler # create ouput handler
output = create_output() output = create_output()
output.gpio_test()
@views.route('/', methods=['GET']) @views.route('/', methods=['GET'])
def render(): def render():

View File

@@ -1,9 +1,6 @@
from beertap import create_app from beertap import create_app
from gpio_handler import create_output
app = create_app() app = create_app()
output = create_output()
if __name__ == "__main__": if __name__ == "__main__":
output.gpio_test()
app.run(debug=True) app.run(debug=True)