This app provides an API with information about all your favorite cat breeds!
- Must have Python 3 & Postgres version 12.x installed and running
django-admin startproject CoduCats
- Create a virtual environment:
python -m venv venv
- Go into your virtual environment:
source venv/bin/activate
- Rename the CoduCats folder to config
- Setup Postgres in Django:
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'coducat',
'USER': 'cc_admin',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '',
}
- 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'
- Setup Database in Postgres
- Create the database:
CREATE DATABASE coducat;
- Create DB user: `CREATE USER cc_admin;
- Grant privilages to user for our database:
GRANT ALL PRIVILEGES ON DATABASE coducat TO cc_admin;
- Run migrations:
python manage.py migrate
- Create the database:
- Create an admin user for logging into the Django admin interface:
python manage.py createsuperuser
- Run the app:
python manage.py runserver
- View the API at
localhost:8000
and the admin interface atlocalhost:8000/admin
- Create apps for Pages and for Breeds
- Setup URLs
- Setup templates for home page:
'DIRS': [os.path.join(BASE_DIR, 'apps/templates')]
- Create Models
- Setup Admin interface
- Setup Views
- Setup nested routes:
rest_framework_nested
- Pagination
- Timestamp util for models
/
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
Breed
- name
- origin
- body_type
- coat_length
- pattern
Locations
- name
- breed