learningequality/ka-lite — pull request #1736 by bcipolli (2014-03-16 00:55:10+00:00)
Title: Refactoring static files to be encapsulated by app.

More hella-refactoring. This depends on #1729

**Background:**
Currently, our static files are pre-collected into a single directory, making it hard for us to import any apps that are self-contained (or export any apps that are self-contained).

This way of dealing with static files is non-standard. Django recommends keeping static files inside each app (with project-general files stored in locations defined within `STATICFILES_DIRS`), then using the `collectstatic` command to pull them into one location.
https://docs.djangoproject.com/en/1.4/howto/static-files/

**What changed:**
I implemented the above by:
* Separating static files into individual apps (with a large number going to the `distributed` app), where
* Each app has a static files stored in `static/[`css`, `images`, `js`]/{app}` subdirectories.
* This is done so that when `collectstatic` is called, file collision is not an issue.
* Moving `khan-exercises` out of the `js` directory and into its own (since it's much more than javascript; this follows the convention of what we do for `video-js`, for example)
* Moving project-general out of `ka-lite/kalite/static` (which is the collection destination directory) and into `ka-lite/static`
* Adding a call to `collectstatic` into the setup script.

**New dev processes:**
* Develop front-end by putting static files in the app-specific locations defined above.
* When using the `runserver` command, static files will be found by Django with no further work.
* When using `cherrypy`, manually call `collectstatic` (or re-run the `setup` command) to deploy static file changes first.

I did my best to separate this by commit, to give some better sense of what I did. I did test different pages along the way to see what resources might have been missed--as references to each of the following were changed:
* Many files were put into the `distributed` app, whereas they were in the root static folder before.
* `khan-exercises` was taken out of `js` and put in the root static folder.
* `facility` static files were still showing at the `securesync` app location within the static folder.