Skip to content

Files

Latest commit

 

History

History
81 lines (56 loc) · 1.18 KB

README.md

File metadata and controls

81 lines (56 loc) · 1.18 KB

Virtual Python School

Requirements

  • Python 3.9+
  • Node.js 16+
  • MySQL Server
  • local container (lxc)

Installation

pip install -r requirements.txt
cd Front-End/
npm i

Pre-requisites

Create .env file with the following variables:

SQLALCHEMY_DATABASE_URI="mysql+mysqlconnector://yourdbusername:yourdbpassword@localhost/yourdb"
JWT_SECRET_KEY="yoursecrect"

Run back-end

uvicorn app.main:app --reload --port 5000

Testing

pytest

Production deployment

Killing

pm2 delete all
pkill gunicorn

Pulling

cd /var/www
git pull

cd Front-End/
npm i
npm run build
pm2 start npm --name "virtual-school" -- start

cd Back-End/
gunicorn --worker-class uvicorn.workers.UvicornWorker --daemon --bind 0.0.0.0:5000 app.main:app

Updating the database

Back-End

Creating migration first time

alembic init alembic
alembic revision --autogenerate -m "init"

Updating

If you add a new db model you have to add new import in Back-End/alembic/env.py then you can run:

alembic revision --autogenerate -m "new changes"
alembic upgrade head