From db05f917c477f27f8c54429723a6b9ba7807d5fb Mon Sep 17 00:00:00 2001 From: Paolo Cozzi Date: Thu, 26 Mar 2015 14:15:21 +0100 Subject: [PATCH] Working on docker-compose django tutorial I'm following the docker compose django documentation, to rise up a dajngo website. I've fixed a typo in compose tutorial --- compose/composetest/app.py | 5 ++--- compose/django/.gitignore | 2 ++ compose/django/Dockerfile | 11 +++++++++++ compose/django/docker-compose.yml | 12 ++++++++++++ compose/django/requirements.txt | 2 ++ 5 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 compose/django/.gitignore create mode 100644 compose/django/Dockerfile create mode 100644 compose/django/docker-compose.yml create mode 100644 compose/django/requirements.txt diff --git a/compose/composetest/app.py b/compose/composetest/app.py index 5f80c1c..2be2e7c 100644 --- a/compose/composetest/app.py +++ b/compose/composetest/app.py @@ -10,6 +10,5 @@ def hello(): redis.incr('hits') return 'Hello World! I have been seen %s times.' % redis.get('hits') - if __name__ == "__main__": - app.run(host="0.0.0.0", debug=True) - \ No newline at end of file +if __name__ == "__main__": + app.run(host="0.0.0.0", debug=True) diff --git a/compose/django/.gitignore b/compose/django/.gitignore new file mode 100644 index 0000000..7cc5304 --- /dev/null +++ b/compose/django/.gitignore @@ -0,0 +1,2 @@ +composeexample +manage.py diff --git a/compose/django/Dockerfile b/compose/django/Dockerfile new file mode 100644 index 0000000..308974b --- /dev/null +++ b/compose/django/Dockerfile @@ -0,0 +1,11 @@ + +FROM python:2.7 + +# This environment variable force stdin, stdout and stderr to be totally unbuffered +ENV PYTHONUNBUFFERED 1 + +RUN mkdir /code +WORKDIR /code +ADD requirements.txt /code/ +RUN pip install -r requirements.txt +ADD . /code/ diff --git a/compose/django/docker-compose.yml b/compose/django/docker-compose.yml new file mode 100644 index 0000000..f5b68ed --- /dev/null +++ b/compose/django/docker-compose.yml @@ -0,0 +1,12 @@ + +db: + image: postgres +web: + build: . + command: python manage.py runserver 0.0.0.0:8000 + volumes: + - .:/code + ports: + - "8000:8000" + links: + - db diff --git a/compose/django/requirements.txt b/compose/django/requirements.txt new file mode 100644 index 0000000..a4a0ad6 --- /dev/null +++ b/compose/django/requirements.txt @@ -0,0 +1,2 @@ +Django +psycopg2