A boilerplate to deploy Django with cool stuff. Also serves as an example project from these tutorial:
- Deploy Django, Gunicorn, NGINX, Postgresql using Docker
- Serve Static Files by Nginx from Django using Docker
- Docker: Use Celery in Django(Redis as Broker)
Where it is described how this boilerplate was created from scratch so that you can build your own.
- First run
make build
inside root directory. - Then run
make up
to start up the project for first time.
To use this project, run this commands:
make build
to build the project.make up-non-daemon
to creating containers.make up
to build the project, starting containers and show logs in terminalmake start
to start containers if project has been up already.make stop
to stop containers.make restart
to restart containers.make shell-web
to shell access web container.make shell-db
to shell access db container.make shell-nginx
to shell access nginx container.make logs-web
to log access web container.make logs-db
to log access db container.make logs-nginx
to log access nginx container.make collectstatic
to put static files in static directory.make log-web
to log access web container.make log-db
to log access db container.make log-nginx
to log access nginx container.make restart
to restart containers.make tests
to run tests.make pull
to update containers.
- Install Docker Server
- Git clone project
- Create file
local.py
$ scp src/settings/env/local.text src/settings/env/local.py
- Add line
127.0.0.1 admin.localhost
to file/ets/hosts
$ sudo nano /etc/hosts
- Run the command in the project root folder to build the project
$ docker-compose build
- Next run the command to creating containers
$ docker-compose up -d
- Next run the command to init dump for domain
$ docker-compose init_dump
- Next run the command
$ docker-compose add_celery_monitor
- Next run the command to run project
$ docker-compose start
- Open browser (chrome) and go to url 'admin.localhost:8003'
- Command to stop project
$ docker-compose stop
-
Install Docker Server
-
Git clone project
-
Create file
local.py
$ scp src/settings/env/local.text src/settings/env/local.py
-
Add line
127.0.0.1 admin.localhost
to filec:\Windows\System32\Drivers\etc\hosts
-
Run the command in the project root folder to build the project
$ docker-compose build
-
Next run the command to creating containers
$ docker-compose up -d
-
Next run the command to init dump for domain
$ docker-compose init_dump
-
Next run the command
$ docker-compose add_celery_monitor
-
Next run the command to run project
$ docker-compose start
-
Open browser (chrome) and go to url 'admin.localhost:8003'
-
Command to stop project
$ docker-compose stop
- ...
$ sudo apt install apt-transport-https ca-certificates curl software-properties-common
- ...
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- ...
$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
- ...
$ sudo apt update
- ...
$ apt-cache policy docker-ce
- ...
$ sudo apt install docker-ce
- ...
$ sudo systemctl status docker
- ...
$ sudo apt install docker-compose
- Git clone project
- Create file
local.py
$ scp src/settings/env/local.text src/settings/env/local.py
- Add line
127.0.0.1 admin.localhost
to file/ets/hosts
$ sudo nano /etc/hosts
- Run the command in the project root folder to build the project
$ sudo docker-compose build
- Next run the command to creating containers
$ sudo docker-compose up -d
- Next run the command to init dump for domain
$ sudo docker-compose init_dump
- Next run the command
$ sudo docker-compose add_celery_monitor
- Next run the command to run project
$ sudo docker-compose start
- Open browser (chrome) and go to url 'admin.localhost:8003'
- Command to stop project
$ sudo docker-compose stop