Thorgate's Django project template - Django, React, Sass, optional Docker and more
Switch branches/tags
Nothing to show
Clone or download
rivol Merge branch 'chore/maintenance-2018-06' into 'master'
Chore/maintenance 2018 06

See merge request thorgate-public/django-project-template!24
Latest commit 66a89bb Jun 12, 2018
Permalink
Failed to load latest commit information.
extensions
hooks
tests
{{cookiecutter.repo_name}} Update JS packages, mostly minor upgrades Jun 11, 2018
.gitignore Tests use same commands as in project gitlab-ci May 14, 2018
.gitlab-ci.yml Update from internal repo, too many changes to list :-) Feb 12, 2018
CHANGELOG.md
LICENCE.md Add changelog, update copyright year Feb 12, 2018
README.md Update README.md Mar 14, 2018
cookiecutter.json Add some template variables and refactor them Mar 5, 2018
requirements.txt Tests use same commands as in project gitlab-ci May 14, 2018
setup.cfg Tests use same commands as in project gitlab-ci May 14, 2018
tox.ini
upgrade-template.py Add some template variables and refactor them Mar 5, 2018

README.md

Thorgate's Django template

Build status

Django project template that we use at Thorgate.

Best suited for medium-sized and bigger apps that use JavaScript and React for frontend.

See also the Bootstrap 4 and single-page app variants.

(note that the primary repo is in Gitlab, with mirror in Github)

Features

  • Django-based backend

    • Django 1.11 (because it's LTS)
    • Separate settings for different environments (local/staging/production)
    • Python 3.4 / 3.5 / 3.6
  • Frontend app with JavaScript (ES2015), React and Sass

    • Latest JavaScript features from ES2015 and beyond, transpiled with Babel
    • React 16 for fast modular user interfaces
    • Sass, PostCSS and Autoprefixer for more convenient styling
    • Webpack 2.3 is used to bundle and minify JavaScript and styles
  • Batteries

    • Docker / Docker Compose integration
    • Linting of Python, JavaScript and Sass code with Prospector, ESLint and stylelint
    • py.test and coverage integration
    • Deploy helpers, using Fabric
    • Out-of-the-box configuration for nginx, gunicorn, logrotate and crontab
    • Includes PyCharm project config

Usage

To use this template, first ensure that you have Cookiecutter available. You should probably create additional python3 virtual environment for cookiecutter, activate it and then install following packages by running following command: pip install cookiecutter cookiecutter_repo_extensions fqdn

Then just execute:

cookiecutter dir/to/django-project-template/

It will ask you a few questions, e.g. project's name.

After generation completes, search for any TODOs in the code and make appropriate changes where needed.

See README.md in the generated project for instructions on how to set up your development environment.

Upgrading project template

First ensure you have a python3 interpreter with cookiecutter installed.

To upgrade an existing project, change the current working directory to the root of the project you want to upgrade. i.e. cd project-to-upgrade. Ensure your are not in the template branch.

Then run python ~/path/to/django-project-template/upgrade-template.py

This will make a commit to the branch template in your project with the updates to the project template. Then merge the template branch.