Skip to content

Commit 3884b0f

Browse files
committed
Update to Flask v3 & related dependencies.
1 parent b816de2 commit 3884b0f

File tree

10 files changed

+847
-59
lines changed

10 files changed

+847
-59
lines changed

Makefile

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,20 @@ lint: env
7777

7878
.PHONY: clean
7979
clean:
80-
find . -name 'poetry.lock' -delete && \
81-
find . -name '.coverage' -delete && \
82-
find . -name '*.pyc' -delete \
83-
find . -name '__pycache__' -delete \
84-
find . -name 'poetry.lock' -delete \
85-
find . -name '*.log' -delete \
86-
find . -name '.DS_Store' -delete \
87-
find . -wholename '**/*.pyc' -delete && \
88-
find . -wholename '**/*.html' -delete && \
89-
find . -type d -wholename '__pycache__' -exec rm -rf {} + && \
90-
find . -type d -wholename '.venv' -exec rm -rf {} + && \
91-
find . -type d -wholename '.pytest_cache' -exec rm -rf {} + && \
92-
find . -type d -wholename '**/.pytest_cache' -exec rm -rf {} + && \
93-
find . -type d -wholename '**/*.log' -exec rm -rf {} + && \
94-
find . -type d -wholename './.reports/*' -exec rm -rf {} + && \
95-
find . -type d -wholename '**/.webassets-cache' -exec rm -rf {}
80+
find . -name 'poetry.lock' -delete
81+
find . -name '.coverage' -delete
82+
find . -name '*.pyc' -delete
83+
find . -name '__pycache__' -delete
84+
find . -name 'poetry.lock' -delete
85+
find . -name '*.log' -delete
86+
find . -name '.DS_Store' -delete
87+
find . -wholename '**/*.pyc' -delete
88+
find . -wholename '**/*.html' -delete
89+
find . -type d -wholename '**/__pycache__/' -exec rm -rf {} \;
90+
find . -type d -wholename '.venv' -exec rm -rf {} \;
91+
find . -type d -wholename '.pytest_cache' -exec rm -rf {} \;
92+
find . -type d -wholename '**/.pytest_cache' -exec rm -rf {} \;
93+
find . -type d -wholename '**/*.log' -exec rm -rf {} \;
94+
find . -type d -wholename './.reports/*' -exec rm -rf {} \;
95+
find . -type d -wholename '**/.webassets-cache/' -exec rm -rf {} \;
9696

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Flask-Session Tutorial
22

33
![Python](https://img.shields.io/badge/Python-v^3.10-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
4-
![Flask](https://img.shields.io/badge/Flask-v^2.3.3-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
4+
![Flask](https://img.shields.io/badge/Flask-v^3.0.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
55
![Flask-Login](https://img.shields.io/badge/Flask--Login-v0.6.2-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
66
![Flask-Session](https://img.shields.io/badge/Flask--Session-v0.5.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
77
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-v3.0.5-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)

flask_session_tutorial/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ def create_app():
2020
session.init_app(app)
2121

2222
with app.app_context():
23-
from . import routes
24-
from . import auth
23+
from . import auth, routes
2524
from .assets import compile_static_assets
2625

2726
app.register_blueprint(routes.main_blueprint)

flask_session_tutorial/assets.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,9 @@ def compile_javascript(app: Flask):
5454
Environment.auto_build = True
5555
Environment.debug = False
5656
# JavaScript Bundle
57-
js_bundle = Bundle(
58-
"src/js/main.js",
59-
filters="jsmin", output="dist/js/main.min.js")
57+
js_bundle = Bundle("src/js/main.js", filters="jsmin", output="dist/js/main.min.js")
6058
# Register assets
6159
assets.register("js_all", js_bundle)
6260
# Build assets in development mode
6361
if app.config.get("ENVIRONMENT") != "production":
64-
js_bundle.build(force=True)
62+
js_bundle.build(force=True)

flask_session_tutorial/auth.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
from flask_session_tutorial.models import User, db
1010

1111
# Blueprint Configuration
12-
auth_blueprint = Blueprint(
13-
"auth",
14-
__name__,
15-
template_folder="templates",
16-
static_folder="static"
17-
)
12+
auth_blueprint = Blueprint("auth", __name__, template_folder="templates", static_folder="static")
1813

1914

2015
@auth_blueprint.route("/signup", methods=["GET", "POST"])

flask_session_tutorial/forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
class SignupForm(FlaskForm):
88
"""User Sign-up Form."""
9+
910
user_name = StringField("Name", validators=[DataRequired()])
1011
user_email = StringField(
1112
"Email",
@@ -35,6 +36,7 @@ class SignupForm(FlaskForm):
3536

3637
class LoginForm(FlaskForm):
3738
"""User Log-in Form for existing users."""
39+
3840
user_email = StringField("Email", validators=[DataRequired(), Email(message="Enter a valid email.")])
3941
user_password = PasswordField("Password", validators=[DataRequired()])
4042
submit_button = SubmitField("Log In")

flask_session_tutorial/routes.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@
33
from flask_login import current_user, login_required, logout_user
44

55
# Blueprint Configuration
6-
main_blueprint = Blueprint(
7-
"main",
8-
__name__,
9-
template_folder="templates",
10-
static_folder="static"
11-
)
6+
main_blueprint = Blueprint("main", __name__, template_folder="templates", static_folder="static")
127

138

149
@main_blueprint.route("/dashboard", methods=["GET"])
1510
@login_required
1611
def dashboard() -> Response:
1712
"""
1813
Logged in Dashboard screen.
19-
14+
2015
:returns: Response
2116
"""
2217
session["redis_test"] = "This is a session variable."
@@ -34,7 +29,7 @@ def dashboard() -> Response:
3429
def session_view() -> Response:
3530
"""
3631
Display session variable value.
37-
32+
3833
:returns: Response
3934
"""
4035
return render_template(
@@ -50,7 +45,7 @@ def session_view() -> Response:
5045
def logout() -> Response:
5146
"""
5247
User log-out logic.
53-
48+
5449
:returns: Response
5550
"""
5651
logout_user()

0 commit comments

Comments
 (0)