Edgewall Software

Changes between Version 27 and Version 28 of TracModWSGI


Ignore:
Timestamp:
Feb 2, 2011, 7:01:19 PM (13 years ago)
Author:
Thijs Triemstra
Comment:

fix markup and some misc stuff

Legend:

Unmodified
Added
Removed
Modified
  • TracModWSGI

    v27 v28  
    33'''Important note:''' ''Please use either version 1.6, 2.4 or later of `mod_wsgi`. Versions prior to 2.4 in the 2.X branch have problems with some Apache configurations that use WSGI file wrapper extension. This extension is used in Trac to serve up attachments and static media files such as style sheets. If you are affected by this problem attachments will appear to be empty and formatting of HTML pages will appear not to work due to style sheet files not loading properly. See mod_wsgi tickets [http://code.google.com/p/modwsgi/issues/detail?id=100 #100] and [http://code.google.com/p/modwsgi/issues/detail?id=132 #132].''
    44
    5 [http://code.google.com/p/modwsgi/ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of Apache. The mod_wsgi adapter is written completely in C and provides significantly better performance than using existing WSGI adapters for mod_python or CGI.
     5[http://code.google.com/p/modwsgi/ mod_wsgi] is an Apache module for running WSGI-compatible Python applications directly on top of the Apache webserver. The mod_wsgi adapter is written completely in C and provides significantly better performance compared to existing WSGI adapters for mod_python or CGI.
    66
    7 Trac can be run on top of mod_wsgi with the help of the following application script, which is just a Python file, though usually saved with a .wsgi extension). This file can be created using '''trac-admin <env> deploy <dir>''' command which automatically substitutes required paths.
     7Trac can be run on top of mod_wsgi with the help of the following application script, which is just a Python file, though usually saved with a `.wsgi` extension). This file can be created using the '''trac-admin <env> deploy <dir>''' command which automatically substitutes the required paths.
    88
    99{{{
     
    3434}}}
    3535
    36 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. You can create a .wsgi files which handles all this for you by running the TracAdmin command `deploy`.
     36For clarity, you should give this file a `.wsgi` extension. You should probably put the file in it's own directory, since you will expose its directory to Apache. You can create a .wsgi file which handles all this for you by running the TracAdmin command `deploy`.
    3737
    38 If 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:
     38If you have installed Trac and eggs in a path different from the standard one you should add that path by adding the following code at the top of the wsgi script:
    3939
    4040{{{
     
    4444}}}
    4545
    46 Change it according to the path you installed the trac libs at.
     46Change it according to the path you installed the Trac libs at.
    4747
    48 After you've done preparing your wsgi-script, add the following to your httpd.conf.
     48After you've done preparing your wsgi-script, add the following to your Apache configuration file (`httpd.conf` for example).
    4949
    5050{{{
     
    5858}}}
    5959
    60 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.
     60Here, 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 sub-interpreters 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.
    6161
    62 To 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):
     62To 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):
    6363
    6464{{{
     
    7676== Apache Basic Authentication for Trac thru mod_wsgi ==
    7777
    78 Per the mod_wsgi documentation linked to above, here is an example Apache configuration that a) serves the trac from a virtualhost subdomain and b) uses Apache basic authentication for Trac authentication.
     78Per the mod_wsgi documentation linked to above, here is an example Apache configuration that a) serves the Trac instance from a virtualhost subdomain and b) uses Apache basic authentication for Trac authentication.
    7979
    8080
    81 If you want your trac to be served from e.g. !http://trac.my-proj.my-site.org, then from the folder e.g. {{{/home/trac-for-my-proj}}}, if you used the command {{{trac-admin the-env initenv}}} to create a folder {{{the-env}}}, and you used {{{trac-admin the-env deploy the-deploy}}} to create a folder {{{the-deploy}}}, then:
     81If you want your Trac to be served from e.g. !http://trac.my-proj.my-site.org, then from the folder e.g. {{{/home/trac-for-my-proj}}}, if you used the command {{{trac-admin the-env initenv}}} to create a folder {{{the-env}}}, and you used {{{trac-admin the-env deploy the-deploy}}} to create a folder {{{the-deploy}}}, then first:
    8282
    83 create the htpasswd file:
     83Create the htpasswd file:
    8484{{{
    8585cd /home/trac-for-my-proj/the-env
     
    8888htpasswd htpasswd seconduser
    8989}}}
    90 (for security keep the file above your document root)
     90(keep the file above your document root for security reasons)
    9191
    92 create this file e.g. (ubuntu) {{{/etc/apache2/sites-enabled/trac.my-proj.my-site.org.conf}}} with these contents:
     92Create this file e.g. (ubuntu) {{{/etc/apache2/sites-enabled/trac.my-proj.my-site.org.conf}}} with the following contents:
    9393
    9494{{{
     
    113113}}}
    114114
    115 
    116 (for subdomains to work you would probably also need to alter /etc/hosts and add A-Records to your host's DNS.)
     115Note: for subdomains to work you would probably also need to alter `/etc/hosts` and add A-Records to your host's DNS.
    117116
    118117== Trac with PostgreSQL ==
    119118
    120 When using the mod_wsgi adapter with multiple Trac instances and PostgreSQL (or MySQL?) as a database back-end the server can get a lot of open database connections. (and thus PostgreSQL processes)
     119When using the mod_wsgi adapter with multiple Trac instances and PostgreSQL (or MySQL?) as a database back-end, the server can create a lot of open database connections. (and thus PostgreSQL processes)
    121120
    122 A workable solution is to disabled connection pooling in Trac. This is done by setting poolable = False in trac.db.postgres_backend on the PostgreSQLConnection class.
     121A workable solution is to disabled connection pooling in Trac. This is done by setting `poolable = False` in `trac.db.postgres_backend` on the `PostgreSQLConnection` class.
    123122
    124 But it's not necessary to edit the source of trac, the following lines in trac.wsgi will also work:
     123But it's not necessary to edit the source of Trac, the following lines in `trac.wsgi` will also work:
    125124
    126125{{{