You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+20-12
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
1
### Django tutorial using Docker, Nginx, Gunicorn and PostgreSQL.
2
2
3
-
Trying to learn Django, Gunicorn, Docker and Nginx all at the same time?
4
-
This is the right repo!
3
+
This is Django tutorial in steroids, I wanted to go through the tutorial using a configuration that is more close to production.
4
+
5
+
I am running the django app with gunicorn, using postgres as the database, the django app is behind nginx and everything is running out of Docker containers orchastrated with docker-compose.
5
6
6
7
At the moment I am in the [Part 2 of Django tutorial](https://docs.djangoproject.com/en/1.8/intro/tutorial02/), will continue the quest and update the git repo accordingly. (Getting docker-compose and nginx right took some time)
7
8
@@ -12,7 +13,7 @@ I am running this on a Macbook air running Yosemite with boot2docker.
12
13
1. git clone this repo
13
14
2. boot2docker up
14
15
3. sh rebuild_docker.sh
15
-
4. run migrations in your Django instance: docker-compose run django /bin/sh -c 'cd mysite;python manage.py migrate'
16
+
4. run migrations in your Django instance: ```docker-compose run django /bin/sh -c 'cd mysite;python manage.py migrate'```
16
17
5. access it in your browser! http://192.168.59.103/ for me, run boot2docker ip to know where it is running.
@@ -21,21 +22,28 @@ Compose is a tool for defining and running multi-container applications with Doc
21
22
https://docs.docker.com/compose/
22
23
23
24
We have three containers: Nginx, Postgres and a Django App.
25
+
24
26
* django
25
-
Built from ./Dockerfile, running gunicorn to serve our django app.
27
+
28
+
- Built from ./Dockerfile, running gunicorn to serve our django app.
29
+
26
30
* postgres
27
-
Just the basic image from DockerRegistry
31
+
- Just the basic image from DockerRegistry.
32
+
28
33
* nginx
29
-
We are building it from nginx/Dockerfile, in our nginx/nginx.conf we are basically bypassing django and serving static files which gunicorn doesn't do for us.
34
+
-We are building it from nginx/Dockerfile. In our nginx/nginx.conf we are basically proxying django to gunicorn and serving static files which gunicorn doesn't do for us.
30
35
31
36
#### rebuild_docker.sh
32
37
Created to make life easier:
33
-
1. docker-compose build
34
-
Builds your docker-compose file
35
-
2. docker-compose up -d
36
-
Runs your containers on detached mode
37
-
3. docker-compose ps
38
-
Check if they are all running
38
+
39
+
1. Build your docker-compose file.
40
+
- docker-compose build
41
+
42
+
2. Runs your containers on detached mode.
43
+
- docker-compose up -d
44
+
45
+
3. Check if they are all running.
46
+
- docker-compose ps
39
47
40
48
#### Important
41
49
This project first started as me following the awesome introduction from Andrew T. Baker at the PyCon US 2015 [link](http://docker.atbaker.me/)
0 commit comments