From 8318b8295265d1befc85a4f0eb18b970cc4a6d4a Mon Sep 17 00:00:00 2001 From: Sergiusz Warga Date: Sun, 22 Nov 2020 17:11:23 +0100 Subject: [PATCH] Text with input fields veryfing its correctness --- README.md | 7 ++++ __init__.py | 0 app/__init__.py | 7 ++++ app/main.py | 23 +++++++++++++ main.py => app/routes.py | 32 ++++++------------- .../LLPSI/01_Imperium_Romanum/Pensum_A.html | 32 +++++++++++++++++++ .../templates}/coniugationes.html | 0 {templates => app/templates}/latin.html | 1 + 8 files changed, 79 insertions(+), 23 deletions(-) create mode 100644 README.md delete mode 100644 __init__.py create mode 100644 app/__init__.py create mode 100644 app/main.py rename main.py => app/routes.py (51%) create mode 100644 app/templates/LLPSI/01_Imperium_Romanum/Pensum_A.html rename {templates => app/templates}/coniugationes.html (100%) rename {templates => app/templates}/latin.html (73%) diff --git a/README.md b/README.md new file mode 100644 index 0000000..3d6af67 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# Development + +To run the app: +1. ```pipenv shell``` +2. ```export FLASK_APP=main.py``` +3. ```export FLASK_ENV=development``` +4. ```flask run``` \ No newline at end of file diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..de12fb5 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,7 @@ +from flask import Flask + +app = Flask(__name__) +app.config["SECRET_KEY"] = "asdasfgrwee" +app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///latin.sqlite" + +from app import routes \ No newline at end of file diff --git a/app/main.py b/app/main.py new file mode 100644 index 0000000..be59a31 --- /dev/null +++ b/app/main.py @@ -0,0 +1,23 @@ +from app import app + +# from flask import render_template +# from flask_sqlalchemy import SQLAlchemy +# from sqlalchemy import func +# from flask_wtf import FlaskForm +# from wtforms import Form, RadioField, SubmitField, HiddenField + +# db = SQLAlchemy(app) + +# class Word(db.Model): +# id = db.Column(db.Integer, primary_key=True) +# dictionarium = db.Column(db.String, unique=True, nullable=False) +# coniugatio = db.Column(db.Integer, unique=False, nullable=False) + +# def __repr__(self): +# return '%r; %d conjugation' % (self.dictionarium, self.coniugatio) + +# class ConjugatioAnswer(FlaskForm): +# radio = RadioField('', choices=[(1, 'Prima'), (2, 'Secunda'), (3, 'Tertia'), (4, 'Quarta')]) +# word = HiddenField() +# submit = SubmitField('Check') +# next_word = SubmitField('Next word') \ No newline at end of file diff --git a/main.py b/app/routes.py similarity index 51% rename from main.py rename to app/routes.py index f74d3f5..436299f 100644 --- a/main.py +++ b/app/routes.py @@ -1,33 +1,19 @@ -from flask import Flask +from app import app from flask import render_template -from flask_sqlalchemy import SQLAlchemy -from sqlalchemy import func -from flask_wtf import FlaskForm -from wtforms import Form, RadioField, SubmitField, HiddenField -app = Flask(__name__) -app.config["SECRET_KEY"] = "asdasfgrwee" -app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///latin.sqlite" -db = SQLAlchemy(app) - -class Word(db.Model): - id = db.Column(db.Integer, primary_key=True) - dictionarium = db.Column(db.String, unique=True, nullable=False) - coniugatio = db.Column(db.Integer, unique=False, nullable=False) - - def __repr__(self): - return '%r; %d conjugation' % (self.dictionarium, self.coniugatio) - -class ConjugatioAnswer(FlaskForm): - radio = RadioField('', choices=[(1, 'Prima'), (2, 'Secunda'), (3, 'Tertia'), (4, 'Quarta')]) - word = HiddenField() - submit = SubmitField('Check') - next_word = SubmitField('Next word') +@app.route('/') +@app.route('/index') +def index(): + return "Hello, World!" @app.route('/latin') def latin(): return render_template('latin.html') +@app.route('/latin/llpsi') +def llpsi(): + return render_template('LLPSI/01_Imperium_Romanum/Pensum_A.html') + @app.route('/latin/coniugationes') def coniugationes(): return render_template('coniugationes.html') diff --git a/app/templates/LLPSI/01_Imperium_Romanum/Pensum_A.html b/app/templates/LLPSI/01_Imperium_Romanum/Pensum_A.html new file mode 100644 index 0000000..693e16d --- /dev/null +++ b/app/templates/LLPSI/01_Imperium_Romanum/Pensum_A.html @@ -0,0 +1,32 @@ + + + + + Familia Romana – Pensum A + + + +
+ Nilus fluvi est.
+ +
+ + \ No newline at end of file diff --git a/templates/coniugationes.html b/app/templates/coniugationes.html similarity index 100% rename from templates/coniugationes.html rename to app/templates/coniugationes.html diff --git a/templates/latin.html b/app/templates/latin.html similarity index 73% rename from templates/latin.html rename to app/templates/latin.html index 2818ead..2a64b3f 100644 --- a/templates/latin.html +++ b/app/templates/latin.html @@ -5,6 +5,7 @@ Lingua Latina + Lingua Latina Per Se Illustrata
Coniugationes \ No newline at end of file