Changes between Version 2 and Version 3 of TracModPython
- Timestamp:
- Dec 31, 2005, 4:43:10 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracModPython
v2 v3 1 = Trac とmod_python =1 = Trac and mod_python = 2 2 3 Trac 0.7.1以降のバージョンでは[http://www.modpython.org/ mod_python]がサポートされています。[http://www.modpython.org/ mod_python]はTracのレスポンスタイムを飛躍的に向上し、tracd/mod_proxyでは使用できない多くのApache機能を使えるようにします。3 Trac supports [http://www.modpython.org/ mod_python], which speeds up Trac's response times considerably and permits use of many Apache features not possible with [wiki:TracStandalone tracd]/mod_proxy. 4 4 5 == シンプルなコンフィギュレーション==5 == Simple configuration == 6 6 7 標準的なTrac CGI/Apacheのセットアップは次のようになっています: 7 If you just installed mod_python, you may have to add a line to load the module in the Apache configuration: 8 {{{ 9 LoadModule python_module modules/mod_python.so 10 }}} 8 11 12 A simple setup of Trac on mod_python looks like this: 9 13 {{{ 10 ScriptAlias /projects/myproject /path/to/python/share/trac/cgi-bin/trac.cgi11 14 <Location /projects/myproject> 12 SetEnv TRAC_ENV /var/trac/myproject 15 SetHandler mod_python 16 PythonHandler trac.web.modpython_frontend 17 PythonOption TracEnv /var/trac/myproject 18 PythonOption TracUriRoot /projects/myproject 13 19 </Location> 14 20 }}} 15 21 16 上記に対応するmod_pythonのセットアップは次のようになります: 22 Note that the option `TracUriRoot` may or may not be necessary in your setup. Try without first, and if the URLs produced by Trac look wrong or if Trac does not seem to recognize the URLs correctly, add the `TracUriRoot` option. 17 23 24 Configuring authentication works the same as for [wiki:TracCgi#AddingAuthentication CGI]: 18 25 {{{ 19 <Location /projects/myproject>20 SetHandler mod_python21 PythonHandler trac.ModPythonHandler22 PythonOption TracUriRoot "/projects/myproject"23 PythonOption TracEnv /var/trac/myproject26 <Location "/projects/myproject/login"> 27 AuthType Basic 28 AuthName "myproject" 29 AuthUserFile /var/trac/myproject/.htaccess 30 Require valid-user 24 31 </Location> 25 32 }}} 26 33 27 ''TracUriRoot''オプションは不要な場合もありますのでご注意ください。まずは''TracUriRoot''オプションを付けずに試し、Tracが正しくURLを生成できないようであれば追加するようにしてください。 34 If the Trac installation isn't installed in your Python path, you'll have to tell Apache where to find the Trac mod_python handler using the `PythonPath` directive: 35 {{{ 36 <Location /projects/myproject> 37 ... 38 PythonPath "sys.path + ['/path/to/trac']" 39 ... 40 </Location> 41 }}} 28 42 29 == マルチプロジェクトのセットアップ ==30 43 31 Tracのmod_pythonハンドラはサブバージョンの {{{SvnParentPath}}} とよく似た {{{TracEnvParentDir}}} というコンフィギュレーションオプションをサポートしています。 44 == Setting up multiple projects == 32 45 46 The Trac mod_python handler handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`: 33 47 {{{ 34 48 <Location /projects> 35 49 SetHandler mod_python 36 PythonHandler trac.ModPythonHandler 50 PythonHandler trac.web.modpython_frontend 51 PythonOption TracEnvParentDir /var/trac 37 52 PythonOption TracUriRoot /projects 38 PythonOption TracEnvParentDir "/var/trac" 39 </LocationMatch> 53 </Location> 40 54 }}} 41 55 42 {{{/projects}}} のURLをリクエストすると、{{{TracEnvParentDir}}}として設定したディレクトリ配下のサブディレクトリ一覧(現行では非常にシンプルな)が表示されます。その一覧から何かプロジェクトを選択するとそれに該当するTracのインスタンスを開くことができます。設定したディレクトリの配下には必ず現在インストールされているバージョンにマッチするTrac Environmentのディレクトリのみが置かれているようにしてください。プロジェクトリストの生成前にはそのようなチェックがかからないからです。 56 When you request the `/projects` URL, you will get a listing of all subdirectories of the directory you set as `TracEnvParentDir`. Selecting any project in the list will bring you to the corresponding Trac environment. 43 57 58 If you don't want to have the subdirectory listing as your projects home page you can use a 59 {{{ 60 <LocationMatch "/.+/"> 61 }}} 44 62 45 === ユーザ認証の追加 === 63 This will instruct Apache to use mod_python for all locations different from root while having the possibility of placing a custom home page for root in your !DocumentRoot folder. 46 64 47 ユーザ認証の追加はどちらの場合も簡単です。次に例を示します: 48 65 You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive: 49 66 {{{ 50 <LocationMatch /projects/[[:alnum:]]+/login>67 <LocationMatch "/[^/]+/login"> 51 68 AuthType Basic 52 69 AuthName "Trac" 53 AuthUserFile /var/ www/passwd70 AuthUserFile /var/trac/.htaccess 54 71 Require valid-user 55 72 </LocationMatch> 56 73 }}} 57 74 75 == Virtual Host Configuration == 76 77 Below is the sample configuration required to set up your trac as a virtual server (i.e. when you access it at the URLs like 78 !http://trac.mycompany.com): 79 80 {{{ 81 <VirtualHost * > 82 DocumentRoot /var/trac/myproject 83 ServerName trac.mycompany.com 84 <Directory /> 85 SetHandler mod_python 86 PythonHandler trac.web.modpython_frontend 87 PythonOption TracEnv /var/trac/myproject 88 PythonOption TracUriRoot / 89 </Directory> 90 <Location /login> 91 AuthType Basic 92 AuthName "MyCompany Trac Server" 93 AuthUserFile /var/trac/myproject/.htusers 94 Require valid-user 95 </Location> 96 </VirtualHost> 97 }}} 98 99 == Troubleshooting == 100 101 === Form submission problems === 102 103 If you're experiencing problems submitting some of the forms in Trac (a common problem is that you get redirected to the start page after submission), check whether your {{{DocumentRoot}}} contains a folder or file with the same path that you mapped the mod_python handler to. For some reason, mod_python gets confused when it is mapped to a location that also matches a static resource. 104 105 === Using .htaccess === 106 107 Although it may seem trivial to rewrite the above configuration as a directory in your document root with a `.htaccess` file, this does not work. Apache will append a "/" to any Trac URLs, which interferes with its correct operation. 108 109 It may be possible to work around this with mod_rewrite, but I failed to get this working. In all, it is more hassle than it is worth. Stick to the provided instructions. :) 110 58 111 === Win32 Issues === 59 112 60 Windows 上で mod_python から Trac を使用すると、ファイル添付機能が使用できません。 113 If you run trac with mod_python (3.1.3 or 3.1.4) on Windows, 114 uploading attachments will '''not''' work. 115 This is a known problem which we can't solve cleanly at the Trac level. 61 116 62 これについては(簡単な)回避策があります。 63 ticket[http://projects.edgewall.com/trac/ticket/554 #554]に添付されているパッチを適用してください。 117 However, there is a workaround for this at the mod_python level, 118 which is to apply the following patch [http://projects.edgewall.com/trac/attachment/ticket/554/util_py.patch attachment:ticket:554:util_py.patch] 119 to the (Lib/site-packages)/modpython/util.py file. 64 120 121 If you don't have the `patch` command, that file can be replaced with the [http://svn.apache.org/viewcvs.cgi/httpd/mod_python/trunk/lib/python/mod_python/util.py?rev=103562&view=markup fixed util.py] (fix which, although done prior to the 3.1.4 release, is ''not'' 122 present in 3.1.4). 123 124 === OS X issues === 125 126 When using mod_python on OS X you will not be able to restart Apache using `apachectl restart`. This is apparently fixed in mod_python 3.2, but there's also a patch available for earlier versions [http://www.dscpl.com.au/projects/vampire/patches.html here]. 65 127 66 128 ---- 67 参考 TracGuide, TracInstall, TracMultipleProjects 129 See also TracGuide, TracInstall, TracCgi, TracFastCgi