- clone the project with the command
git clone https://github.com/ksea-cal/ksea-web-api.git
- cd into the KSEA_web_api folder
cd ksea-web-api
- check you have virtualenv in your computer
virtualenv --version
if you don't have virtualenv, download with the command
sudo pip3 install virtualenv
- create a virtualenv with the command
virtualenv venv --python=python3.8
- check you have homebrew on your computer
brew --version
- if you do not, download homebrewbrew
- download postgres on your computer if you don't have postgres
brew install postgres
- activate the virtualenv with the command
source ./venv/bin/activate
- install dependencies with the command
pip install -r requirements.txt
- install postgres if you have not previously.
- Start postgres on your computer.
brew services start postgresql
- start postgres with root privileges
psql postgres
- create new user kseaapiuser with password "welikeksea", and give createDB access.
CREATE ROLE kseaapiuser WITH LOGIN PASSWORD 'welikeksea';
ALTER ROLE kseaapiuser CREATEDB;
- quit and log in with the new user.
\q
psql postgres -U kseaapiuser
- create database kseadev in local postgres.
CREATE DATABASE kseadev;
- now get out of postgres try to run the command
python manage.py runserver --settings=config.settings.local
- if it worked successfully, run the command
python manage.py migrate --settings=config.settings.local
REFERENCES: https://www.tutorialspoint.com/postgresql/postgresql_create_database.htm https://medium.com/@viviennediegoencarnacion/getting-started-with-postgresql-on-mac-e6a5f48ee399#:~:text=%60psql%60%20on%20Terminal,postgresql)%20%2C%20then%20run%20psql%20. https://www.guru99.com/postgresql-create-database.html
#GENERALS
- start postgresql server
brew services start postgresql
- start virtualenv
source ./venv/bin/activate
- run the command
python manage.py runserver
python manage.py model_loader
- create a new git branch (start from master branch)
git checkout -b [BRANCH NAME]
- time to time, rebase from master
git checkout master
git pull
git checkout [BRANCH NAME]
git rebase master
- push to remote branch
git add .
git commit -am [YOUR COMMIT MESSAGE]
git push origin [BRANCH NAME]
- go to the github repo and create a PR request
- Commit messages
- Use github commit message guideline for formatting commit messages.
- Coding conventions
- We follow PEP8 style guidelines for coding in Python.
- We try to follow conventions listed in the book "Two Scoops of Django".
- never change the data in the migrations folder.
- never run makemigrations or migrate unless confirmed.