Skip to content

JuanBindez/CRUD-postgreSQL-Flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD-postgreSQL-Flask

Install requirements:

pip install -r requirements.txt

DataBase

install postgresql on linux

 sudo apt update
 sudo apt install postgresql postgresql-contrib

install flask and psycopg2 connector

 pip install Flask psycopg2-binary

access postgre

sudo -i -u postgres
psql

run superuser settings

CREATE USER myuser WITH PASSWORD 'mypassword';
ALTER USER myuser WITH SUPERUSER;
CREATE DATABASE mydatabase;
GRANT ALL PRIVILEGES ON DATABASE mydatabase TO myuser;
\q

to see existing databases

\l

database access

c\ mydatabase

verify useruser

sudo -i -u postgres
psql
\dn+

exit of the shell from postgreSQL

\q
exit

run scripts PostgreSQL

psql -h localhost -U postgres -d my_database < schema.sql