Edgewall Software

Ticket #7450 (closed defect: worksforme)

Opened 6 months ago

Last modified 6 months ago

localized trac doesn't translate with mod_wsgi

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: web frontend Version:
Severity: major Keywords:
Cc:

Description

If I start it up as standalone it works, I can see the default page accept my native language (probably through accept-language header) and while logged in there is a preference page which works too.

But if I try it via wsgi it doesn't work. Probably babel doesn't load when using the wsgi script instead of standalone.py . No prefpane, no defaultlanguage, even the info saved before with the working copy has no effect, still everything on english.

my wsgi script:

import os

os.environ['TRAC_ENV_PARENT_DIR'] = '/usr/local/trac/var'
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/trac/cache'
os.environ['HGENCODING'] = 'utf-8'

import sys
sys.path.append('/usr/local/trac/lib/python2.4/site-packages')

from pkg_resources import require
require("Trac==0.12multirepos-r7260")

import trac.web.main
application = trac.web.main.dispatch_request

Here my Sysinfo:

  • Trac: 0.12multirepos-r7260
  • Python: 2.4.4 (#1, Apr 15 2008, 23:37:53) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)]
  • setuptools: 0.6c3
  • SQLite: 3.3.8
  • pysqlite: 2.3.2
  • Genshi: 0.5
  • Mercurial: 1.0.1
  • jQuery: 1.2.3

And plugin info (everything is checked):

Additional Info:

  • Apache/2.2.3 with mod_wsgi 2.1

Attachments

Change History

Changed 6 months ago by eblot

  • severity changed from critical to major

Changed 6 months ago by osimons

Instead of:

import sys
sys.path.append('/usr/local/trac/lib/python2.4/site-packages')

try:

import site
site.addsitedir('/usr/local/trac/lib/python2.4/site-packages')

It makes it read the directory as 'setuptools-enabled', parsing .pth files and accessing the content of eggs in that path. Simply adding to sys.path will only find modules directly importable from that directory - which won't work for most egg installations.

Changed 6 months ago by anonymous

Thank you osimons, it really was that error on my part. Added some documentation to the [TracModWSGI] page for clarification.

Changed 6 months ago by anonymous

Should have read: TracModWSGI

Changed 6 months ago by osimons

  • status changed from new to closed
  • resolution set to worksforme
  • component changed from i18n to web frontend

Goodie. Closing as worksforyou then :-)

Add/Change #7450 (localized trac doesn't translate with mod_wsgi)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
to The owner will change from (none). Next status will be 'closed'
 
Note: See TracTickets for help on using tickets.