Skip to content

gwenf/codu-cats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b50d7bf · Oct 15, 2020

History

6 Commits
Oct 15, 2020

Repository files navigation

Codú Cats

This app provides an API with information about all your favorite cat breeds!

Setup Steps

Part 1

  1. Must have Python 3 & Postgres version 12.x installed and running
  2. django-admin startproject CoduCats
  3. Create a virtual environment: python -m venv venv
  4. Go into your virtual environment: source venv/bin/activate
  5. Rename the CoduCats folder to config
  6. Setup Postgres in Django:
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'coducat',
    'USER': 'cc_admin',
    'PASSWORD': '',
    'HOST': 'localhost',
    'PORT': '',
}
  1. Setup custom User model and custom user manager: https://docs.djangoproject.com/en/3.1/topics/auth/customizing/#a-full-example
AUTH_USER_MODEL = 'users.User'
  1. Setup Database in Postgres
    1. Create the database: CREATE DATABASE coducat;
    2. Create DB user: `CREATE USER cc_admin;
    3. Grant privilages to user for our database: GRANT ALL PRIVILEGES ON DATABASE coducat TO cc_admin;
    4. Run migrations: python manage.py migrate
  2. Create an admin user for logging into the Django admin interface: python manage.py createsuperuser
  3. Run the app: python manage.py runserver
  4. View the API at localhost:8000 and the admin interface at localhost:8000/admin

Part 2

  1. Create apps for Pages and for Breeds
  2. Setup URLs
  3. Setup templates for home page: 'DIRS': [os.path.join(BASE_DIR, 'apps/templates')]
  4. Create Models
  5. Setup Admin interface
  6. Setup Views

Part 3

  1. Setup nested routes: rest_framework_nested
  2. Pagination
  3. Timestamp util for models

API

/

Landing Page

/api/breeds & /api/breeds/:id

Resource and items for breeds

/api/breeds/:id/locations & /api/breeds/:id/locations/:location_id

Locations for specific breeds

Schema

Breed

  • name
  • origin
  • body_type
  • coat_length
  • pattern

Locations

  • name
  • breed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published