Skip to content

Commit 6408756

Browse files
committed
Use Flask instead of FastAPI
Not really a need for a full-fledge API anymore, and FastAPI struggles with custom Pydantic validation in query string
1 parent e37a825 commit 6408756

21 files changed

+544
-550
lines changed

.flaskenv

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FLASK_APP=business_card_generator.app:create_app()

Pipfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ verify_ssl = true
44
name = "pypi"
55

66
[packages]
7-
fastapi = "==0.75.0"
7+
flask = "==2.0.3"
88
gunicorn = "==20.1.0"
99
honcho = "==1.1.0"
1010
jinja2 = "==3.0.3"
1111
pydantic = {extras = ["email"],version = "==1.9.0"}
1212
segno = "==1.4.1"
13-
uvicorn = "==0.17.6"
13+
whitenoise = "==6.0.0"
1414

1515
[dev-packages]
1616
bandit = "==1.7.4"

Pipfile.lock

+25-49
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: gunicorn --name=business-card-generator --worker-class=uvicorn.workers.UvicornWorker --access-logfile=- --error-logfile=- --forwarded-allow-ips="*" business_card_generator.asgi:app
1+
web: gunicorn --name=business-card-generator --access-logfile=- --error-logfile=- business_card_generator.wsgi:app

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ cp .example.env .env
3030
pipenv install -d
3131
pipenv shell
3232
inv qa
33+
flask run
3334
```
3435

3536
### VSCode
@@ -41,13 +42,17 @@ If using VSCode, use the following configuration in `.vscode/launch.json`:
4142
"version": "0.2.0",
4243
"configurations": [
4344
{
44-
"name": "Python: FastAPI",
45+
"name": "Python: Flask",
4546
"type": "python",
4647
"request": "launch",
47-
"module": "uvicorn",
48-
"args": ["--port=8000", "--factory", "business_card_generator.app:create_app"],
49-
"envFile": "",
48+
"module": "flask",
49+
"env": {
50+
"FLASK_APP": "business_card_generator.app:create_app",
51+
"FLASK_ENV": "development"
52+
},
53+
"args": ["run", "--no-debugger"],
5054
"jinja": true,
55+
"envFile": "",
5156
"justMyCode": false
5257
},
5358
{

app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Everyone needs a business card",
44
"website": "https://business-card-generator.vercel.app",
55
"repository": "https://github.com/rclement/business-card-generator",
6-
"keywords": ["python", "fastapi", "qrcode"],
6+
"keywords": ["python", "flask", "qrcode", "vcard", "mecard"],
77
"env": {
88
"FORCE_HTTPS": {
99
"description": "Force HTTPS redirect",

business_card_generator/api.py

-104
This file was deleted.

0 commit comments

Comments
 (0)