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}}}. |
| 22 | 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. |
| 23 | |
| 24 | '''Important note:''' If you're using multiple `.wsgi` files (for example one per Trac environment) you must ''not'' use `os.environ['PYTHON_EGG_CACHE']` to set the path to the Trac environment. Using this method may lead to Trac delivering the content of another Trac environment. (The variable may be filled with the path of a previously viewed Trac environment.) To solve this problem, use the following `.wsgi` file instead: |
| 25 | |
| 26 | {{{ |
| 27 | #!python |
| 28 | import os |
| 29 | |
| 30 | os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/mysite/eggs' |
| 31 | |
| 32 | import trac.web.main |
| 33 | def application(environ, start_response): |
| 34 | environ['trac.env_path'] = '/usr/local/trac/mysite' |
| 35 | return trac.web.main.dispatch_request(environ, start_response) |
| 36 | }}} |
| 37 | |
| 38 | 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`. |