Changes between Version 1 and Version 2 of TracModWSGI


Ignore:
Timestamp:
03/20/12 16:04:32 (6 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracModWSGI

    v1 v2  
    1919}}} 
    2020 
    21 The {{{TRAC_ENV}}} variable should naturally be the directory for your Trac environment (if you have several Trac environments in a directory, you can also use {{{TRAC_ENV_PARENT_DIR}}} instead), while the {{{PYTHON_EGG_CACHE}}} should be a directory where Python can temporarily extract Python eggs. [[BR]] 
    22 For clarity, you should give this file a {{{.wsgi}}} extension. You should probably put the file in it's own directory, since you will open up its directory to Apache. 
    23 You can create a .wsgi files which handles all this for you by running the TracAdmin command {{{deploy}}}. 
     21The {{{ 
     22TRAC_ENV 
     23}}} variable should naturally be the directory for your Trac environment (if you have several Trac environments in a directory, you can also use {{{ 
     24TRAC_ENV_PARENT_DIR 
     25}}} instead), while the {{{ 
     26PYTHON_EGG_CACHE 
     27}}} should be a directory where Python can temporarily extract Python eggs. [[BR]] 
     28For clarity, you should give this file a {{{ 
     29.wsgi 
     30}}} extension. You should probably put the file in it's own directory, since you will open up its directory to Apache. 
     31You can create a .wsgi files which handles all this for you by running the TracAdmin command {{{ 
     32deploy 
     33}}}. 
    2434 
    2535If you have installed trac and eggs in a path different from the standard one you should add that path by adding the following code on top of the wsgi script: 
     
    4252}}} 
    4353 
    44 Here, the script is in a subdirectory of the Trac environment. In order to let Apache run the script, access to the directory in which the script resides is opened up to all of Apache. Additionally, the {{{WSGIApplicationGroup}}} directive ensures that Trac is always run in the first Python interpreter created by mod_wsgi; this is necessary because the Subversion Python bindings, which are used by Trac, don't always work in other subinterpreters and may cause requests to hang or cause Apache to crash as a result. After adding this configuration, restart Apache, and then it should work. 
     54Here, the script is in a subdirectory of the Trac environment. In order to let Apache run the script, access to the directory in which the script resides is opened up to all of Apache. Additionally, the {{{ 
     55WSGIApplicationGroup 
     56}}} directive ensures that Trac is always run in the first Python interpreter created by mod_wsgi; this is necessary because the Subversion Python bindings, which are used by Trac, don't always work in other subinterpreters and may cause requests to hang or cause Apache to crash as a result. After adding this configuration, restart Apache, and then it should work. 
    4557 
    4658To test the setup of Apache, mod_wsgi and Python itself (ie. without involving Trac and dependencies), this simple wsgi application can be used to make sure that requests gets served (use as only content in your .wsgi script): 
     
    89101---- 
    90102See also:  TracGuide, TracInstall, [wiki:TracFastCgi FastCGI], [wiki:TracModPython ModPython], [trac:TracNginxRecipe TracNginxRecipe] 
     103