This project uses Poetry for managing and installing Python dependencies, make sure you have it installed. After that, you can run the following commands to bootstrap your development environment
git clone https://github.com/oscarine/oscarine-apicd oscarine-apipython3 -m venv venvsource venv/bin/activatepoetry installcp .env.example .envuvicorn app.main:app --reload
From now, commands starting with $ are shell commands, # for SQL commands and // for explanatory comments
Run the following commands to setup your database
- First download and install the postgresql database
$ sudo apt-get update
$ sudo apt-get install postgresql postgresql-contrib libssl-dev
- Now create the database. For that we first open the psql shell. Go to the directory where your postgres file is stored
// For linux users
$ sudo -u postgres psql
// For macOS users
$ psql -d postgres
- Create database
oscarine_dbwith owneroscarine
# CREATE USER oscarine WITH PASSWORD 'password';
# CREATE DATABASE oscarine_db WITH OWNER oscarine;
- Now make user
oscarineSUPERUSER
# ALTER USER oscarine WITH SUPERUSER;
- Now we need extension called
postgis(install it from here) - We can now create this extension for our database
oscarine_db
// Get inside `oscarine_db` shell
$ sudo -u postgres psql -d oscarine_db
# CREATE EXTENSION postgis;
// Now verify postgis extension
# SELECT postgis_full_version();
- Now, inside our project directory we can run migrations using alembic
$ alembic upgrade head
- If you have not followed the above commands exactly please edit the
.envfile accordingly.
- Install pre-commit at
.git/hooks/pre-commit
$ pre-commit install
- We can autogenerate revision file whenever we change the database schema
$ alembic revision --autogenerate -m "Your revision message"
- Then we can apply those changes to the database
$ alembic upgrade head
For contributing to Oscarine-API, please fork the project first and then clone your fork.