2023年07月24日

FastAPI Ubuntu20.04 PostgreSQL

sudo apt update
sudo apt install postgresql postgresql-contrib  //ver12
----------------
sudo -u postgres psql

CREATE DATABASE test_2;
CREATE USER postgres WITH ENCRYPTED PASSWORD 'Psswd643';
GRANT ALL PRIVILEGES ON DATABASE test_2 TO postgres;
\q
----------------
sudo gedit /etc/postgresql/12/main/postgresql.conf

sudo service postgresql restart
----------
sudo apt install python3-pip
pip install fastapi[all] 
sudo apt install uvicorn
pip install asyncpg sqlalchemy
pip install sqlalchemy psycopg2-binary


cd f1
uvicorn main:app --host 0.0.0.0

posted by a23 at 14:50| Comment(0) | REST API