Giter Site home page Giter Site logo

django-angular-scaffold's Introduction

django-angular-scaffold

Build Status PyPI version Code Health Coverage Status

set of django management commands to scaffold a django + angular project

##Installation

Install using pip

pip install django-angular-scaffold

include in your INSTALLED_APPS

#settings.py
...
INSTALLED_APPS = (
    ...
    'angular_scaffold',
    ...
)

##Commands

The following are commands that are made available through this package.

###scaffold

./manage.py scaffold

Builds a assets folder structure in the following structure:

/assets
    + - app
    |   + - config
    |   + - controllers
    |   + - directives
    |   + - services
    |   + - views
    |   + - app.js
    + - lib
        + - fonts
        + - scripts
        + - styles
            + - site
            |   + - _global.scss
            |   + - _mixins.scss
            |   + - _variables.scss
            + - vendor
            + styles.scss

It will prompt for an application name, this will add start the angular app off.

It also automatically setups the styles.scss to import the pre stubbed out globals, mixins, and variables files.

The rest of the folders are stubbed out with a .gitkeep file to allow the directory structure to be added to git.

###startview

./manage.py startview <viewname>

creates new view, creates new styles and adds it to the import

Can accept a path. The following are valid viewname arguments

./manage startview homepage
./manage startview home-page
./manage startview ticket/new
./manage startview settings/options/test

This will create a view file in the appropriate folder, create a mirrored scss file in the site directory, and import the style into the main styles.scss file.

###generatedocs

./manage.py generatedocs

Adds a /docs folder and copies some basic documentation into it

###createdebugger

./manage.py createdebugger <password>

Creates a config file for angular that overrides console.log and replaces it with $log.debug. Then disables $log.debug unless a query string with an encoded password is included.

This makes it very easy to debug your application without having to expose the underlying to the users. It also allows you to keep your logging statements in your app when going to production, as they are turned off and hidden by default.

###startservice

./manage.py startservice <service_name>

Creates a starter service. Will ask for the endpoint, and the pluralization of the service name, and will create list, get, post, put, and delete methods for that service.

###startcontroller

./manage.py startcontroller <controller_name>

Creates a new empty controller in controllers directory.

###createcsrf

./manage.py createcsrf

Adds the csrf token to your angular ajax headers in a config file. Also injects the ngCookies dependency into your app.

###startroutes

./manage.py startroutes

Adds a routes config file and inject ngRoute as a dependency. Creates a defaulted route to / using HomeController and views/home.html.

###addroute

./manage.py addroute

Adds a route to the routes. Will prompt for url, controller, views, and a number of variables to resolve.

  • when: - put in the url in angular notation for this route example: /tickets/:ticket/edit/
  • controller: - the short name of the controller example: ticket = TicketController
  • view: - path relative to the views folder to the html template example: tickets/ticket.html
  • resolve - name of variable to resolve into controller

###createlimiter

./manage.py createlimiter

Adds a runtime config that gives access to a $rootScope.checkLimiter() function that you can use in services to limit the number of calls made.

django-angular-scaffold's People

Contributors

mc706 avatar

Watchers

James Cloos avatar Juan Fernando Jaramillo Botero avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.