Movatterモバイル変換


[0]ホーム

URL:


Trac Hacks
wiki:TracCgi

Context Navigation


TheTracGuide is not editable on this site. Changes should insteadbe made on theTrac Development site.

Installing Trac asCGI

Table of Contents

  1. Installing Trac asCGI
    1. Apache web-server configuration
      1. Python Egg Cache
      2. Using WSGI
    2. Mapping Static Resources
    3. Adding Authentication

Please note that using Trac viaCGI is the slowest deployment method available. It is slower thanmod_wsgi,mod_python,FastCGI and evenIIS/AJP on Windows.

CGI script is the entrypoint that web-server calls when a web-request to an application is made. Thetrac.cgi script can be created using thetrac-admin <env> deploy <dir> command which automatically substitutes the required paths, seeTracInstall#cgi-bin. Make sure the script is executable by your web server.

Apache web-server configuration

InApache there are two ways to run Trac asCGI:

  1. Use aScriptAlias directive that maps aURL to thetrac.cgi script (recommended)
  2. Copy thetrac.cgi file into the directory forCGI executables used by your web server (commonly namedcgi-bin). You can also create a symbolic link, but in that case make sure that theFollowSymLinks option is enabled for thecgi-bin directory.

To make Trac available athttp://yourhost.example.org/trac addScriptAlias directive to Apache configuration file, changingtrac.cgi path to match your installation:

Note that this directive requires that themod_alias module is enabled.

If you're using Trac with a single project you need to set its location using theTRAC_ENV environment variable:

Or to use multiple projects you can specify their common parent directory using theTRAC_ENV_PARENT_DIR variable:

Note that theSetEnv directive requires that themod_env module is enabled.

An alternative toSetEnv is editingTRAC_ENV orTRAC_ENV_PARENT_DIR intrac.cgi:

If you are using theApache suEXEC feature please seeApacheSuexec.

On some systems, youmay need to edit the shebang line in thetrac.cgi file to point to your real Python installation path. On a Windows system you may need to configure Windows to know how to execute a.cgi file (Explorer -> Tools -> Folder Options -> File Types ->CGI).

Python Egg Cache

Theegg-cache can be configured using anos.environ statement intrac.cgi, as shown above.To do the same from the Apache configuration, use theSetEnv directive:

SetEnv PYTHON_EGG_CACHE/path/to/dir

Put this directive next to where you set the path to theTrac environment, i.e. in the same<Location> block.

<Location/trac>SetEnv TRAC_ENV/path/to/projenvSetEnv PYTHON_EGG_CACHE/path/to/dir</Location>

Using WSGI

You can run aWSGI handlerunder CGI. You canwrite your own application function, or use the deployed trac.wsgi's application.

Mapping Static Resources

SeeTracInstall#MappingStaticResources.

Adding Authentication

SeeTracInstall#ConfiguringAuthentication.


See also:TracInstall,TracModWSGI,TracFastCgi,TracModPython

Last modified4 years agoLast modified on Dec 29, 2020, 5:09:28 AM

Download in other formats:


Trac Powered

Powered byTrac 1.2.6
ByEdgewall Software.


[8]ページ先頭

©2009-2025 Movatter.jp