diff options
| author | jwansek <eddie.atten.ea29@gmail.com> | 2026-03-24 18:33:56 +0000 |
|---|---|---|
| committer | jwansek <eddie.atten.ea29@gmail.com> | 2026-03-24 18:33:56 +0000 |
| commit | 4303ff93359c42e61cb7362932a4433d4d51cf1b (patch) | |
| tree | c82b6dd3240f28158da924e0c7c8ea5d5bcb0262 /edaweb/app.py | |
| parent | d0d10ab1c7179ab15a440f711909765140436851 (diff) | |
| download | boymoder.blog-4303ff93359c42e61cb7362932a4433d4d51cf1b.tar.gz boymoder.blog-4303ff93359c42e61cb7362932a4433d4d51cf1b.zip | |
Added page for each question
Diffstat (limited to 'edaweb/app.py')
| -rw-r--r-- | edaweb/app.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/edaweb/app.py b/edaweb/app.py index ab2aa0c..0d4458a 100644 --- a/edaweb/app.py +++ b/edaweb/app.py @@ -17,7 +17,7 @@ import io app = flask.Flask(__name__) CONFIG = configparser.ConfigParser(interpolation = None) -CONFIG.read(os.path.join(os.path.dirname(__file__), "edaweb.conf")) +CONFIG.read(os.path.join(os.path.dirname(__file__), "..", "edaweb.conf")) shown_images = set() shown_sidebar_images = set() @@ -27,7 +27,6 @@ def get_pfp_img(db:database.Database): if len(shown_images) == len(dbimg): shown_images = set() folder = set(dbimg).difference(shown_images) - print(folder) choice = random.choice(list(folder)) shown_images.add(choice) return choice @@ -249,6 +248,18 @@ def serve_questions(): qnas_link = CONFIG.get("qnas", "url"), qnas = db.get_qnas() ) + +@app.route("/question") +def serve_question(): + with database.Database() as db: + question_id = flask.request.args.get("id", type=int) + qna = db.get_qna(question_id) + return flask.render_template( + "question.html.j2", + **get_template_items("question from %s" % qna["qna"][2], db), + qnas_link = CONFIG.get("qnas", "url"), + qna = qna + ) if __name__ == "__main__": try: |
