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 ## Whenever doing a git pull the following operations are recommended:
38 $ make static # will refresh static/ from all the pieces in the project
39 $ make templates # same, for templates
40 $ make redo-static # clears up (rm -rf) static/ first, then make static
41 $ make redo-templates # ditto for templates
42 $ make redo == make redo-static redo-templates
46 $ manage.py runserver 0.0.0.0:8000
48 $ devel/server-loop.sh
49 when you just need to hit ^C yourself when your static files need to be refreshed - see below
51 * use it from your browser
52 (See more notes on using the development server below)
54 * install dependencies
55 $ pip install -r path/to/requirements/file.txt
56 Note. not quite sure what this is about, I could not spot this file..
58 ==================== Status
60 *** Authentication ***
63 Not quite sure if/how the user gets proper notifications when
64 . his session has expired (i.e. his frontend is not logged into the backend any longer)
65 . his credentials have expired (i.e. the uploaded credentials, e.g. SFA delegated cred)
66 expired and she needs to run e.g. sfi myslice again
68 Hard-coded accounts (from a very early stage) are gone
73 I've done a very rough attempt at packaging for rpm.
74 The logic seems about right but needs more work, in particular in terms of installing myslice.conf
75 in the httpd conf.d directory.
76 It seems like our app won't work on f14 as is because Django is only 1.3.1 on f14
77 Plan is to target f18 but I lack a test machine.
78 Also of course I'll try to tackle debian/ubunti at some point.
80 There also is a working packaging for debian(s) and ubuntu(s) that we use
81 on an almost daily basis to upgrade manifold.pl.sophia.inria.fr
86 Third party tools shipped:
93 Others are added as we build the system when they become needed
94 Look in third-party/ for a more detailed list
96 As a rule of thumb, please try to keep in mind that these will need to
97 be upgraded over time I've tried to keep track of the version I picked
98 and to have an easy upgrade path (depending on the way the original
101 ==================== Contents: 1st level subdirs
103 ========== code from git
106 this is the django 'project', where to look for
111 the code for dealing with queries, sending them to the backend, and offering the /manifold/proxy/ URL
114 the code for building / rendering plugins
117 the actual code for plugins
120 a django 'app' that deals with authentication; see especially
121 auth.backend.MyCustomBackend
122 for how to use a separate authentication system,
123 as well as settings.py for how to enable it
126 provides building blocks for the UI, especially layouts (1 or 2 columns) as
127 well as the topmenu widget
128 + some global static files (css, js, images..)
131 this is where the first implementation of myslice, with complete
132 user-management including registration, is taking place
135 rough/preliminary scaffolding views are in here
136 as the name suggests this is temporary
139 a third-party django app for adding on-the-fly mentions to css or js files that need to go in the header
142 * third party javascript and css stuff (bootstrapfs, jquery, this kind of things)
143 see more about that below too
146 no code in there, only various notes and other scripts useful for developers
148 ========== automatically generated
150 * static/: (generated by collectstatic, see above, do not source-control)
151 $ manage.py [ --noinput ] collectstatic
156 this is where django stores its own stuff, as per settings.py
158 ==================== conventions for templates & static files
159 ==================== and NOTES on using the development server
161 . first off, running manage.py runserver is provided by django as a development convenience but
162 SHOULD NOT be used in production
164 . second, when you do use it for developement purposes, please be aware that:
166 .. the recommended layout for the various files and pieces (py, html, js and css) with django is e.g.
167 plugins/quickfilter/___init__.py,
168 plugins/quickfilter/templates/quickfilter.html,
169 plugins/quickfilter/static/js/quickfilter.js
170 plugins/quickfilter/static/css/quickfilter.css
171 plugins/quickfilter/static/img/some-image.png
173 .. the files actually used by the development server are the ones located in
177 you can and should use the following make targets to refresh the
178 contents of these directories when running a developement server
179 $ make static to refresh static/
180 $ make redo-static to clean up static/ and then refresh its contents
181 $ make templates to refresh templates/
182 $ make redo-templates to clean up templates/ and then refresh its contents
183 $ make redo equivalent to make redo-static redo-templates
185 .. as far as possible, please make sure to use third-party to store
186 any javascript tool or utility that your plugin depends upon
188 also we have the convention that all material in third-party should be
189 tagged with a version number, with a symlink pointing to the version
190 being used, like this
192 ~/git/myslice/third-party $ ls -ld spin*
193 lrwxr-xr-x 1 parmentelat staff 10 Sep 6 17:55 spin -> spin-1.3.0
194 drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.2.8
195 drwxr-xr-x 7 parmentelat staff 238 Sep 6 17:55 spin-1.3.0
197 finally, as far as possible we keep track of the urls used to pull
198 stuff in the first place so that upgrades are easier
200 . third, be careful when importing third party material, to stay away from demo-oriented material
202 e.g. at some point we were using demo_page.css and demo_table.css from the datatables demo and sample pages
203 unfortunately these are not tailored for production use as they are setting styles on a very wide scope
204 that breaks a lot of stuff, so please refrain from using these altogether
207 ======== update django database to reflect changes in existing models without any migration system (e.g., south) =========
210 $python manage.py reset <your_app>
212 #Django 1.5.1 or later
213 $python manage.py flush
215 This will update the database tables for your app, but will completely destroy any data that existed in those tables.
216 If the changes you made to your app model do not break your old schema (for instance, you added a new, optional field)
217 you can simply dump the data before and reload it afterwards, like so:
219 $python manage.py syncdb
220 $python manage.py dumpdata <your_app> > temp_data.json
221 $python manage.py flush
222 $python manage.py loaddata temp_data.json
224 If your changes break your old schema this won't work - in which case tools like south or django evolution are great.
226 ======== update django database to reflect changes in existing models with migration system (e.g., south) =========
228 As south is already installed , you just have to do:
234 1. go to myslice directory
235 2. do sqlite3 myslice.sqlite3 [if sqlite3: command not found, do $apt-get install sqlite3]
236 3. check the list of tables with sqlite> .tables
237 4. if you find those tables that was mentioned in the failure message while running $./manage.py migrate
238 do sqlite> DROP TABLE mentioned_table
239 [mentioned_table = the tables that was explicity mentioned in the failure message of $./manage.py migrate]
241 6. $./manage.py migrate