PostgreSQL & Debeaver
0September 24, 2023 by zehra kaya

open terminal and run the followings
brew install postgresql@15
postgres psql
Then
in your project there must be local environment file which includes
APP_URL = http:/......:8000
DEBUG = False
APP_NAME = Example App Name
BUCKET_NAME = exampleapp
SQLALCHEMY_HOST = localhost
SQLALCHEMY_PORT = 5432
SQLALCHEMY_USER = exampleappdbuser
SQLALCHEMY_DB = exampleappdb
SQLALCHEMY_PASSWORD = exampleappdbuserpassword
JWT_SECRET_KEY = ******
SIGNING_SECRET = *****
JWT_ALGORITHM = ****
CONFIRM_CODE_EXPIRE_MINUTES = 2
JWT_ACCESS_TOKEN_EXPIRE_MINUTES = 60
AWS_ACCESS = ******
AWS_SECRET = *****
CDN_URL = https://cdn.exampleapp.app
Create Database
by using SQLALCHEMY_DB that is exampleappdb
run this code to create database named exampleappdbcreate database exampleappdb;
then
Create User
create user exampleappdbuser with encrypted password 'exampleappdbuserpassword';
Go to pycharm open terminal
run
alembic stamp head
if you get the following error ,
[SQL: CREATE TABLE alembic_version ( version_num VARCHAR(32) NOT NULL, CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num) ) ] (Background on this error at: https://sqlalche.me/e/14/f405)
run
\c exampleappdb;
on postgresql

and then
run
GRANT ALL ON SCHEMA public TO exampleappdbuser;
now you can open pycharm terminal and run followings in order
alembic revision --autogenerate
alembic upgrade head
Open Dbeaver
click this button


and click postgresql

fill in the blanks with your information

before finishing it, click on Test Connection at the left bottom.
Category Programming | Tags:
Leave a Reply