diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06a47c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +env/ +__pycache__/ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b1e9d05 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/home/arne/Desktop/Development/python3/flask/vocabulary/env/bin/python3.8" +} \ No newline at end of file diff --git a/README.md b/README.md index 64a781b..1e03584 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ # Rechentrainer -Einmaleins Übungsblätter generieren \ No newline at end of file +Einmaleins Übungsblätter generieren + +``` +. env/bin/activate +pip3 install -r requirements.txt +``` diff --git a/app.py b/app.py new file mode 100644 index 0000000..220763f --- /dev/null +++ b/app.py @@ -0,0 +1,29 @@ +from flask import Flask, render_template, url_for, request, redirect, Response, abort, session +from flask_sqlalchemy import SQLAlchemy +from datetime import datetime +import magic +import random +import string + + +app = Flask(__name__) +app.secret_key = 'eng5iikeiwah3lae4idoo0woh4eiy6Th' + +@app.route('/', methods = ['GET', 'POST']) +def index(): + if request.method == 'POST': + alle = [] + zufall = [] + for r in request.form.getlist('rechenreihen'): + for i in range(1,11): + alle.append({str(r)+"x"+str(i): int(r)*int(i) }) + + while len(alle): + zufall.append(alle.pop(random.randint(0,len(alle)-1))) + return render_template('arbeitsblatt.html',aufgaben=zufall) + else: + return render_template('generator.html') + + +if __name__ == "__main__": + app.run(debug=True) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ecc8f4a --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +python-magic==0.4.15 +Click==7.0 +Flask==1.1.1 +Flask-SQLAlchemy==2.4.1 +gunicorn==20.0.4 +itsdangerous==1.1.0 +Jinja2==2.10.3 +MarkupSafe==1.1.1 +SQLAlchemy==1.3.12 +Werkzeug==0.16.0 diff --git a/templates/arbeitsblatt.html b/templates/arbeitsblatt.html new file mode 100644 index 0000000..b0c7e90 --- /dev/null +++ b/templates/arbeitsblatt.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block content %} +
+ {% for a in aufgaben %} + {% for k in a %} +
{{ k }} =
+ {% endfor %} + {% endfor %} +
+{% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..54dc429 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,22 @@ + + + + + + + + + {% block head %}Rechentrainer{% endblock %} + + +
+ {% block header %}

homeRechentrainer

{% endblock %} +
+
+ {% block content %}{% endblock %} +
+ + + \ No newline at end of file diff --git a/templates/generator.html b/templates/generator.html new file mode 100644 index 0000000..a9f3dbf --- /dev/null +++ b/templates/generator.html @@ -0,0 +1,33 @@ +{% extends 'base.html' %} + +{% block content %} +
+
+ + 1er Reihe
+ 2er Reihe
+ 3er Reihe
+ 4er Reihe
+ 5er Reihe
+ 6er Reihe
+ 7er Reihe
+ 8er Reihe
+ 9er Reihe
+ 10er Reihe
+ + +
+
+{% endblock %} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..c2da5a2 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,20 @@ +{% extends 'base.html' %} + +{% block content %} +
+
+ + +
+
+{% endblock %} \ No newline at end of file