spacemacs/layers/+frameworks/django
syl20bnr 1c4f685b13 core: refactor layer system
TL;DR Should get 20~25% speed improvement on startup, should get a big
improvement when using ivy or helm SPC h SPC. Users with layers.el files
in their layers must use `configuration-layer/declare-used-layer`
instead of `configuration-layer/declare-layer`

The implementation of the layer system made heavy use of `object-assoc`
and `object-assoc-list` functions which are not efficient. This PR
mainly replaces those object lists with hash maps in order to index the
objects by their name and achieve an O(1) access time.

The old object lists `configuration-layer--layers` and
`configuration-layer--packages` have been each by two variables each:
- `configuration-layer--indexed-layers` which is a hash-map of all the
layer objects and `configuration-layer--used-layers` which is a list of
all _used_ layers symbols,
- symmetrically `configuration-layer--indexed-packages` which is a
hash-map of all the package objects and
`configuration-layer--used-packages` which is a list of all _used_
packages symbols.

The hash map `configuration-layer--layer-paths` is gone, now we create
directly layer objects when discovering the layers and set the :dir
property. Note that previously the layer paths were the parent directory
of the layer, now :dir is the layer path.

The function `configuration-layer//make-layer` is now similar to its
counterpart `configuration-layer//make-package` in the sense that it
takes an optional `obj` to be able to override its properties.

The functions `configuration-layer/declare-layer` and
`configuration-layer/declare-layers` now takes an optional parameter
`usedp` in order to declare used or not used layers. For convenience
new functions have been added: `configuration-layer/declare-used-layer`
and `configuration-layer/declare-used-layers`, users _must_ update all
occurrences of `configuration-layer/declare-layer` by
`configuration-layer/declare-used-layers` in their `layers.el` files.

`helm-spacemacs-help` and `ivy-spacemacs-help` are updated to match the
changes in `core-configuration-layer.el`.

Rename some variables to make them more explicit:
`configuration-layer-no-layer` -> `configuration-layer-exclude-all-layers`
`configuration-layer-distribution` -> `configuration-layer-force-distribution`
2016-07-28 23:26:54 -04:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
layers.el core: refactor layer system 2016-07-28 23:26:54 -04:00
packages.el Clean copyrights and update for year 2016 2016-01-11 21:42:17 -05:00
README.org Convert org doc files with doc-fmt 2016-03-30 22:59:55 -04:00

Django layer

/TakeV/spacemacs/media/commit/629eb61149e8978349690d81e23ebd899cdef893/layers/+frameworks/django/img/django.png

Description

This layer adds support for the Python Django framework via pony-mode.

Install

To use this configuration layer, add it to your ~/.spacemacs. You will need to add django to the existing dotspacemacs-configuration-layers list in this file.

Key Bindings

Django related key bindings uses pony-mode and are behind the prefix SPC m j.

Configuration options for pony-mode are documented at deadpansincerity.com

Manage Django with SPC m j m.

Fabric

Key Binding Description
SPC m j a f Run a fabric command
SPC m j a d Deploy project with fab deploy

Files

Key Binding Description
SPC m j f s Open the settings.py for this project
SPC m j f c Interactively display a setting value in the minibuffer
SPC m j f t Jump to template at point
SPC m j f r Jump to the view file that the URL resolves to (experimental)

Interactive

Key Binding Description
SPC m j i d Run interpreter for this project's default database as an inferior process
SPC m j i s Open a Python shell with the current pony project's context loaded. If the project has the django_extras package installed, then use the excellent shell_plus command. Otherwise, fall back to manage.py shell

Server

Key Binding Description
SPC m j r d Stop the dev server
SPC m j r o Open a tab at the dev server
SPC m j r r Restart the dev server (works better with django_extras/werkzeug)
SPC m j r u Start or open the dev server
SPC m j r t Open a second server with a "throwaway" host/port

South/Syncdb

Key Binding Description
SPC m j s c Convert an existing app to south
SPC m j s h Create migration for modification
SPC m j s i Run the initial south migration for an app
SPC m j s m Migrate an app
SPC m j s s Run syncdb on the current project

Test

Key Binding Description
SPC m j t d Move down the traceback one level
SPC m j t e Go to the file and line of the last stack trace in a test buffer
SPC m j t o Open the file in a traceback at the line specified
SPC m j t t Run the test(s) given by command
SPC m j t u Move up the traceback one level