Cookiecutter project template - setups a dev enviroment for Django projects using Docker containers with docker-compose

donnex, updated 🕥 2022-01-21 19:48:10

django-docker-coookiecutter

This project is outdated and not maintained any more.

Cookiecutter project template that setups a dev enviroment for Django projects using Docker containers with docker-compose.

This setup is currently only intended to be used in dev, not production.

Containers

  • data container - Data container for Postgres and redis data
  • posgres - PostgreSQL
  • redis - Redis
  • nginx - Nginx for web access
  • django - Python container running the Django project using Gunicorn. Installs requirements from requirements.txt
  • pgweb - pgweb container for accessing the postgres database
  • assets - asset building container running sass, compass, jshint, gulp, minification etc.

Misc

  • Docker setup with docker-compose
  • Django with PostgreSQL database
  • PostgreSQL
  • Redis
  • Data volume for persistent data (posgres + redis)
  • Nginx
  • Gunicorn
  • Sass
  • Compass
  • Compass breakpoint module
  • Bootstrap
  • jQuery
  • Gulp with watch and livereload

How to use

First install cookiecutter, probably:

pip install cookiecutter

Run cookiecutter to generate a new project folder, complete with project folders and docker-compose setup:

cookiecutter https://github.com/donnex/django-docker-coookiecutter

Answer the questions from cookiecutter. The project output folder is repo_name in the cookiecutter questions.

cd into the new repo_name folder and run:

docker-compose up

As long as you've added your virtual hosts to the host file and run the nginx-proxy container you should be able to browse to your virtual host in your browser.

Generate Django secret key

A Django secret key can be generated with the following command:

python -c 'import random; print "".join([random.choice("[email protected]#$%^&*(-_=+)") for i in range(50)])'

Nginx proxy

Run the nginx-proxy on port 80 to use the virtual hosts. I'm adding my virtual hosts to /etc/hosts.

docker run -d -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock --name nginx-proxy jwilder/nginx-proxy

Additinal info

Check the generated README.md for more info and commands.

Issues

Bump ipython from 5.2.2 to 7.16.3 in /{{ cookiecutter.repo_name }}/django/{{cookiecutter.repo_name}}/requirements

opened on 2022-01-21 19:48:09 by dependabot[bot]

Bumps ipython from 5.2.2 to 7.16.3.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/donnex/django-docker-coookiecutter/network/alerts).

Bump django from 1.11.23 to 2.2.24 in /{{ cookiecutter.repo_name }}/django/{{cookiecutter.repo_name}}/requirements

opened on 2021-06-10 21:05:39 by dependabot[bot]

Bumps django from 1.11.23 to 2.2.24.

Commits
  • 2da029d [2.2.x] Bumped version for 2.2.24 release.
  • f27c38a [2.2.x] Fixed CVE-2021-33571 -- Prevented leading zeros in IPv4 addresses.
  • 053cc95 [2.2.x] Fixed CVE-2021-33203 -- Fixed potential path-traversal via admindocs'...
  • 6229d87 [2.2.x] Confirmed release date for Django 2.2.24.
  • f163ad5 [2.2.x] Added stub release notes and date for Django 2.2.24.
  • bed1755 [2.2.x] Changed IRC references to Libera.Chat.
  • 63f0d7a [2.2.x] Refs #32718 -- Fixed file_storage.test_generate_filename and model_fi...
  • 5fe4970 [2.2.x] Post-release version bump.
  • 61f814f [2.2.x] Bumped version for 2.2.23 release.
  • b8ecb06 [2.2.x] Fixed #32718 -- Relaxed file name validation in FileField.
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/donnex/django-docker-coookiecutter/network/alerts).

Bump django-debug-toolbar from 1.6 to 1.11.1 in /{{ cookiecutter.repo_name }}/django/{{cookiecutter.repo_name}}/requirements

opened on 2021-04-16 20:40:59 by dependabot[bot]

Bumps django-debug-toolbar from 1.6 to 1.11.1.

Changelog

Sourced from django-debug-toolbar's changelog.

1.11.1 (2021-04-14)

  • Fixed SQL Injection vulnerability, CVE-2021-30459. The toolbar now calculates a signature on all fields for the SQL select, explain, and analyze forms.

1.11 (2018-12-03)

  • Use defer on all <script> tags to avoid blocking HTML parsing, removed inline JavaScript.
  • Stop inlining images in CSS to avoid Content Security Policy errors altogether.
  • Reformatted the code using black <https://github.com/ambv/black>__.
  • Added the Django mail panel to the list of third-party panels.
  • Convert system check errors to warnings to accomodate exotic configurations.
  • Fixed a crash when explaining raw querysets.
  • Fixed an obscure unicode error with binary data fields.
  • Added MariaDB and Python 3.7 builds to the CI.

1.10.1 (2018-09-11)

  • Fixed a problem where the duplicate query detection breaks for non-hashable query parameters.
  • Added support for structured types when recording SQL.
  • Made Travis CI also run one test no PostgreSQL.
  • Added fallbacks for inline images in CSS.
  • Improved cross-browser compatibility around URLSearchParams usage.
  • Fixed a few typos and redundancies in the documentation, removed mentions of django-debug-toolbar's jQuery which aren't accurate anymore.

1.10 (2018-09-06)

  • Removed support for Django < 1.11.
  • Added support and testing for Django 2.1 and Python 3.7. No actual code changes were required.
  • Removed the jQuery dependency. This means that django-debug-toolbar now requires modern browsers with support for fetch, classList etc.
  • Added support for the server timing header.
  • Added a differentiation between similar and duplicate queries. Similar queries are what duplicate queries used to be (same SQL, different parameters).
  • Stopped hiding frames from Django's contrib apps in stacktraces by default.

... (truncated)

Commits
  • bc08f69 Merge pull request from GHSA-pghf-347x-c2gj
  • c201ce3 django-debug-toolbar 1.11
  • 0a75be1 Update the change log
  • a4a5393 Merge pull request #1121 from matthiask/mariadb
  • 48a0e2e Reformat settings using black
  • 901aed7 Mark binary payload as binary (same thing BinaryField.get_db_prep_value does)
  • ad091e6 Test with a real BinaryField
  • 2f3193e Remove the MySQL USER
  • 762e5d9 Run tests with MariaDB too on Travis CI
  • e78ac8c Merge pull request #1107 from dbowd/patch-1
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/donnex/django-docker-coookiecutter/network/alerts).

Production version

opened on 2017-07-08 06:55:18 by Rigel772

Why it is not good for production? What should be changed/added? Are you planning to share the production version? Thank you, Oskar

Daniel Johansson
GitHub Repository