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 buildinside root directory. - Then run
make upto start up the project for first time.
To use this project, run this commands:
make buildto build the project.make up-non-daemonto creating containers.make upto build the project, starting containers and show logs in terminalmake startto start containers if project has been up already.make stopto stop containers.make restartto restart containers.make shell-webto shell access web container.make shell-dbto shell access db container.make shell-nginxto shell access nginx container.make logs-webto log access web container.make logs-dbto log access db container.make logs-nginxto log access nginx container.make collectstaticto put static files in static directory.make log-webto log access web container.make log-dbto log access db container.make log-nginxto log access nginx container.make restartto restart containers.make teststo run tests.make pullto 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.localhostto 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.localhostto 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.localhostto 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