Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

#7450 closed defect (worksforme)

localized trac doesn't translate with mod_wsgi

Reported by: anonymous Owned by:
Priority: normal Milestone:
Component: web frontend Version:
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

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 (0)

Change History (5)

comment:1 by Emmanuel Blot, 16 years ago

Severity: criticalmajor

comment:2 by osimons, 16 years ago

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.

comment:3 by anonymous, 16 years ago

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

comment:4 by anonymous, 16 years ago

Should have read: TracModWSGI

comment:5 by osimons, 16 years ago

Component: i18nweb frontend
Resolution: worksforme
Status: newclosed

Goodie. Closing as worksforyou then :-)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.