Django generator with live-reload and front-end support
First, install Yeoman and generator-django-reload using npm (we assume you have pre-installed node.js).
npm install -g yo
npm install -g generator-django-reload
Then generate your new project:
yo django-reload
This generator uses gulp to manage the development tasks. The following task are available
Generate a new git tag for patch release
Generate a new git tag for minor release
Generate a new git tag for major release
Compiles the SASS files with sourceMap support to style.css. The css file is autoprefixed for the last 2 release of the major browsers and IE>8. Also concat normalize.css and external css installed via bower at the top of the css stack.
This does the same that styles-dev with the exception of no sourceMap.
This minify the css files with css optimizer.
This runs the eslinter and print the errors in the console without exiting.
This runs the eslinter and exist if there is an error.
Minify the js files with uglify.
This task watches the sass and js files and runs styles-dev and eslint-dev on modifications.
This task clean the assets dir.
This task runs the django shell
This task runs the django migrations
This task runs the django collectstatic
This task runs the django makemigrations
This task runs the django runserver with livereload support
This task runs clean, styles, minify-css, eslint, uglify, migrate and collecstatic task to build the assets pipeline
This task builds the development enviroment, runs the django server with livereload support and the watches the sass and js files.
.
├── assets
├── bower.json
├── gulpfile.js
├── home
│ ├── apps.py
│ ├── __init__.py
│ ├── templates
│ │ └── home
│ │ └── index.html
│ └── views.py
├── manage.py
├── minihtml
│ ├── apps.py
│ ├── __init__.py
│ └── middleware.py
├── package.json
├── requirements
│ ├── base.txt
│ ├── development.txt
│ └── production.txt
├── requirements.txt
├── static
│ ├── css
│ ├── img
│ │ └── logo.png
│ ├── js
│ │ └── menu.js
│ └── scss
│ ├── base
│ │ ├── _base.scss
│ │ ├── _clearfix.scss
│ │ └── _reset.scss
│ ├── components
│ │ ├── _components.scss
│ │ ├── _main-menu.scss
│ │ └── _mask.scss
│ ├── helpers
│ │ ├── _helpers.scss
│ │ ├── _media.scss
│ │ └── _variables.scss
│ ├── layout
│ │ └── _layout.scss
│ ├── pages
│ │ └── _pages.scss
│ └── style.scss
├── templates
│ ├── 400.html
│ ├── 403.html
│ ├── 404.html
│ ├── 500.html
│ ├── base.html
│ ├── footer.html
│ └── header.html
└── project
├── __init__.py
├── settings
│ ├── base.py
│ ├── development.py
│ ├── __init__.py
│ └── production.py
├── urls.py
└── wsgi.py
In the the static files are server from the assets dir. The home app servers the home page (index.html) and can be used to server all the static pages like about, contact, etc. Minihtml app minifies the html output, this is done to use percentage width in divs and reduce the page load. Requirements are distributed in development, test and production enviroments, by default production requirements are used. Manage.py uses development settings by default and wsgi.py uses production settings. To use other setting just set DJANGO_SETTINGS_MODULE env to the required settings file.