From 1fc1e6379a212e04565a31fef33eeec96150e586 Mon Sep 17 00:00:00 2001 From: Skyler Mansfield Date: Wed, 6 Mar 2024 18:45:52 +0000 Subject: [PATCH 1/3] fix install instructions pip install -u is no longer a valid flag user install is auto detected --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1d0396..1f5a572 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Ensure you have python poetry installed - this is used to install a virtualenv a ``` pip install --upgrade pip -pip3 install -u poetry +pip3 install poetry poetry install --no-root ``` From 1ea0cf06b177b3fc236c1fa5a7112eb7ce0726e3 Mon Sep 17 00:00:00 2001 From: Skyler Mansfield Date: Wed, 6 Mar 2024 18:46:14 +0000 Subject: [PATCH 2/3] Add flask method view example challenge 3 --- challenge/templates/challenge3.html | 6 ++++++ challenge/templates/index.html | 1 + challenge/views/__init__.py | 1 + challenge/views/challenge_3.py | 8 ++++++++ 4 files changed, 16 insertions(+) create mode 100644 challenge/templates/challenge3.html create mode 100644 challenge/views/challenge_3.py diff --git a/challenge/templates/challenge3.html b/challenge/templates/challenge3.html new file mode 100644 index 0000000..6fa1609 --- /dev/null +++ b/challenge/templates/challenge3.html @@ -0,0 +1,6 @@ +{% extends 'layout.html' %} + +{% block content %} +

Challenge 3

+

This is an example using a flask method view to render a template

+{% endblock %} diff --git a/challenge/templates/index.html b/challenge/templates/index.html index ff887f4..b967fc9 100644 --- a/challenge/templates/index.html +++ b/challenge/templates/index.html @@ -8,6 +8,7 @@

Challenges

{% endblock %} diff --git a/challenge/views/__init__.py b/challenge/views/__init__.py index 37c9efc..40a02e6 100644 --- a/challenge/views/__init__.py +++ b/challenge/views/__init__.py @@ -5,6 +5,7 @@ from . import ( challenge_1, # noqa: F401 challenge_2, # noqa: F401 + challenge_3, # noqa: F401 ) diff --git a/challenge/views/challenge_3.py b/challenge/views/challenge_3.py new file mode 100644 index 0000000..d179a9d --- /dev/null +++ b/challenge/views/challenge_3.py @@ -0,0 +1,8 @@ +from flask import render_template + +from challenge import app + + +@app.route("/3/", methods=["GET", "POST"]) +def challenge_3() -> str: + return render_template("challenge3.html") From 28bf49bcb2c070e89db38619a4d1ede7d6343ad6 Mon Sep 17 00:00:00 2001 From: Skyler Mansfield Date: Wed, 6 Mar 2024 19:31:39 +0000 Subject: [PATCH 3/3] Add `python -m poetry` to run poetry --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1f5a572..50fe859 100644 --- a/README.md +++ b/README.md @@ -8,22 +8,22 @@ This template repository contains all the required files to start a simple chall Ensure you have python poetry installed - this is used to install a virtualenv and manage dependencies ``` -pip install --upgrade pip +pip install --upgrade pip --user pip3 install poetry -poetry install --no-root +python -m poetry install --no-root ``` ## Running in development Flask comes with a development server built in. To use it, run ``` -poetry run flask -A challenge run +python -m poetry run flask -A challenge run ``` ## Running in production ``` -poetry run gunicorn 'challenge:app' +python -m poetry run gunicorn 'challenge:app' ``` ## Running with docker