Skip to content
Django development/production environment with docker
Python HTML JavaScript CSS Nginx Shell Vim script
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
hooks react and translation false code fix Oct 9, 2016
tests
{{cookiecutter.repo_name}} version updates Oct 9, 2016
.gitignore gitignore remove unnecessary ignore lines Feb 8, 2016
.travis.yml added test environment with coverage + requirement cleanup Feb 14, 2016
README.md README improvement Sep 12, 2016
cookiecutter.json cookiecutter help text + .eslintrc update Mar 8, 2016
req-packages.txt version updates Oct 9, 2016
req-test.txt version updates Oct 9, 2016

README.md

django-docker-bootstrap

Requirements Status Build Status Dependency Status postgres nginx

Concept

A cookiecutter template for Django/Nodejs(React)/Nginx/Postgres. The main idea behind this project to create an easily configurable and easy to use django development/production environment for any project.

Installation

  • Docker requires a 64-bit OS.
  • Install the docker(1.12.1) - https://docs.docker.com/engine/installation/
  • docker-compose(1.8.0) - pip install docker-compose
  • Requirements for cookiecutter: apt-get install python-dev
  • Then get cookiecutter: pip install Markdown cookiecutter
  • Finally enter the directory where you want to store your project and enter the following: * cookiecutter https://github.com/legios89/django-docker-bootstrap.git

Cookiecutter params

  • project_name: The name of the project.
  • repo_name: The directory name(automtically generated from the project_name).
  • db_password: The postgres user password for the database.
  • use_translation: Translation integration(Rosetta, ModelTransalation, admin integration).
  • use_react: React, NodeJS, React-Router to replace the django frontend.
  • admin_name: The name of the admin user who will receive the error messages.
  • admin_email: The email address of the admin user who will receive the error messages.
  • email_host_user: The gmail email address what the system can use to send emails.
  • email_host_password: The gmail email address password what the system can use to send emails.

Usage

  • Build the images: bash buildall.sh
  • Start the project: docker-compose up
  • You can set every secret variable in the .secret in the root
  • If you want to run the project in production mode you need to set the following environment variable:

Tips & Tricks

Volumes

  • The data volume, automatically created on the first start, which will contains every data.
  • You can find it in every container in here: /data/

Images

  1. postgres
  • postgresql-9.4
  • The 5433 port is open by default if you want to connect the db with a client
  • Commands:
    • start - start the database
    • shell - start a bash shell dc run --rm postgres shell
    • backup - create a backup (/data/backup/<backup_name>) dc run --rm postgres backup
    • restore - restore from a backup (/data/backup/<backup_name>) dc run --rm postgres restore
  1. django-python3
  • The projects can be found under the /src/ directory
  • Installed Apps:
    • Django: 1.10.1
    • uWSGI: 2.0.13.1
    • psycopg2: 2.6.2
    • django-debug-toolbar: 1.5
    • djangorestframework: 3.4.6 + optional packages
    • django-cleanup: 0.4.2
    • django-extensions: 1.7.4
    • django-compressor: 2.1
    • django-rosetta: 0.7.12 [optional]
    • django-modeltranslation: 0.11 [optional]
  • Commands:
    • shell -start a bash shell dc run --rm django shell
    • start_runserver - in development mode this will start django runserver
    • start_uwsgi - in production mode this will start the uwsgi
  1. nginx
  • Commands:
    • shell -start a bash shell dc run --rm nginx shell
  • Installed Apps:
    • Nginx: 1.8.1
  1. nodejs [optional]
  • Commands:
    • shell -start a bash shell dc run --rm nodejs shell
    • start_build - start the react build process than exit dc run --rm nodejs start_build
    • start_watchify - start the watchify process for the development mode
    • Installed Apps:
      • nodejs: 4.x.x
      • npm: 2.x.x
    • Installed Packages: [automatically installed]
      • react: 15.3.1,
      • react-dom: 15.3.1,
      • babelify: 7.3.0,
      • babel-preset-react: 6.11.1,
      • browserify: 13.1.0,
      • watchify: 3.7.0,
      • react-router: 2.8.0
You can’t perform that action at this time.