Skip to content

Instantly share code, notes, and snippets.

@elnygren
Last active November 28, 2019 09:28
Show Gist options
  • Save elnygren/20964952008d0a8e6b1d2d12a69a7445 to your computer and use it in GitHub Desktop.
Save elnygren/20964952008d0a8e6b1d2d12a69a7445 to your computer and use it in GitHub Desktop.
Homework: Django-React-Docker

Homework assignment

Create a React/Django TodoMVC app (no need for 1:1, just similar) with a Django Rest Framework API that persists state into PostgreSQL.

Optional: The project should contain a docker-compose.yml so that docker-compose up is all that is needed for running the project. We've provided bases for docker-compose.yml and Dockerfile to help you out.

Requirements:

Bonus

  • login/logout/signup
  • user specific tasks
  • other user's can't access each others' TODOs
  • nginx in docker-compose, use it to serve static assets
  • if you want to show off something else, feel free :)

Hints:

  • You are free to use Google and some copypaste.
  • Dockerfile should start with FROM python:3.6.
    • you'll need to install dependencies and run the project with gunicorn
    • a good trick is to create start.sh that does stuff like makemigrations, collectstatic etc. and use that as the entrypoint
  • Static files:
    • figure out a way to serve static files with gunicorn or then use nginx (make it a service in docker compose)
  • If you get stuck with something, then drop that feature and do what you can
    • don't know docker/compose? manage.py runserver is better than nothing...
    • can't get DRF to work? use plain Django... ...
version: '3'
volumes:
postgres:
services:
postgres:
image: postgres:latest
...something...
app:
build: .
environment:
- foo=bar
depends_on:
- postgres
FROM python:3.6
WORKDIR /app/
# move requirements.txt
# install deps
# copy rest of code
# start.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment