Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0800e8

Browse files
author
rafgger
committed
working postgres version
1 parent 98d4ea3 commit f0800e8

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

‎README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
# Build a CRUD App with FastAPI and SQLAlchemy
2+
# backend
3+
have docker open
4+
use bash:
5+
6+
activate virtual env: venv\Scripts\activate.bat
7+
8+
install all missing packages
9+
10+
uvicorn app.main:app --reload
11+
12+
open on: http://127.0.0.1:8000/docs
13+
14+
docker: docker-compose up -d
15+
216

317
In this article, I'll provide you with a simple and straightforward guide on how you can build a CRUD app with FastAPI and SQLAlchemy. The FastAPI app will run on a Starlette web server, use Pydantic for data validation, and store data in an SQLite database.
418

‎app/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from pydantic import BaseSettings
1+
from pydantic_settings import BaseSettings
2+
from dotenv import load_dotenv
3+
4+
load_dotenv() # Explicitly load the .env file
25

36

47
class Settings(BaseSettings):

‎requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ orjson #==3.8.1
1919
psycopg2 #==2.9.5
2020
pycodestyle #==2.9.1
2121
pydantic #==1.10.2
22+
pydantic-settings ###########
2223
python-dotenv #==0.21.0
2324
python-multipart #==0.0.5
2425
PyYAML #==6.0
2526
requests #==2.28.1
2627
six #==1.16.0
2728
sniffio #==1.3.0
28-
SQLAlchemy #==1.4.42
29+
SQLAlchemy<2.0## needs to be downgraded #==1.4.42
2930
starlette #==0.20.4
3031
tomli #==2.0.1
3132
typing_extensions #==4.4.0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /