Revision b3ae4dd1 snf-webproject/docs/index.rst

b/snf-webproject/docs/index.rst
231 231

  
232 232
Static files
233 233
````````````
234

  
235
:ref:`snf-webproject <snf-webproject>` provides a helper mechanism to avoid tedious
236
tasks involving the collection and deployment of installed applications static
237
files (js/css/images etc.). The mechanism tries to mimic the ``staticfiles``
238
application included in ``Django>=1.3`` but its far less robust and adequate
239
regarding its capabilities. When ``Django>=1.3`` become available as a package 
240
for the stable release of ``Debian``, the current mechanism will get wiped off
241
to be replaced by the ``staticfiles`` contrib application.
242

  
243
The current mechanism provides a tool to collect the static files of the synnefo
244
components installed and enabled in your system and an automatic way of serving
245
those files directly from your django project. Be concerned that the latter is
246
for debugging pupropses only since serving static files from your django project
247
is considered as a bad practice.
248

  
249
Each django based synnefo component informs webproject mechanism for the static 
250
files it contains using the ``synnefo.web_static`` entry point which should point
251
to a dict containing a map of a python module and a namespace for the url under
252
which the files will be served from. As an example of use we can see how 
253
snf-cyclades-app informs webproject for the static files of ui and admin applications.
254

  
255
in ``setup.py``::
256
    
257
    ...
258
    entry_points = {
259
     ...
260
     'synnefo': [
261
         ...
262
         'web_static = synnefo.app_settings:synnefo_static_files',
263
         ...
264
         ]
265
      },
266
    ...
267

  
268
and inside ``synnefo/app_settings/__init__.py``::
269

  
270
    synnefo_static_files = {
271
        'synnefo.ui': 'ui',
272
        'synnefo.admin': 'admin',
273
    }
274

  
275

  
276
Collecting static files
277
^^^^^^^^^^^^^^^^^^^^^^^
278

  
234 279
* Choose an appropriate path (e.g. :file:`/var/lib/synnefo/static/`) from which
235 280
  your web server will serve all static files (js/css) required by the synnefo
236 281
  web frontend to run.
......
250 295
.. todo:: Make the location of static files configurable. This has already
251 296
   been done for the UI, see ``UI_MEDIA_URL``.
252 297

  
298

  
299
Serving static files
300
^^^^^^^^^^^^^^^^^^^^
301

  
302
By default will serve the static files if ``DEBUG`` setting is set to True.
303
You can override this behaviour by using the ``WEBPROJECT_SERVE_STATIC`` 
304
setting.
305

  
306

  
253 307
Apache
254 308
``````
255 309

  

Also available in: Unified diff