generator-django-webapp editorconfig travis-ci npm

Yeoman generator that scaffolds out a Django web app with front-end support.

3 years after

Django web app generator Build Status Built with Grunt

Yeoman generator that scaffolds out a Django web app with front-end support. Derived from generator-webapp.

Features

  • CSS Autoprefixing (new)
  • Built-in preview server with LiveReload
  • Automagically compile CoffeeScript & Compass
  • Automagically lint your scripts
  • Automagically wire up your Bower components with bower-install.
  • Awesome Image Optimization (via OptiPNG, pngquant, jpegtran and gifsicle)
  • Mocha Unit Testing with PhantomJS
  • Optional - Bootstrap for Sass
  • Optional - Leaner Modernizr builds (new)
  • Auto-generated config paths of all RequireJS modules (new)
  • Automagically handle {{ STATIC_URL }} and {% static %} template tags (new)
  • Optimze HTML files and Django templates, including inline Javascript and CSS (using grunt-htmlcompressor) (new)

generator-django-webapp depends on a heavily-patched version of grunt-usemin. For more information on what generator-django-webapp can do for you, take a look at the Grunt tasks.

Getting Started

  • Install: npm install -g generator-django-webapp
  • Start a Django project: django-admin.py startproject your_project_name
  • Set working directory to project base: cd your_project_name
  • Run: yo django-webapp
  • Set working directory for Grunt task: cd etc
  • Run grunt for building static assets
  • If everything is OK, the built assets are in etc/dist directory

Third-Party Dependencies

(HTML/CSS/JS/Images/etc)

Third-party dependencies are managed with bower-install. Add new dependencies using Bower and then run the Grunt task to load them:

  bower install --save jquery
  grunt bowerInstall

This works if the package author has followed the Bower spec. If the files are not automatically added to your index.html, check with the package's repo for support and/or file an issue with them to have it updated.

To manually add dependencies, bower install depName --save to get the files, then add a script or style tag to your index.html or an other appropriate place.

The components are installed in the root of the project at /bower_components. To reference them from the grunt serve web app index.html file, use src="bower_components" or src="/bower_components". Treat the references as if they were a sibling to index.html.

Testing Note: a project checked into source control and later checked out, needs to have bower install run from the test folder as well as from project root.

Grunt Serve Note

Note: grunt server was previously used for previewing in earlier versions of the project and is being deprecated in favor of grunt serve.

Options

  • --skip-install

    Skips the automatic execution of bower and npm after scaffolding has finished.

  • --test-framework=<framework>

    Defaults to mocha. Can be switched for another supported testing framework like jasmine.

  • --coffee

    Add support for CoffeeScript.

Contribute

Main development happens in Yeoman's generator-webapp. See the contributing docs

generator-django-webapp is fork-friendly (and is also a fork of generator-webapp) and you can always maintain a custom version which you npm install && npm link to continue using via yo django-webapp or a name of your choosing.

License

BSD license

Related Repositories

awesome-graphql

awesome-graphql

Awesome list of GraphQL & Relay ...

awesome-github-vue

awesome-github-vue

Vue相关开源项目库汇总 ...

Static-Site-Generators

Static-Site-Generators

A definitive list of tools for generating static websites. ...

awesome-projects-boilerplates

awesome-projects-boilerplates

Boilerplates for mobile and web apps ...

snippod-boilerplate

snippod-boilerplate

webapp + server full stack architecture boilerplate using "react+reflux"(front) ...


Top Contributors

sindresorhus addyosmani passy eddiemonge rockallite kevva silvenon stephenplusplus robwierzbowski mklabs sleeper callumlocke alrra kartikluke HaNdTriX peol haydenbleasel alefteris tschaub felquis btford blakeblackshear creynders cvrebert cobyism Danmer jeef3 radnor matheusazzi asuh

Releases

-   v0.4.9 zip tar
-   v0.4.8 zip tar
-   v0.4.8-0.1.1 zip tar
-   v0.4.8-0.1.0 zip tar
-   v0.4.7 zip tar
-   v0.4.6 zip tar
-   v0.4.5 zip tar
-   v0.4.4 zip tar
-   v0.4.3 zip tar
-   v0.4.2 zip tar
-   v0.4.1 zip tar
-   v0.4.0 zip tar
-   v0.3.1 zip tar
-   v0.3.0 zip tar
-   v0.2.7 zip tar
-   v0.2.6 zip tar
-   v0.2.5 zip tar
-   v0.2.4 zip tar
-   v0.2.3 zip tar
-   v0.2.2 zip tar
-   v0.2.0 zip tar
-   v0.1.7 zip tar
-   v0.1.6 zip tar
-   v0.1.5 zip tar
-   v0.1.4 zip tar
-   v0.1.3 zip tar
-   v0.1.2 zip tar
-   v0.1.1 zip tar
-   v0.1.0 zip tar