Skip to content

Commit bd19480

Browse files
committed
Add gunicorn support; bump Python to 3.12; bump dependencies.
1 parent b31f7bd commit bd19480

File tree

7 files changed

+94
-809
lines changed

7 files changed

+94
-809
lines changed

Makefile

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,19 @@ lint: env
7676

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

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Flask-Login Tutorial
22

33
![Python](https://img.shields.io/badge/Python-v3.10-blue.svg?logo=python&longCache=true&logoColor=white&colorB=5e81ac&style=flat-square&colorA=4c566a)
4-
![Flask](https://img.shields.io/badge/Flask-v3.0.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
4+
![Flask](https://img.shields.io/badge/Flask-v3.1.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.3-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
66
![Flask-Assets](https://img.shields.io/badge/Flask--Assets-v2.1.0-blue.svg?longCache=true&logo=flask&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
7-
![Flask-WTF](https://img.shields.io/badge/Flask--WTF-v1.2.1-blue.svg?longCache=true&logo=python&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
7+
![Flask-WTF](https://img.shields.io/badge/Flask--WTF-v1.2.2-blue.svg?longCache=true&logo=python&style=flat-square&logoColor=white&colorB=5e81ac&colorA=4c566a)
88
![Flask-SQLAlchemy](https://img.shields.io/badge/Flask--SQLAlchemy-v3.1.1-red.svg?longCache=true&style=flat-square&logo=scala&logoColor=white&colorA=4c566a&colorB=bf616a)
99
![GitHub Last Commit](https://img.shields.io/github/last-commit/google/skia.svg?style=flat-square&colorA=4c566a&colorB=a3be8c&logo=GitHub)
1010
[![GitHub Issues](https://img.shields.io/github/issues/toddbirchard/flasklogin-tutorial.svg?style=flat-square&colorA=4c566a&logo=GitHub&colorB=ebcb8b)](https://github.com/toddbirchard/flasklogin-tutorial/issues)
@@ -16,7 +16,7 @@
1616
Add user authentication to your Flask app.
1717

1818
* **Tutorial**: [https://hackersandslackers.com/flask-login-user-authentication/](https://hackersandslackers.com/flask-login-user-authentication/)
19-
* **Demo**: [https://flasklogin.hackersandslackers.app](https://flasklogin.hackersandslackers.app)
19+
* **Demo**: [https://flasklogin.hackersandslackers.com](https://flasklogin.hackersandslackers.com)
2020

2121
## Getting Started
2222

@@ -41,7 +41,8 @@ Get up and running with `make deploy`:
4141
```shell
4242
git clone https://github.com/toddbirchard/flasklogin-tutorial.git
4343
cd flasklogin-tutorial
44-
make deploy
44+
make install
45+
make run
4546
```
4647

4748
-----

flask_login_tutorial/static/src/less/account.less

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
background: white;
1313
width: 370px;
1414
max-width: 470px;
15-
margin: 80px auto 0;
15+
margin: 60px auto 0;
1616
box-shadow: @box-shadow;
17-
padding: 50px;
17+
padding: 40px;
1818

1919
@media (max-width: 600px) {
2020
width: auto;
@@ -25,7 +25,7 @@
2525

2626
.logo {
2727
text-align: center;
28-
margin: 0 auto 20px;
28+
margin: 0 auto 15px;
2929

3030
img {
3131
width: 50px;
@@ -90,7 +90,7 @@
9090
font-weight: 300;
9191
border-bottom: 1px solid #dee2ef;
9292
padding-bottom: 5px;
93-
margin-bottom: 20px;
93+
margin: 15px auto;
9494
font-family: @body-font;
9595

9696
@media (max-width: 600px) {
@@ -150,7 +150,7 @@
150150
label {
151151
font-size: .9em;
152152
color: @header-color;
153-
margin-bottom: 5px;
153+
margin-bottom: 3px;
154154
display: block;
155155
font-weight: 300;
156156
font-family: @body-font;

gunicorn.conf.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""Gunicorn configuration file."""
2+
3+
from os import environ, path
4+
5+
from dotenv import load_dotenv
6+
7+
# Read environment variables from ".env" file.
8+
basedir = path.abspath(path.dirname(__file__))
9+
load_dotenv(path.join(basedir, ".env"))
10+
11+
# Fetch deployment environment from environment variables.
12+
ENVIRONMENT = environ.get("ENVIRONMENT")
13+
14+
proc_name = "flasklogin"
15+
wsgi_app = "wsgi:app"
16+
bind = "unix:flask.sock"
17+
threads = 4
18+
workers = 2
19+
20+
if ENVIRONMENT == "development" or ENVIRONMENT is None:
21+
reload = True
22+
workers = 1
23+
threads = 1
24+
bind = ["127.0.0.1:8000"]
25+
elif ENVIRONMENT == "production":
26+
daemon = True
27+
accesslog = "/var/log/flasklogin/access.log"
28+
errorlog = "/var/log/flasklogin/error.log"
29+
loglevel = "trace"
30+
dogstatsd_tags = "env:prod,service:flasklogin,language:python"
31+
else:
32+
raise ValueError(f"Unknown environment provided: `{ENVIRONMENT}`. Must be `development` or `production`.")

0 commit comments

Comments
 (0)