jefftriplett / docker-hogwarts

Try Docker for yourself by checking out this repository!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-hogwarts

Try Docker for yourself by checking out this repository!

What to do:

  1. Download Docker
  2. Download Docker Compose (If not on a Mac)
  3. Fork this repo into your own GitHub space
  4. Clone this repo onto your own machine

Run the project (Lumos)

docker-compose up 

Notice how two services are created: db_1 and web_1. See that migrations run and the server starts.

Create a superuser

In a new tab, run:

docker-compose run web --manage.py createsuperuser 

Create sample data

Log into the admin at http://localhost:8000/admin/ and add some content.

Visit http://localhost:8000/spells/ to see a list of your data, and http://localhost:8000/spells/{pk}/ to see a detail view of your data.

More ideas

Migrations

Add new features to the Spell model, or add a new model or app.

Run

docker-compose run --rm web ./manage.py makemigrations 

And then run

docker-compose run --rm web ./manage.py migrate 

Django Shell (Apparate)

Hop into the shell with

docker-compose run --rm web ./manage.py shell 

And experiment with poking around by importing a model and running queries on it.

Add a new requirement

Update your requirements file with something like requests or another library you love. Stop Docker, then restart with:

docker-compose up --build 

See your images (Imago Revelio)

docker images 

See your running containers (Continens Revelio)

docker container ls 

or

docker ps 

Stop for the day (Nox)

docker-compose down 

Enrichment exercises

  1. Build your image from scratch and give it a name
  2. "Exec" into the Docker container with docker exec --it
  3. Stop and restart just the web container
  4. Add a new service to docker-compose.yml; maybe Redis?
  5. Add a data volume so your data persists between coding sessions
  6. Add tests and run them using docker-compose run commands

Resources

This repo uses the Git Commit Message StyleGuide.

About

Try Docker for yourself by checking out this repository!

License:MIT License


Languages

Language:Python 95.0%Language:HTML 5.0%