/cookie-stand-api

Lab: 34 API Deployment

Primary LanguagePython

Lab - Class 34: API Deployment

Project: cookie-stand-api

Author: Matt Rangel

Date: 6/2/2022

Links and Resources

Setup from template

  • clone down template
  • rename .env_sample to .env
  • docker compose run web bash
  • copy and paste/typepython -c 'import secrets; print(secrets:token_urlsafe()
  • Grab the key, update .env file with secret_key
  • run docker compose up
  • docker compose run web bash
  • python manage.py showmigrations
  • docker compose up --build
  • python manage.py migrate
  • python manage.py runserver
  • python manage.py startapp <app name>
  • python manage.py makemigrations <app name>
  • python manage.py migrate
    • python manage.py createsuperuser
    • UserName: <admin name>
    • password: <password>
  • python manage.py runserver

Heroku Setup

  • Set up Heroku with environment variables in settings > config vars
  • complete acp to main
  • heroku apps:create <project repo name>
  • heroku stack:set container
  • git push heroku main
  • heroku restart # to quickly restart the app