Changes between Initial Version and Version 1 of TracPlugins


Ignore:
Timestamp:
Oct 11, 2005, 12:24:32 AM (19 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracPlugins

    v1 v1  
     1= Trac Plugins =
     2
     3Since version 0.9, Trac supports plugins that extend the built-in functionality. The plugin functionality is based on the [http://projects.edgewall.com/trac/wiki/TracDev/ComponentArchitecture component architecture].
     4
     5== Requirements ==
     6
     7To use plugins in Trac, you need to have [http://peak.telecommunity.com/DevCenter/setuptools setuptools] (version 0.5 or 0.6) installed.
     8
     9To install `setuptools`, download the bootstrap module [http://peak.telecommunity.com/dist/ez_setup.py ez_setup.py] and execute it as follows:
     10{{{
     11$ python ez_setup.py
     12}}}
     13
     14If the `ez_setup.py` script fails to install the setuptools release, you can download it from [http://www.python.org/pypi/setuptools PyPI] and install it manually.
     15
     16== Installing a Trac Plugin ==
     17
     18=== For a Single Project ===
     19
     20Plugins are packaged as [http://peak.telecommunity.com/DevCenter/PythonEggs Python eggs]. That means they are ZIP archives with the file extension `.egg`. If you have downloaded a source distribution of a plugin, you can run:
     21{{{
     22$ python setup.py bdist_egg
     23}}}
     24to build the `.egg` file.
     25
     26Once you have the plugin archive, you need to copy it into the `plugins` directory of the [wiki:TracEnvironment project environment]. Also, make sure that the web server has sufficient permissions to read the plugin egg.
     27
     28=== For All Projects ===
     29
     30Plugins that you want to use in all your projects (such as [http://projects.edgewall.com/trac/wiki/WebAdmin WebAdmin]) can be installed globally by running:
     31{{{
     32$ python setup.py install
     33}}}
     34
     35Alternatively, you can just drop the `.egg` file in the Python `site-packages` directory.
     36
     37== Setting up the Plugin Cache ==
     38
     39Some plugins will need to be extracted by the Python eggs runtime (`pkg_resources`), so that their contents are actual files on the file system. The directory in which they are extracted defaults to the home directory of the current user, which may or may not be a problem. You can however override the default location using the `PYTHON_EGG_CACHE` environment variable.
     40
     41To do this from the Apache configuration, use the `SetEnv` directive as follows:
     42{{{
     43SetEnv PYTHON_EGG_CACHE /path/to/dir
     44}}}
     45
     46This works whether your using the [wiki:TracCgi CGI] or the [wiki:TracModPython mod_python] front-end. Put this directive next to where you set the path to the [wiki:TracEnvironment Trac environment], i.e. in the same `<Location>` block.
     47
     48For example (for CGI):
     49{{{
     50 <Location /trac>
     51   SetEnv TRAC_ENV /path/to/projenv
     52   SetEnv PYTHON_EGG_CACHE /path/to/dir
     53 </Location>
     54}}}
     55
     56or (for mod_python):
     57{{{
     58 <Location /trac>
     59   SetHandler mod_python
     60   ...
     61   SetEnv PYTHON_EGG_CACHE /path/to/dir
     62 </Location>
     63}}}
     64
     65For [wiki:TracFastCgi FastCGI], you'll need to `-initial-env` option, or whatever is provided by your web server for setting environment variables.
     66
     67----
     68See also TracGuide, [wiki:TracDev/ComponentArchitecture component architecture]