Changes between Version 3 and Version 4 of TracModPython


Ignore:
Timestamp:
Dec 30, 2016, 2:54:47 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TracModPython

    v3 v4  
    1 = Trac と mod_python = #Tracandmod_python
    21[[TracGuideToc]]
    32
    4 Trac では [http://www.modpython.org/ mod_python] を利用可能です。 [http://www.modpython.org/ mod_python] は Trac のレスポンスタイムを飛躍的に向上し、特に [TracCgi CGI] と比べて、 [wiki:TracStandalone tracd]/mod_proxy では使用できない多くの Apache 機能を使えるようにします。
    5 
    6 {{{#!div class="important"
    7 ** A Word of Warning **
    8 
    9 2010 年 6 月 16 日に、 mod_python プロジェクトが正式に終了しました。もし mod_python を新しいインストールで使用することを考えているならば、 '''お願いだからしないで下さい'''! 解決されない既知の課題がありますし、今ではより良い代替手段もあります。詳細については、インストールしようとしているバージョンの TracInstall ページをチェックして下さい。
    10 }}}
    11 
    12 
    13 以下の説明は Apache2 のためのものです; まだ Apache1.3 を使用しているなら、 [trac:TracModPython2.7 TracModPython2.7] にいくつか情報がありますが、すべてあなた一人で設定することになるでしょう。
     3= Trac and mod_python
     4
     5Mod_python is an [https://httpd.apache.org/ Apache] module that embeds the Python interpreter within the server, so that web-based applications in Python will run many times faster than traditional CGI and will have the ability to retain database connections.
     6Trac supports [http://www.modpython.org/ mod_python], which speeds up Trac's response times considerably, especially compared to [TracCgi CGI], and permits use of many Apache features not possible with [wiki:TracStandalone tracd]/mod_proxy.
    147
    158[[PageOutline(2-3,Overview,inline)]]
    169
    17 == シンプルな設定: 単一プロジェクト == #Simpleconfiguration
    18 
    19 mod_python をインストールしたら、 Apache の設定ファイルに以下の一行を追加してモジュールをロードしなければなりません:
    20 {{{
     10== Simple configuration: single project #Simpleconfiguration
     11
     12If you just installed mod_python, you may have to add a line to load the module in the Apache configuration:
     13{{{#!apache
    2114LoadModule python_module modules/mod_python.so
    2215}}}
    2316
    24 ''Note: モジュールがインストールされている正しいパスは HTTPD をどこにインストールしたかによって変わります。''
    25 
    26 Debian で apt-get を使用する場合
    27 {{{
     17'''Note''': The exact path to the module depends on how the HTTPD installation is laid out.
     18
     19On Debian using apt-get:
     20{{{#!sh
    2821apt-get install libapache2-mod-python libapache2-mod-python-doc
    2922}}}
    30 (Debian の続き) mod_python をインストールした後に、apache2 (上の Load Module に相当するもの) のモジュールを有効にしなければなりません :
    31 {{{
     23
     24Still on Debian, after you have installed mod_python, you must enable the modules in apache2, equivalent to the above Load Module directive:
     25{{{#!sh
    3226a2enmod python
    3327}}}
    34 Fedora で yum を使用する場合:
    35 {{{
     28
     29On Fedora use, using yum:
     30{{{#!sh
    3631yum install mod_python
    3732}}}
    38 httpd.conf に以下を加えることで、 mod_python がインストールされたかテストすることができます。セキュリティ上の理由から、テストが終わった時点で以下のコンフィグは削除するべきです。 Note: mod_python.testhandler は mod_python 3.2+ で利用可能です。
    39 {{{
    40 #!xml
     33
     34You can test your mod_python installation by adding the following to your httpd.conf. You should remove this when you are done testing for security reasons. Note: mod_python.testhandler is only available in mod_python 3.2+.
     35{{{#!apache
    4136<Location /mpinfo>
    42    SetHandler mod_python
    43    PythonInterpreter main_interpreter
    44    PythonHandler mod_python.testhandler
    45    Order allow,deny
    46    Allow from all
    47 </Location>
    48 }}}
    49 
    50 mod_python を使用した簡単な Trac のセットアップ方法は以下のようになります:
    51 {{{
    52 #!xml
     37  SetHandler mod_python
     38  PythonInterpreter main_interpreter
     39  PythonHandler mod_python.testhandler
     40  # For Apache 2.2
     41  <IfModule !mod_authz_core.c>
     42    Order allow,deny
     43    Allow from all
     44  </IfModule>
     45  # For Apache 2.4
     46  <IfModule mod_authz_core.c>
     47    Require all granted
     48  </IfModule>
     49</Location>
     50}}}
     51
     52A simple setup of Trac on mod_python looks like this:
     53{{{#!apache
    5354<Location /projects/myproject>
    54    SetHandler mod_python
    55    PythonInterpreter main_interpreter
    56    PythonHandler trac.web.modpython_frontend
    57    PythonOption TracEnv /var/trac/myproject
    58    PythonOption TracUriRoot /projects/myproject
    59    Order allow,deny
    60    Allow from all
    61 </Location>
    62 }}}
    63 
    64 '''`TracUriRoot`''' オプションは不要な場合もあります。 `TracUriRoot` オプションを付けずに試し、 Trac が正しく URL を生成できないか、 "No handler matched request to..." というエラーが出るようであれば '''`TracUriRoot`''' を追加して下さい。 `Location` と '''`TracUriRoot`''' が同じパスになるようにしてください。
    65 
    66 !PythonOption の一覧は以下の通りです。
    67 {{{
    68     # For a single project
    69     PythonOption TracEnv /var/trac/myproject
    70 
    71     # For multiple projects
    72     PythonOption TracEnvParentDir /var/trac/myprojects
    73 
    74     # For the index of multiple projects
    75     PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html
    76 
    77     # A space delimitted list, with a "," between key and value pairs.
    78     PythonOption TracTemplateVars key1,val1 key2,val2
    79 
    80     # Useful to get the date in the wanted order
    81     PythonOption TracLocale en_GB.UTF8
    82 
    83     # See description above
    84     PythonOption TracUriRoot /projects/myproject
    85 }}}
    86 
    87 === Python Egg Cache === #PythonEggCache
    88 
    89 Genshi のように圧縮された Python egg は通常、実行するユーザのホームディレクトリ配下の `.python-eggs` ディレクトリに展開されます。  Apache のホームディレクトリは多くの場合、書き込みできないようになっているので、他のディレクトリを egg cache として指定しなければなりません:
    90 {{{
     55  SetHandler mod_python
     56  PythonInterpreter main_interpreter
     57  PythonHandler trac.web.modpython_frontend
     58  PythonOption TracEnv /var/trac/myproject
     59  PythonOption TracUriRoot /projects/myproject
     60  # For Apache 2.2
     61  <IfModule !mod_authz_core.c>
     62    Order allow,deny
     63    Allow from all
     64  </IfModule>
     65  # For Apache 2.4
     66  <IfModule mod_authz_core.c>
     67    Require all granted
     68  </IfModule>
     69</Location>
     70}}}
     71
     72The option '''`TracUriRoot`''' may or may not be necessary in your setup. Try your configuration without it; if the URLs produced by Trac look wrong, if Trac does not seem to recognize URLs correctly, or you get an odd "No handler matched request to..." error, add the '''`TracUriRoot`''' option. You will notice that the `Location` and '''`TracUriRoot`''' have the same path.
     73
     74The options available are:
     75{{{#!apache
     76# For a single project
     77PythonOption TracEnv /var/trac/myproject
     78
     79# For multiple projects
     80PythonOption TracEnvParentDir /var/trac/myprojects
     81
     82# For the index of multiple projects
     83PythonOption TracEnvIndexTemplate /srv/www/htdocs/trac/project_list_template.html
     84
     85# A space delimitted list, with a "," between key and value pairs.
     86PythonOption TracTemplateVars key1,val1 key2,val2
     87
     88# Useful to get the date in the wanted order
     89PythonOption TracLocale en_GB.UTF8
     90
     91# See description above       
     92PythonOption TracUriRoot /projects/myproject
     93}}}
     94
     95=== Python Egg Cache
     96
     97Compressed Python eggs like Genshi are normally extracted into a directory named `.python-eggs` in the users home directory. Since Apache's home usually is not writeable, an alternate egg cache directory can be specified like this:
     98{{{#!apache
    9199PythonOption PYTHON_EGG_CACHE /var/trac/myprojects/egg-cache
    92100}}}
    93101
    94 又は Genshi の egg を解凍して展開することで、この問題を回避できます。
    95 
    96 === 認証設定 === #ConfiguringAuthentication
    97 
    98 [wiki:TracModWSGI#ConfiguringAuthentication] ページの対応する項目を参照してください。
    99 
    100 
    101 == 詳細な設定 == #AdvancedConfiguration
    102 
    103 === Python Egg Cache を設定する === #SettingthePythonEggCache
    104 
    105 Web サーバが Egg Cache に書き込みできない場合、パーミッションを変更するか、 Apache が書き込み可能な場所を指定する必要があります。設定しないと ''500 Internal Server Error'' や syslog へのエラー出力が発生します。
    106 
    107 {{{
    108 #!xml
     102Or you can uncompress the Genshi egg to resolve problems extracting from it.
     103
     104=== Configuring Authentication
     105
     106See corresponding section in the [wiki:TracModWSGI#ConfiguringAuthentication] page.
     107
     108== Advanced Configuration
     109
     110=== Setting the Python Egg Cache
     111
     112If the Egg Cache isn't writeable by your Web server, you'll either have to change the permissions, or point Python to a location where Apache can write. This can manifest itself as a `500 internal server error` and/or a complaint in the syslog.
     113
     114{{{#!apache
    109115<Location /projects/myproject>
    110116  ...
    111   PythonOption PYTHON_EGG_CACHE /tmp
    112   ...
    113 </Location>
    114 }}}
    115 
    116 
    117 === !PythonPath を設定する === #SettingthePythonPath
    118 
    119 もし Trac のインストールが、通常の Python ライブラリのパスの中に無い場合、 Apache が Trac の mod_python ハンドラを見つけられるように `PythonPath` ディレクティブで指定しなければなりません:
    120 {{{
    121 #!xml
     117  PythonOption PYTHON_EGG_CACHE /tmp
     118  ...
     119</Location>
     120}}}
     121
     122=== Setting the !PythonPath
     123
     124If the Trac installation isn't installed in your Python path, you will have to tell Apache where to find the Trac mod_python handler  using the `PythonPath` directive:
     125{{{#!apache
    122126<Location /projects/myproject>
    123127  ...
     
    127131}}}
    128132
    129 !PythonPath ディレクティブを使用するときは気をつけてください。そして、 `SetEnv PYTHONPATH` は動かないので ''使用しない'' で下さい。
    130 
    131 === マルチプロジェクトのセットアップ === #Settingupmultipleprojects
    132 
    133 Trac の mod_python ハンドラには Subversion の `SvnParentPath` とよく似た `TracEnvParentDir` というコンフィグレーションオプションがあります。
    134 {{{
    135 #!xml
     133Be careful about using the !PythonPath directive, and ''not'' `SetEnv PYTHONPATH`, as the latter won't work.
     134
     135=== Setting up multiple projects
     136
     137The Trac mod_python handler supports a configuration option similar to Subversion's `SvnParentPath`, called `TracEnvParentDir`:
     138{{{#!apache
    136139<Location /projects>
    137140  SetHandler mod_python
    138141  PythonInterpreter main_interpreter
    139   PythonHandler trac.web.modpython_frontend
     142  PythonHandler trac.web.modpython_frontend 
    140143  PythonOption TracEnvParentDir /var/trac
    141144  PythonOption TracUriRoot /projects
     
    143146}}}
    144147
    145 `/projects` の URL をリクエストすると、 TracEnvironment の親ディレクトリ `TracEnvParentDir` として設定したディレクトリ配下のサブディレクトリ一覧が表示されます。その一覧から何かプロジェクトを選択するとそれに該当する TracEnvironment を開くことができます。
    146 
    147 あなたのプロジェクトのホームページとして、サブディレクトリのリストが必要ないならば、以下のようにすることができます
    148 {{{
    149 #!xml
     148When you request the `/projects` URL, you will get a listing of all subdirectories of the directory you set as `TracEnvParentDir` that look like Trac environment directories. Selecting any project in the list will bring you to the corresponding Trac environment.
     149
     150If you don't want to have the subdirectory listing as your projects home page you can use a
     151{{{#!apache
    150152<LocationMatch "/.+/">
    151153}}}
    152154
    153 これは !DocumentRoot フォルダの直下にカスタムホームページとして配置されていない場合には、すべてのロケーションで代わりに mod_python を使用することを Apache に教えます。
    154 
    155 すべてのプロジェクトに対して、 `<LocationMatch>` ディレクティブを使用することによって同じ認証の仕組みを使用することができます。
    156 {{{
    157 #!xml
     155This 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.
     156
     157You can also use the same authentication realm for all of the projects using a `<LocationMatch>` directive:
     158{{{#!apache
    158159<LocationMatch "/projects/[^/]+/login">
    159160  AuthType Basic
     
    164165}}}
    165166
    166 === 仮想ホストの設定 === #VirtualHostConfiguration
    167 
    168 以下に示す例は Trac を仮想サーバーとしてセットアップするときに必要な設定です。 (例えば、!http://trac.mycompany.com といった
    169 URL でアクセスすることができます):
    170 
    171 {{{
    172 #!xml
    173 <VirtualHost * >
     167=== Virtual Host Configuration
     168
     169Below is the sample configuration required to set up your Trac as a virtual server, ie when you access it at the URLs like
     170`http://trac.mycompany.com`:
     171
     172{{{#!apache
     173<VirtualHost *>
    174174    DocumentRoot /var/www/myproject
    175175    ServerName trac.mycompany.com
     
    190190}}}
    191191
    192 この設定は全てのケースでうまく動くわけではありません。動かない場合は以下を試してください:
    193  * `<Location>` の代わりに `<LocationMatch>` を使用する
    194  * <Location />  はサーバの設定によっては、単にサーバのルートではなく完全なホスト名を参照していることがあります。このような場合、 (上記の例では下段にあたるログイン用ディレクトリを含む) 全てのリクエストが Python に送信され、認証が動かなくなります (認証を行おうとすると、認証が設定されていないというエラー画面が表示されます)。 URL を変更できるのであれば (/, /login の代わりに /web/, /web/login などのように) ルートではなくサブディレクトリを使ってみてください
    195  * Apache の `NameVirtualHost` を設定している場合、 `<VirtualHost *>` ではなく `<VirtualHost *:80>` を使用せねばならないかもしれません
    196 
    197 複数のプロジェクトをサポートする仮想ホストの設定では、 "`TracEnv`" /var/trac/myproject を "`TracEnvParentDir`" /var/trac/ に置き換えて下さい。
    198 
    199 Note: !DocumentRoot は TracEnvironment と同じディレクトリにしないでください。 何かのバグがあった場合に TracEnvironment の内容が外部からアクセス可能になってしまうおそれがあります。
    200 
    201 == トラブルシューティング == #Troubleshooting
    202 
    203 サーバエラーのページがでたときには、 まずは Apache のエラーログを確認するか、 `PythonDebug` オプションを有効にして下さい:
    204 {{{
    205 #!xml
     192This does not seem to work in all cases. What you can do if it does not:
     193 * Try using `<LocationMatch>` instead of `<Location>`.
     194 * `<Location />` may, in your server setup, refer to the complete host instead of simple the root of the server. This means that everything (including the login directory referenced below) will be sent to Python and authentication does not work, ie you get the infamous Authentication information missing error. If this is the case, try using a sub-directory for Trac instead of the root, ie /web/ and /web/login instead of / and /login.
     195 * Depending on apache's `NameVirtualHost` configuration, you may need to use `<VirtualHost *:80>` instead of `<VirtualHost *>`.
     196
     197For a virtual host that supports multiple projects replace `TracEnv /var/trac/myproject` with `TracEnvParentDir /var/trac`.
     198
     199'''Note''': !DocumentRoot should not point to your Trac project env. As Asmodai wrote on #trac: "suppose there's a webserver bug that allows disclosure of !DocumentRoot they could then leech the entire Trac environment".
     200
     201== Troubleshooting
     202
     203If you get server error pages, you can either check the Apache error log, or enable the `PythonDebug` option:
     204{{{#!apache
    206205<Location /projects/myproject>
    207206  ...
     
    210209}}}
    211210
    212 複数プロジェクトの場合は、全てのプロジェクトでサーバを再起動してみてください。
    213 
    214 === 動作しないログイン === #LoginNotWorking
    215 `<Location />` ディレクティブを使用した場合、 他のディレクティブ同様、`<Location /Login>` ディレクティブをオーバーライドします。
    216 この問題を回避するには、次のように否定表現を使用します (マルチプロジェクト設定向け):
    217 {{{
    218 #!xml
     211For multiple projects, try restarting the server as well.
     212
     213=== Login Not Working
     214
     215If you've used `<Location />` directive, it will override any other directives, as well as `<Location /login>`.
     216The workaround is to use negation expression as follows (for multi project setups):
     217{{{#!apache
    219218#this one for other pages
    220219<Location ~ "/*(?!login)">
     
    223222   PythonOption TracEnvParentDir /projects
    224223   PythonOption TracUriRoot /
    225 
    226 </Location>
     224</Location>
     225
    227226#this one for login page
    228227<Location ~ "/[^/]+/login">
     
    233232
    234233   #remove these if you don't want to force SSL
    235    RewriteEngine On
     234   RewriteEngine On 
    236235   RewriteCond %{HTTPS} off
    237236   RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
     
    246245=== Expat-related segmentation faults === #expat
    247246
    248 この問題は Unix 上で Python 2.4 を使用するとき、ほぼ確実に発生します。
    249 Python 2.4 の使用する Expat (C で書かれた XML パーザライブラリ) と
    250 Apache の使用する Expat のバージョンが異なる場合に、セグメンテーションフォルトが発生します。
    251 Trac 0.11 は Genshi (間接的に Expat が使用される) を使用しているため、
    252 以前 Trac 0.10 で正常に動いていたとしても、現在のあなたの環境で問題が起こり得ます。
    253 
    254 Graham Dumpleton が、この問題について詳しく書いています。問題の [http://www.dscpl.com.au/wiki/ModPython/Articles/ExpatCausingApacheCrash 説明と回避方法] を確認してください。
    255 
    256 === フォームを送信するときの問題 === #Formsubmissionproblems
    257 
    258 もし、 Trac で何かしらのフォームを送信したときに、トラブルに見舞われたら (送信後にスタートページにリダイレクトされてしまう、などがよくある問題です)  {{{DocumentRoot}}} の中に mod_python をマッピングしたパスと同じフォルダやファイルが存在しないか確認してください。どういうわけか、 mod_python は静的リソースと同じところにマッピングされると混乱してしまいます。
    259 
    260 === 仮想ホストの設定においての問題 === #Problemwithvirtualhostconfiguration
    261 
    262 <Location /> ディレクティブが使用されている場合に `DocumentRoot` を設定すると ''403 (Forbidden)'' エラーになることがあります。 `DocumentRoot` ディレクティブを削除するか、アクセスが許されているディレクトリに設定されているかどうかを確認して下さい (対応する `<Directory>` ブロックにて)
    263 
    264 <Location /> で `SetHandler` を使用すると、すべてを mod_python でハンドルすることになりますが、いかなる CSS も image/icons もダウンロードできなくなります。この問題を回避するために、われわれは <Location /trac> で `SetHandler None` を使用しています。しかし、この方法がエレガントな解決方法だとは思っていません。
    265 
    266 === Zip された egg での問題 === #Problemwithzippedegg
    267 
    268 mod_python のバージョンによっては Zip された egg ファイルからモジュールを import できないことがあります。 Apache のログに `ImportError: No module named trac` が出力される場合、問題が発生している原因であると考えられます。 Python の site-packages ディレクトリを見てみてください。 Trac のモジュールが ''ディレクトリ'' ではなく ''ファイル'' として配置されている場合、問題の原因と考えられます。解決するためには、下記の上に `--always-unzip` オプションと伴に Trac をインストールしてみてください。
    269 
    270 {{{
    271 easy_install --always-unzip Trac-0.12.zip
    272 }}}
    273 
    274 === .htaccess ファイルを使用する === #Using.htaccess
    275 
    276 ディレクトリの設定をほんのちょっと修正するには `.htaccess` ファイルを使用すればいいかもしれませんが、これは動作しません。 Apache が Trac の URL に "/" (スラッシュ) を追加すると、正しい動作を妨げてしまいます。
    277 
    278 それでは、 mod_rewrite を使用すればいいように見えますが、これも動作しません。とにかく、百害あって一利なしです。指示に従ってください。 :)
    279 
    280 成功した事例:  以下の設定値で成功した事例があります:
    281 {{{#!xml
     247This problem will most certainly hit you on Unix when using Python 2.4.
     248In Python 2.4, some version of [http://expat.sourceforge.net/ Expat] (an XML parser library written in C) is used and if Apache is using another version, this results in segmentation faults.
     249As Trac 0.11 is using Genshi, which will indirectly use Expat, that problem can now hit you even if everything was working fine before with Trac 0.10. This problem has not been reported for Python 2.5+, so best to upgrade.
     250
     251=== Form submission problems
     252
     253If 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.
     254
     255=== Problem with virtual host configuration
     256
     257If the <Location /> directive is used, setting the `DocumentRoot` may result in a ''403 (Forbidden)'' error. Either remove the `DocumentRoot` directive, or make sure that accessing the directory it points is allowed, in a corresponding `<Directory>` block.
     258
     259Using <Location /> together with `SetHandler` resulted in having everything handled by mod_python, which leads to not being able to download any CSS or images/icons. Use <Location /trac> `SetHandler None` </Location> to circumvent the problem, though this may not be the most elegant solution.
     260
     261=== Problem with zipped egg
     262
     263It's possible that your version of mod_python will not import modules from zipped eggs. If you encounter an `ImportError: No module named trac` in your Apache logs but you think everything is where it should be, this might be your problem. Look in your site-packages directory; if the Trac module appears as a ''file'' rather than a ''directory'', then this might be your problem. To rectify this, try installing Trac using the `--always-unzip` option:
     264
     265{{{#!sh
     266easy_install --always-unzip Trac-0.12b1.zip
     267}}}
     268
     269=== Using .htaccess
     270
     271Although 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.
     272
     273It 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.
     274
     275This also works out-of-box, with following trivial config:
     276{{{#!apache
    282277SetHandler mod_python
    283278PythonInterpreter main_interpreter
    284 PythonHandler trac.web.modpython_frontend
     279PythonHandler trac.web.modpython_frontend 
    285280PythonOption TracEnv /system/path/to/this/directory
    286281PythonOption TracUriRoot /path/on/apache
     
    292287}}}
    293288
    294 `TracUriRoot` は Web ブラウザが取得する Trac のパスを明示的に設定するのに使用します。 (例: domain.tld/projects/trac)
    295 
    296 === .htaccess 使用時の特記事項 === #Additional.htaccesshelp
    297 
    298 .htaccess を使用している場合、 Trac のディレクトリが他のディレクトリで設定されたた .htaccess ディレクティブを継承し、問題を生じることがあります。このような場合、以下のように .htaccess ファイルに設定してみて下さい:
    299 
    300 {{{
     289The `TracUriRoot` is obviously the path you need to enter to the browser to get to Trac, eg `domain.tld/projects/trac`.
     290
     291=== Additional .htaccess help
     292
     293If you are using the .htaccess method you may have additional problems if your Trac directory is inheriting .htaccess directives from another. This may also help to add to your .htaccess file:
     294
     295{{{#!apache
    301296<IfModule mod_rewrite.c>
    302297  RewriteEngine Off
     
    304299}}}
    305300
    306 === 特定のプラットフォームでの問題 === #Platformspecificissues
    307 ==== Win32 での問題 ==== #Win32issues
    308 Windows 上で mod_python 3.2 より前のバージョンで Trac を動かしている場合、添付ファイルのアップロードが '''動かない''' でしょう。この問題は 3.1.4 以降で解決されました。 mod_python をアップグレードしてこの問題を解決してください。
    309 
    310 
    311 ==== OS X での問題 ==== #OSXissues
    312 
    313 OS X で mod_python を使用するとき、 `apachectl restart` コマンドで Apache の再起動ができないでしょう。これは、 mod_python 3.2 でおそらく修正されるでしょう。しかし、 [http://www.dscpl.com.au/projects/vampire/patches.html ここ] にあるパッチを適用すれば、 3.2 以前のバージョンでもこの問題を回避できます。
    314 
    315 ==== SELinux での問題 ==== #SELinuxissues
    316 
    317 もし、 Trac が ''Cannot get shared lock on db.lock'' というようなメッセージが出力したら、
    318 リポジトリに セキュリティコンテキストを設定する必要があるでしょう:
    319 
    320 {{{
     301=== Platform specific issues
     302==== Win32 Issues
     303
     304If you run Trac with mod_python < 3.2 on Windows, uploading attachments will '''not''' work. This problem is resolved in mod_python 3.1.4 or later, so please upgrade mod_python to fix this.
     305
     306==== OS X issues
     307
     308When 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, so please upgrade mod_python to fix this.
     309
     310==== SELinux issues
     311
     312If Trac reports something like: `Cannot get shared lock on db.lock`, then the security context on the repository may need to be set:
     313
     314{{{#!sh
    321315chcon -R -h -t httpd_sys_content_t PATH_TO_REPOSITORY
    322316}}}
    323317
    324 [http://subversion.tigris.org/faq.html#reposperms] も参考にして下さい
    325 
    326 ==== FreeBSD での問題 ==== #FreeBSDissues
    327 mod_python と sqlite パッケージのインストールバージョンに注意して下さい。 Ports には両パッケージともいろいろなバージョンがありますが、初期の pysqlite と mod_python は組み合わせることができません。前者は python のスレッド機能サポートが必要ですし、 後者 は python のスレッド機能なしのインストールが必要です。
    328 
    329 apache2 を普通にコンパイルしてインストールした場合、 apache はスレッドのサポートなしになります (これが FreeBSD 上であまりよく動かない原因)。 --enable-threads を使用して ./configure を実行することで apache にスレッドのサポートありにすることができますが、これはお勧めできません。
    330 最良のオプションは /usr/local/apache2/bin/ennvars に下記の一行を追加することだと [http://modpython.org/pipermail/mod_python/2006-September/021983.html 考えられます。]
    331 
    332 {{{
     318See also [http://subversion.apache.org/faq.html#reposperms How do I set repository permissions correctly?]
     319
     320==== FreeBSD issues
     321
     322The FreeBSD ports have both the new and old versions of mod_python and SQLite, but earlier versions of pysqlite and mod_python won't integrate:
     323 * pysqlite requires threaded support in Python
     324 * mod_python requires a threadless install.
     325
     326Apache2 does not automatically support threads on FreeBSD. You could force thread support when running `./configure` for Apache, using `--enable-threads`, but this isn´t recommended.
     327The best option [http://modpython.org/pipermail/mod_python/2006-September/021983.html seems to be] adding to /usr/local/apache2/bin/ennvars the line:
     328
     329{{{#!sh
    333330export LD_PRELOAD=/usr/lib/libc_r.so
    334331}}}
    335332
    336 
    337 ==== Fedora 7 での問題 ==== #Fedore7Issues
    338 'python-sqlite2' を必ずインストールしてください。tracd では必須ではありませんが、 TracModPython では必須です。
    339 
    340 
    341 === Subversion での問題 === #Subversionissues
    342 
    343 コマンドラインや TracStandalone で使用しているときは動くのに、 mod_python を使用しているときのみ、 `Unsupported version control system "svn"` というエラーが出力される場合、 [wiki:"TracModPython#SettingthePythonPath" PythonPath] ディレクティブに Python bindings へのパスを追加するのを忘れている可能性があります。 (Python の `site-packages` ディレクトリに Python binding へのリンクを追加するか、 `.pth` ファイルを作っておくのがベターです。)
    344 
    345 これに当てはまらない場合、使用している Subversion のライブラリが Apache が使用しているバージョンと適合性がないかもしれません。 (たいてい `apr` ライブラリの不適合性が原因になります。) その場合、 Apache の svn モジュール (`mod_dav_svn`) も使用できないでしょう。
    346 
    347 また、ランタイムエラー ({{{argument number 2: a 'apr_pool_t *' is expected}}}) を抑止するためにも、複数のサブインタプリタを使用できる最近のバージョンの `mod_python` が必要になります。 3.2.8 では ''たぶん'' 動きますが、 [trac:#3371] に記述されている通り、メインインタプリタを使用するように強制するワークアラウンドを使用する方がおそらく良いでしょう:
    348 {{{
     333==== Fedora 7 Issues
     334
     335Make sure you install the 'python-sqlite2' package as it seems to be required for TracModPython, but not for tracd.
     336
     337=== Subversion issues
     338
     339If you get the following Trac error `Unsupported version control system "svn"` only under mod_python, though it works well on the command-line and even with TracStandalone, chances are that you forgot to add the path to the Python bindings with the [TracModPython#ConfiguringPythonPath PythonPath] directive. A better way is to add a link to the bindings in the Python `site-packages` directory, or create a `.pth` file in that directory.
     340
     341If this is not the case, it's possible that you are using Subversion libraries that are binary incompatible with the Apache ones and an incompatibility of the `apr` libraries is usually the cause. In that case, you also won't be able to use the svn modules for Apache (`mod_dav_svn`).
     342
     343You also need a recent version of `mod_python` in order to avoid a runtime error ({{{argument number 2: a 'apr_pool_t *' is expected}}}) due to the default usage of multiple sub-interpreters. Version 3.2.8 ''should'' work, though it's probably better to use the workaround described in [trac:#3371 #3371], in order to force the use of the main interpreter:
     344{{{#!apache
    349345PythonInterpreter main_interpreter
    350346}}}
    351 これは、よく知られている mod_python と Subversion の Python バインディングの他の問題 ([trac:#2611], [trac:#3455]) について推奨しているワークアラウンドです。 [trac:comment:9:ticket:3455 #3455] Graham Dumpleton のコメントに問題点が指摘されています。
    352 
    353 === ページレイアウトの問題 === #Pagelayoutissues
    354 
    355 Trac のページフォーマットが奇妙に見えるなら、ページレイアウトを管理するスタイルシートが Web サーバによって適切に扱われていない可能性が考えられます。 Apache のコンフィグに以下を追加してみてください:
    356 {{{
    357 #!xml
     347
     348This is also the recommended workaround for other issues seen when using the Python bindings for Subversion within mod_python ([trac:#2611 #2611], [trac:#3455 #3455]). See in particular Graham Dumpleton's comment in [trac:comment:9:ticket:3455 #3455] explaining the issue.
     349
     350=== Page layout issues
     351
     352If the formatting of the Trac pages look weird, chances are that the style sheets governing the page layout are not handled properly by the web server. Try adding the following lines to your Apache configuration:
     353{{{#!apache
    358354Alias /myproject/css "/usr/share/trac/htdocs/css"
    359355<Location /myproject/css>
     
    362358}}}
    363359
    364 Note: 上記のコンフィグが効果を発揮するためには、プロジェクトの root 位置のコンフィグ後に追加しなければなりません。つまり {{{<Location /myproject />}}} 以降です。
    365 
    366 また `PythonOptimize On` が設定されている場合、ページのヘッダとフッタの表示が乱れたり、マクロやプラグインのドキュメンテーションが表示されないことがあります ([trac:#8956] 参照)。オプションの設定によって影響を受ける箇所について充分考慮できない場合は `Off` に設定する方がよいでしょう。
    367 
    368 === HTTPS の問題 === #HTTPSissues
    369 
    370 Trac を完全に https で実行したいにも関わらず、プレーンな http にリダイレクトされる場合、 Apache のコンフィグに以下を追加してください:
    371 {{{
    372 #!xml
    373 <VirtualHost * >
     360'''Note''': For the above configuration to have any effect it must be put after the configuration of your project root location, ie {{{<Location /myproject />}}}.
     361
     362**Note:** Do not enable python optimizations using the directive `PythonOptimize On`. When optimizations are enabled the page header/footer and documentation for macros and plugins will be hidden. An error will be raised in Trac 1.0.11 and later when optimizations are enabled.
     363
     364=== HTTPS issues
     365
     366If you want to run Trac fully under https you might find that it tries to redirect to plain http. In this case just add the following line to your Apache configuration:
     367{{{#!apache
     368<VirtualHost *>
    374369    DocumentRoot /var/www/myproject
    375370    ServerName trac.mycompany.com
     
    379374}}}
    380375
    381 
    382 === php5-mhash または その他の php5 モジュールのセグメンテーションフォルト === #Segmentationfaultwithphp5-mhashorotherphp5modules
    383 php5-mhash モジュールがインストールされている場合、 (debian etch について報告された) セグメンテーションフォルトに遭遇するでしょう。 php-mhash を削除して、問題が解決するかを確かめてみてください。 debian のバグレポート [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487] を参考にして下さい。
    384 
    385 システムライブラリの代わりに、サードパーティのライブラリでコンパイルされた php5 を使用する一部の人々にもトラブルが発生します。ここを確認してください [http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault]
     376=== Segmentation fault with php5-mhash or other php5 modules
     377
     378You may encounter segfaults (reported on Debian etch) if php5-mhash module is installed. Try to remove it to see if this solves the problem. See [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=411487 Debian bug report].
     379
     380Some people also have troubles when using PHP5 compiled with its own third party libraries instead of system libraries. Check [http://www.djangoproject.com/documentation/modpython/#if-you-get-a-segmentation-fault Django segmentation fault].
    386381
    387382----
    388 See also:  TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI],  [trac:TracNginxRecipe TracNginxRecipe]
     383See also: TracGuide, TracInstall, [wiki:TracModWSGI ModWSGI], [wiki:TracFastCgi FastCGI], [trac:TracNginxRecipe]