Backend Setup :
Be carefull with python version. Always using environment like anaconda/miniconda/virtualenv for setup backend. Don't forget to activate environment.
Want to contribute? Great!
Create python env using miniconda/anaconda
conda create --name personal-blog-api
Activate python env
conda activate personal-blog-api
Note: activate environment and set python interpreter to your environment. if using vscode do
ctrl+shift+pthen writepython interpreter, after that select the right environment After select python interpreter, kill terminal in vscode then add terminal to prevent environment still work in global
generate private key
openssl genrsa -out private.pem 2048
generate public key
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
generate private key for refresh
openssl genrsa -out private-refresh.pem 2048
Add database image in docker with phpmyadmin
docker-compose -f docker-compose.dev.yml up --build -d
Alternate way : just install mysql in your local
Duplicate alembic.ini.example and renamed it to alembic.ini
Fill this variable in alembic.ini
sqlalchemy.url = mysql+pymysql://{username}:{password}@{host}:{port}/{database}
Duplicate .env.example and renamed it to .env
Fill this variable in .env
DB="mysql+pymysql://{username}:{password}@{host}:{port}/{database}"
Install package
pip install -r requirements.txt
Running migration table
alembic upgrade head
Running Application
uvicorn main:app --reload
Look endpoint list in Swagger Documentation
http://localhost:8000/docs
Up docker
docker-compose up -d --build
Use option --build for first time only or if there a new package
Look endpoint list in local Swagger Documentation (Production)
http://localhost:8120/docs
Should be restart docker if there area updated code in production