Code 401 Class 29(But really Reading 31) Reading Notes
Beginner’s Guide to Docker
With Docker, you can have an entire development environment isolated: programming languages, software packages, databases, and more.
Docker is Linux containers, which are a type of virtualization.
- Upside, everyone on the same virtual machine
- Downside, size and speed
-
Create an isolated box for individual projects, so one can use Python 2.7 and Django 1.5 while another can use Python 3.5 and Django 2.1 on the same computer.
docker container ls: only running containers will appear.Dockerfileis like a recipe for a cake- image is a snapshot of the recipe at a given time
docker-compose.ymlsays how to make the cake- container is the actual, baked cake
- Dockerfiles are read from top to bottom
FROMmust be the first instruction which lets us import a base image to use for our image.
To build containers, install [Pipenv](https://djangoforbeginners.com/initial-setup/)
- mkdir djangoapp && cd djangoapp
- pipenv install django==3.0
-
pipenv shell
- Docker is a way to run Linux containers
- Containers are a lightweight alternative to Virtual Machines
Dockerfileis a list of instructions for creating an image- Images are made up of one ore more layers
- Containers are running instance of an image
docker-compose.ymlcontrols how to run the container- Containers are stateless and ephemeral in nature. We can link the local filesustem via
volumesbut things become more complex with databases.
Django for APIs - Library Website
__init__.pyindicates that the files in the folder are part of a Python package. Without this file, we cannot import files from another directoryasgi.pyallows for an optional Asynchronous Server Gateway Interface to be runsettings.pycontrols our Django project’s overall settingsurls.pytells Django which pages to build in response to a browser or URL requestwsgi.pystand for Web Server Gateway Interface which helps Django serve our eventual web pages.
Things I want to know more about
How do you have auto template support when creating Django files?