Skip to content

zpyoung/ff-django-boilerplate

Repository files navigation

Thorgate's Django template (SPA variant)

Build status

Django project template that we use at Thorgate.

Best suited for single page web applications.

See also the default and Bootstrap 4 variants.

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

Migrating to SPA version 3.0

3.0 brings support for env based settings.

  • Upgrade template
  • Move all required bits to new app directory
  • Test that everything is still working
  • Commit changes
  • Servers
    • Update Django to new settings
      • Convert <root>/<project>/settings/local.py to <root>/<project>/django.env
      • Or remove DJANGO_PRODUCTION_MODE and DJANGO_SETTINGS_MODULE env reference from Dockerfile-django.production
    • Copy <root>/app/env/node.env.example to <root>/app/env/node.env
      • Update Node settings in <root>/app/env/node.env
        • SITE_URL
        • DJANGO_SITE_URL
        • ALLOWED_HOSTS
        • RAVEN_PUBLIC_DSN
        • RAVEN_BACKEND_DSN

Features

  • Django-based storage API backend (accessible from port 3000 for local development)

    • Django 1.11 (because it's LTS)
    • Separate settings for different environments (local/staging/production)
    • Python 3.6+
  • Frontend app with JavaScript (ES2015), React, Koa, and Sass (accessible from port 8000 for local development)

    • Latest JavaScript features from ES2015 and beyond, transpiled with Babel
    • React 16.2 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, and logrotate
    • 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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published