Skip to content

ksea-cal/ksea-web-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KSEA_WEB_API

SETUP

INSTALLATION SETUP

  1. clone the project with the command
git clone https://github.com/ksea-cal/ksea-web-api.git
  1. cd into the KSEA_web_api folder
cd ksea-web-api
  1. check you have virtualenv in your computer
virtualenv --version

if you don't have virtualenv, download with the command

sudo pip3 install virtualenv
  1. create a virtualenv with the command
virtualenv venv --python=python3.8
  1. check you have homebrew on your computer
brew --version
  1. if you do not, download homebrewbrew
  1. download postgres on your computer if you don't have postgres
brew install postgres
  1. activate the virtualenv with the command
source ./venv/bin/activate
  1. install dependencies with the command
pip install -r requirements.txt

DATABASE SETUP

  1. install postgres if you have not previously.
  2. Start postgres on your computer.
brew services start postgresql
  1. start postgres with root privileges
psql postgres
  1. create new user kseaapiuser with password "welikeksea", and give createDB access.
CREATE ROLE kseaapiuser WITH LOGIN PASSWORD 'welikeksea';
ALTER ROLE kseaapiuser CREATEDB;
  1. quit and log in with the new user.
\q
psql postgres -U kseaapiuser
  1. create database kseadev in local postgres.
CREATE DATABASE kseadev;
  1. now get out of postgres try to run the command
python manage.py runserver --settings=config.settings.local
  1. 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

RUNNING

  1. start postgresql server
brew services start postgresql
  1. start virtualenv
source ./venv/bin/activate
  1. run the command
python manage.py runserver

POPULATE MODELS

python manage.py model_loader

GIT

  1. create a new git branch (start from master branch)
git checkout -b [BRANCH NAME]
  1. time to time, rebase from master
git checkout master
git pull
git checkout [BRANCH NAME]
git rebase master
  1. push to remote branch
git add .
git commit -am [YOUR COMMIT MESSAGE]
git push origin [BRANCH NAME]
  1. go to the github repo and create a PR request

FORMATTING

  1. Commit messages
  1. Coding conventions
  • We follow PEP8 style guidelines for coding in Python.
  • We try to follow conventions listed in the book "Two Scoops of Django".

CAUTION

  • never change the data in the migrations folder.
  • never run makemigrations or migrate unless confirmed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages