1 This file documents the contents of this module
3 Last update 4 sept. 2013
5 See the devel/ subdir for more devel-oriented doc.
7 ==================== 1 minute howto
9 * REQUIREMENTS is to have python + django (1.5.2) installed django
10 ** should be straightforward
11 ** see devel/django-install.txt in case of trouble
13 * git clone git://git.onelab.eu/myslice.git
15 * git clone ssh://yourlogin@git.onelab.eu/git/myslice.git
17 * edit myslice/config.py and enter the details of your manifold backend
24 $ ./manage.py collectstatic
26 $ ./manage.py collectstatic --noinput
28 $ make static (which is a shorthand for cleaning up and run manage collectstatic --noinput)
30 * gather templates files
31 for now we still seem to rely on a make-based templates-collection process
32 that creates templates/
33 $ make templates [$ make redo (each time when you pull, do that and restart the server)]
36 $ manage.py runserver 0.0.0.0:8000
38 $ devel/server-loop.sh
39 when you just need to hit ^C yourself when your static files need to be refreshed - see below
41 * use it from your browser
42 (See more notes on using the development server below)
44 * install dependencies
45 $ pip install -r path/to/requirements/file.txt
46 Note. not quite sure what this is about, I could not spot this file..
48 ==================== Status
50 *** Authentication ***
53 Not quite sure if/how the user gets proper notifications when
54 . his session has expired (i.e. his frontend is not logged into the backend any longer)
55 . his credentials have expired (i.e. the uploaded credentials, e.g. SFA delegated cred)
56 expired and she needs to run e.g. sfi myslice again
58 Hard-coded accounts (from a very early stage) are gone
63 I've done a very rough attempt at packaging for rpm.
64 The logic seems about right but needs more work, in particular in terms of installing myslice.conf
65 in the httpd conf.d directory.
66 It seems like our app won't work on f14 as is because Django is only 1.3.1 on f14
67 Plan is to target f18 but I lack a test machine.
68 Also of course I'll try to tackle debian/ubunti at some point.
70 There also is a working packaging for debian(s) and ubuntu(s) that we use
71 on an almost daily basis to upgrade manifold.pl.sophia.inria.fr
76 Third party tools shipped:
83 Others are added as we build the system when they become needed
84 Look in third-party/ for a more detailed list
86 As a rule of thumb, please try to keep in mind that these will need to
87 be upgraded over time I've tried to keep track of the version I picked
88 and to have an easy upgrade path (depending on the way the original
91 ==================== Contents: 1st level subdirs
93 ========== code from git
96 this is the django 'project', where to look for
101 the code for dealing with queries, sending them to the backend, and offering the /manifold/proxy/ URL
104 the code for building / rendering plugins
107 the actual code for plugins
110 a django 'app' that deals with authentication; see especially
111 auth.backend.MyCustomBackend
112 for how to use a separate authentication system,
113 as well as settings.py for how to enable it
116 provides building blocks for the UI, especially layouts (1 or 2 columns) as
117 well as the topmenu widget
118 + some global static files (css, js, images..)
121 this is where the first implementation of myslice, with complete
122 user-management including registration, is taking place
125 rough/preliminary scaffolding views are in here
126 as the name suggests this is temporary
129 a third-party django app for adding on-the-fly mentions to css or js files that need to go in the header
132 * third party javascript and css stuff (bootstrapfs, jquery, this kind of things)
133 see more about that below too
136 no code in there, only various notes and other scripts useful for developers
138 ========== automatically generated
140 * static/: (generated by collectstatic, see above, do not source-control)
141 $ manage.py [ --noinput ] collectstatic
146 this is where django stores its own stuff, as per settings.py
148 ==================== conventions for templates & static files
149 ==================== and NOTES on using the development server
151 . first off, running manage.py runserver is provided by django as a development convenience but
152 SHOULD NOT be used in production
154 . second, when you do use it for developement purposes, please be aware that:
156 .. the recommended layout for the various files and pieces (py, html, js and css) with django is e.g.
157 plugins/quickfilter/___init__.py,
158 plugins/quickfilter/templates/quickfilter.html,
159 plugins/quickfilter/static/js/quickfilter.js
160 plugins/quickfilter/static/css/quickfilter.css
161 plugins/quickfilter/static/img/some-image.png
163 .. the files actually used by the development server are the ones located in
167 you can and should use the following make targets to refresh the
168 contents of these directories when running a developement server
169 $ make static to refresh static/
170 $ make redo-static to clean up static/ and then refresh its contents
171 $ make templates to refresh templates/
172 $ make redo-templates to clean up templates/ and then refresh its contents
173 $ make redo equivalent to make redo-static redo-templates
175 .. as far as possible, please make sure to use third-party to store
176 any javascript tool or utility that your plugin depends upon
178 also we have the convention that all material in third-party should be
179 tagged with a version number, with a symlink pointing to the version
180 being used, like this
182 ~/git/myslice/third-party $ ls -ld spin*
183 lrwxr-xr-x 1 parmentelat staff 10 Sep 6 17:55 spin -> spin-1.3.0
184 drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.2.8
185 drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.3.0
187 finally, as far as possible we keep track of the urls used to pull
188 stuff in the first place so that upgrades are easier
190 . third, be careful when importing third party material, to stay away from demo-oriented material
192 e.g. at some point we were using demo_page.css and demo_table.css from the datatables demo and sample pages
193 unfortunately these are not tailored for production use as they are setting styles on a very wide scope
194 that breaks a lot of stuff, so please refrain from using these altogether
197 ======== update django database to reflect changes in existing models without any migration system (e.g., south) =========
200 $python manage.py reset <your_app>
202 #Django 1.5.1 or later
203 $python manage.py flush
205 This will update the database tables for your app, but will completely destroy any data that existed in those tables.
206 If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field)
207 you can simply dump the data before and reload it afterwards, like so:
209 $python manage.py syncdb
210 $python manage.py dumpdata <your_app> > temp_data.json
211 $python manage.py flush
212 $python manage.py loaddata temp_data.json
214 If your changes break your old schema this won't work - in which case tools like south or django evolution are great.
216 ======== update django database to reflect changes in existing models with migration system (e.g., south) =========
218 As south is already installed , you just have to do:
224 1. go to myslice directory
225 2. do sqlite3 myslice.sqlite3 [if sqlite3: command not found, do $apt-get install sqlite3]
226 3. check the list of tables with sqlite> .tables
227 4. if you find those tables that was mentioned in the failure message while running $./manage.py migrate
228 do sqlite> DROP TABLE mentioned_table
229 [mentioned_table = the tables that was explicity mentioned in the failure message of $./manage.py migrate]
231 6. $./manage.py migrate