Changes between Initial Version and Version 1 of ApplicationConfiguration


Ignore:
Timestamp:
09/23/2008 01:25:29 AM (9 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ApplicationConfiguration

    v1 v1  
     1{{{ 
     2#!rst 
     3The application configuration file 
     4================================== 
     5 
     6Using the configuration file 
     7---------------------------- 
     8 
     9The ``serve`` administrative command needs a proper configuration file to 
     10launch an application. 
     11 
     12You can directly give the configuration file to the ``serve`` command, as: 
     13 
     14  .. code-block:: sh 
     15 
     16    <NAGARE_HOME>/bin/nagare-admin serve /path/to/the/config.cfg 
     17   
     18Or, if the application was registered to the framework 
     19(as described in :wiki:`EntryPoints`), then you can launch it with: 
     20 
     21  .. code-block:: sh 
     22   
     23    <NAGARE_HOME>/bin/nagare-admin serve <application> 
     24 
     25In this case, the framework reads the configuration file named ``<application>.cfg`` 
     26in the directory ``<application>*/conf`` under 
     27``<NAGARE_HOME>/lib/python2.5/site-packages``. 
     28 
     29.. note:: 
     30 
     31  If an application is launched in debug mode, changes in the configuration 
     32  file is immediatly reflected. Else, you need to stop then re-launch the 
     33  application. 
     34   
     35Structure 
     36--------- 
     37 
     38For the boolean parameters, a value of ``true``, ``yes``, ``on`` or ``1`` means True 
     39and a value of ``false``, ``no``, ``off`` or ``0`` mean False. 
     40 
     41You can use the ``$here`` variable which contains the path to the directory where 
     42the configuration file is located. 
     43 
     44Comments, starting with the ``#`` character can be added to a configuration file. 
     45 
     46[application] section 
     47~~~~~~~~~~~~~~~~~~~~~ 
     48 
     49=================== ========= ================== ================================================ 
     50Name                Mandatory Default value      Description 
     51=================== ========= ================== ================================================ 
     52path                Yes       *No default value* Reference to the root component factory of the 
     53                                                 application (see :wiki:`ObjectReferences`) 
     54name                Yes       *No default value* ``/name`` will be the URL of the application 
     55static              No        ``static``         Filesystem path to the static contents of 
     56                              directory          the application. By default, it's the 
     57                                                 ``static`` directory under the application 
     58                                                 installation directory. 
     59always_html         No        yes                If this parameter is false, the framework will 
     60                                                 send XHTML to the browsers that accept XHTML, 
     61                                                 else HTML. If this parameter is true, HTML is 
     62                                                 always generated 
     63debug               No        no                 Display the web debug page when an exception 
     64                                                 occurs. The ``nagare[debug]`` extra must be installed.  
     65=================== ========= ================== ================================================ 
     66 
     67[database] section 
     68~~~~~~~~~~~~~~~~~~ 
     69 
     70=================== ========= ================== ================================================ 
     71Name                Mandatory Default value      Description 
     72=================== ========= ================== ================================================ 
     73activated           No        off                If not activated, the framework will not read 
     74                                                 the following parameters 
     75uri                 Yes       *No default value* URI or connection string to the database, 
     76                                                 as described in http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_establishing 
     77metadata            Yes       *No default value* Reference to the SQLAlchemy metadata object 
     78                                                 (see :wiki:`ObjectReferences`) 
     79populate            No        *No default value* Reference to an optional function, called 
     80                                                 after the table creation to populate them 
     81                                                 with some initial data (see :wiki:`ObjectReferences`) 
     82debug               No        off                Display the generated SQL requests  
     83=================== ========= ================== ================================================ 
     84 
     85All other parameters, if present, are passed as keywords to the SQLALchemy 
     86``create_engine()`` call (see http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_options) 
     87 
     88If an application needs to work with several database, several subsections can 
     89be embedded into the main ``[database]`` section: 
     90 
     91  .. code-block:: txt 
     92   
     93    [database] 
     94     
     95    [[database1]]      # The name of a subsection is irrelevant but must be unique 
     96    activated = on 
     97    uri = ... 
     98    metadata = ... 
     99     
     100    [[database2]] 
     101    activated = on 
     102    uri = ... 
     103    metadata = ... 
     104 
     105.. wikiname: ApplicationConfiguration 
     106}}}