mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-08-05 20:50:17 +03:00
Docker Compose development environment
Vagrant support was dropped in favor of Docker based development environments, but no replacement was provided. This should do.
This commit is contained in:
parent
d282b77eb3
commit
b178265cea
|
@ -33,7 +33,7 @@ Chris Franklin
|
||||||
Benjamin Abel
|
Benjamin Abel
|
||||||
Felipe Arruda / @arruda
|
Felipe Arruda / @arruda
|
||||||
Matt Warren / @mfwarren
|
Matt Warren / @mfwarren
|
||||||
Martin Blech
|
Martin Blech / @martinblech
|
||||||
Andy Rose
|
Andy Rose
|
||||||
Andrew Mikhnevich / @zcho
|
Andrew Mikhnevich / @zcho
|
||||||
Kevin Ndung'u / @kevgathuku
|
Kevin Ndung'u / @kevgathuku
|
||||||
|
|
16
README.rst
16
README.rst
|
@ -149,6 +149,22 @@ To get live reloading to work you'll probably need to install an `appropriate br
|
||||||
|
|
||||||
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
|
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
|
||||||
|
|
||||||
|
**Running in an isolated Docker development environment**
|
||||||
|
|
||||||
|
If you would rather run your application inside a separate Docker environment and avoid installing Postgres or any dependencies in your host OS, you can use the included Docker Compose configuration (``Dockerfile`` and ``docker-compose.yml``).
|
||||||
|
|
||||||
|
Make sure that Docker_ is installed. In the project root run::
|
||||||
|
|
||||||
|
$ docker-compose up
|
||||||
|
|
||||||
|
.. _Docker: https://docs.docker.com/installation/
|
||||||
|
|
||||||
|
This command will download all the necessary dependencies and start your project. The first time, you will also need to run the following command to initialize the database::
|
||||||
|
|
||||||
|
$ docker-compose web python manage.py migrate
|
||||||
|
|
||||||
|
If you're on OS X or Windows, run ``boot2docker ip`` to find out Docker's IP, otherwise it's localhost. Hit ``http://<docker_host>:8000/`` with your browser and you're ready to go.
|
||||||
|
|
||||||
It's time to write the code!!!
|
It's time to write the code!!!
|
||||||
|
|
||||||
For Readers of Two Scoops of Django 1.8
|
For Readers of Two Scoops of Django 1.8
|
||||||
|
|
10
{{cookiecutter.repo_name}}/Dockerfile
Normal file
10
{{cookiecutter.repo_name}}/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Only intended for development purposes.
|
||||||
|
# For production deployment options, see the Deployment section in
|
||||||
|
# README.rst
|
||||||
|
|
||||||
|
FROM python:3.4
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
RUN mkdir /code
|
||||||
|
WORKDIR /code
|
||||||
|
ADD . /code/
|
||||||
|
RUN pip install -r requirements/local.txt
|
|
@ -78,6 +78,22 @@ To get live reloading to work you'll probably need to install an `appropriate br
|
||||||
|
|
||||||
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
|
.. _appropriate browser extension: http://feedback.livereload.com/knowledgebase/articles/86242-how-do-i-install-and-use-the-browser-extensions-
|
||||||
|
|
||||||
|
**Running in an isolated Docker development environment**
|
||||||
|
|
||||||
|
If you would rather run your application inside a separate Docker environment and avoid installing Postgres or any dependencies in your host OS, you can use the included Docker Compose configuration (``Dockerfile`` and ``docker-compose.yml``).
|
||||||
|
|
||||||
|
Make sure that Docker_ is installed. In the project root run::
|
||||||
|
|
||||||
|
$ docker-compose up
|
||||||
|
|
||||||
|
.. _Docker: https://docs.docker.com/installation/
|
||||||
|
|
||||||
|
This command will download all the necessary dependencies and start your project. The first time, you will also need to run the following command to initialize the database::
|
||||||
|
|
||||||
|
$ docker-compose web python manage.py migrate
|
||||||
|
|
||||||
|
If you're on OS X or Windows, run ``boot2docker ip`` to find out Docker's IP, otherwise it's localhost. Hit ``http://<docker_host>:8000/`` with your browser and you're ready to go.
|
||||||
|
|
||||||
It's time to write the code!!!
|
It's time to write the code!!!
|
||||||
|
|
||||||
|
|
||||||
|
|
17
{{cookiecutter.repo_name}}/docker-compose.yml
Normal file
17
{{cookiecutter.repo_name}}/docker-compose.yml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# Only intended for development purposes.
|
||||||
|
# For production deployment options, see the Deployment section in
|
||||||
|
# README.rst
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
web:
|
||||||
|
build: .
|
||||||
|
command: python manage.py runserver_plus 0.0.0.0:8000
|
||||||
|
volumes:
|
||||||
|
- .:/code
|
||||||
|
ports:
|
||||||
|
- "8000:8000"
|
||||||
|
links:
|
||||||
|
- db
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:postgres@db/postgres
|
Loading…
Reference in New Issue
Block a user