-* all-static: (generated, no need to source-control)
- this is where 'manage.py collectstatic' will gather all your static contents if you run a local server
- make has convenience targets to refresh this area
- $ make clean-static
- $ make static
-
-==================== initial conventions for templates and static
-
-* templates:
- we store this under templates/ within the corresponding app, e.g.
- auth/templates/login.html
- for now this is only about html, but the engine can be used for rendering anything including json or whatever..
-
-* static files:
- we chose to have all static files (images, but also javascript and stylesheets) in the various
- proj or app where they belong, under a static/ subdir that has this structure:
- where-it-belongs/
- static/
- img/
- css/
- js/
- the stuff I have so far is in myslice/ because it looks common to all apps..
+========== automatically generated
+
+* static/: (generated by collectstatic, see above, do not source-control)
+ $ manage.py [ --noinput ] collectstatic
+
+* templates/
+
+* myslice.sqlite3
+ this is where django stores its own stuff, as per settings.py
+
+==================== conventions for templates & static files
+==================== and NOTES on using the development server
+
+. first off, running manage.py runserver is provided by django as a development convenience but
+ SHOULD NOT be used in production
+
+. second, when you do use it for developement purposes, please be aware that:
+
+.. the recommended layout for the various files and pieces (py, html, js and css) with django is e.g.
+ plugins/quickfilter/___init__.py,
+ plugins/quickfilter/templates/quickfilter.html,
+ plugins/quickfilter/static/js/quickfilter.js
+ plugins/quickfilter/static/css/quickfilter.css
+ plugins/quickfilter/static/img/some-image.png
+
+.. the files actually used by the development server are the ones located in
+ static/
+ templates/
+
+you can and should use the following make targets to refresh the
+contents of these directories when running a developement server
+$ make static to refresh static/
+$ make redo-static to clean up static/ and then refresh its contents
+$ make templates to refresh templates/
+$ make redo-templates to clean up templates/ and then refresh its contents
+$ make redo equivalent to make redo-static redo-templates
+
+.. as far as possible, please make sure to use third-party to store
+any javascript tool or utility that your plugin depends upon
+
+also we have the convention that all material in third-party should be
+tagged with a version number, with a symlink pointing to the version
+being used, like this
+
+~/git/myslice/third-party $ ls -ld spin*
+lrwxr-xr-x 1 parmentelat staff 10 Sep 6 17:55 spin -> spin-1.3.0
+drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.2.8
+drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.3.0
+
+finally, as far as possible we keep track of the urls used to pull
+stuff in the first place so that upgrades are easier
+
+. third, be careful when importing third party material, to stay away from demo-oriented material
+
+e.g. at some point we were using demo_page.css and demo_table.css from the datatables demo and sample pages
+unfortunately these are not tailored for production use as they are setting styles on a very wide scope
+that breaks a lot of stuff, so please refrain from using these altogether
+
+
+======== update django database to reflect changes in existing models without any migration system (e.g., south) =========
+
+# older version
+$python manage.py reset <your_app>
+
+#Django 1.5.1 or later
+$python manage.py flush
+
+This will update the database tables for your app, but will completely destroy any data that existed in those tables.
+If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field)
+you can simply dump the data before and reload it afterwards, like so:
+
+$python manage.py syncdb
+$python manage.py dumpdata <your_app> > temp_data.json
+$python manage.py flush
+$python manage.py loaddata temp_data.json
+
+If your changes break your old schema this won't work - in which case tools like south or django evolution are great.
+
+
+Add a new model to the DB
+
+$python manage.py schemamigration <your_app> --auto
+$python manage.py migrate
+
+======== update django database to reflect changes in existing models with migration system (e.g., south) =========
+
+As south is already installed , you just have to do:
+
+$./manage.py migrate
+
+if it fails:
+
+1. go to myslice directory
+2. do sqlite3 myslice.sqlite3 [if sqlite3: command not found, do $apt-get install sqlite3]
+3. check the list of tables with sqlite> .tables
+4. if you find those tables that was mentioned in the failure message while running $./manage.py migrate
+ do sqlite> DROP TABLE mentioned_table
+ [mentioned_table = the tables that was explicity mentioned in the failure message of $./manage.py migrate]
+5. sqlite> .quit
+6. $./manage.py migrate
+