Skip to content

djangoresearch/django-docker-bootstrap

 
 

Repository files navigation

django-docker-bootstrap

Requirements Status Build Status

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.9.1),docker-compose(1.6.0) - https://docs.docker.com/engine/installation/
  • 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 env.txt in the root
  • If you want to run the project in production mode you need to set the following environment variable:

Tips & Tricks

Images

  1. base
  • Contains every data(db, files, logs) and connected to every other container as a volume (/data/).
  • If you delete the base container you will lose everything (be cautious)
  1. postgres
  • postgresql-9.4
  • The 5433 port is open by default if you want to connect the db with a client
  • Commands:
    • 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.9.2
    • uWSGI: 2.0.12
    • psycopg2: 2.6.1
    • django-debug-toolbar: 1.4
    • djangorestframework: 3.3.2 + optional packages
    • django-cleanup: 0.4.2
    • django-extensions: 1.6.1
    • django-compressor: 2.0
    • django-rosetta: (fork from 0.7.8) [optional]
    • django-modeltranslation: 0.11rc2 [optional]
  • Commands:
    • shell -start a bash shell dc run --rm django shell
  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
    • Installed Apps:
      • nodejs: 4.x.x
      • npm: 2.x.x
    • Installed Packages: [automatically installed]
      • react: 0.14.7,
      • react-dom: 0.14.7,
      • babelify: 7.2.0,
      • babel-preset-react: 6.5.0,
      • browserify: 13.0.0,
      • watchify: 3.7.0,
      • react-router: 1.0.3,
      • history: 1.17.0

About

Django development/production environment with docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.6%
  • HTML 10.8%
  • JavaScript 7.0%
  • CSS 6.6%
  • Nginx 3.3%
  • Shell 2.9%
  • Vim Script 0.8%