Recently rebuilt a server with RHEL7.   I had to reinstall trac too, but 
after installing I am seeing the error "ImportError: No module named 
trac.web.main" in the Apache HTTPD log files.

Here are my install steps: 

-----------------------------------------

## Install trac 
pip install trac

## create the wsgi script
trac-admin /path/to/trac/ initenv
trac-admin /path/to/trac/ deploy /tmp/deploy

## examine script
cat /tmp/deploy/cgi-bin/trac.wsgi

[root@nbs]# cat /path/to/trac/cgi-bin/trac.wsgi 
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright (C)2008-2009 Edgewall Software
# Copyright (C) 2008 Noah Kantrowitz <[email protected]>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.org/wiki/TracLicense.
#
# This software consists of voluntary contributions made by many
# individuals. For the exact contribution history, see the revision
# history and logs, available at http://trac.edgewall.org/log/.
#
# Author: Noah Kantrowitz <[email protected]>
import os

def application(environ, start_request):
   if not 'trac.env_parent_dir' in environ:
       environ.setdefault('trac.env_path', '/path/to/trac')
   if 'PYTHON_EGG_CACHE' in environ:
       os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
   elif 'trac.env_path' in environ:
       os.environ['PYTHON_EGG_CACHE'] = \
           os.path.join(environ['trac.env_path'], '.egg-cache')
   elif 'trac.env_parent_dir' in environ:
       os.environ['PYTHON_EGG_CACHE'] = \
           os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
   from trac.web.main import dispatch_request
   return dispatch_request(environ, start_request)


## Move trac scripts to correct location
mv /tmp/deploy/* /path/to/trac/

## Set permissions
chown -R apache:apache /path/to/trac/
chmod 700 /path/to/trac/cgi-bin/trac.wsgi

## create trac.conf for Apache HTTPD
WSGIScriptAlias /trac /path/to/trac/cgi-bin/trac.wsgi
<Directory /path/to/trac/>
   WSGIApplicationGroup %{GLOBAL}
   # For Apache 2.2
   <IfModule !mod_authz_core.c>
       Order deny,allow
       Allow from all
   </IfModule>
   # For Apache 2.4
   <IfModule mod_authz_core.c>
       Require all granted
   </IfModule>
</Directory>

<Location "/trac/login">
 AuthType Basic
 AuthName "Trac"
 AuthUserFile /data/www/htpasswd/trac.htpasswd
 Require valid-user
</Location>

## Restart apache
service httpd restart

## browser shows: 
Internal Server Error

## httpd error log shows: 
[DATE] [:error] [pid 3286] [client CLIENT_IP:55491] mod_wsgi (pid=3286): 
Exception occurred processing WSGI script '/path/to/trac/cgi-bin/trac.wsgi'.
[DATE] [:error] [pid 3286] [client CLIENT_IP:55491] Traceback (most recent 
call last):
[DATE] [:error] [pid 3286] [client CLIENT_IP:55491]   File 
"/path/to/trac/cgi-bin/trac.wsgi", line 30, in application
[DATE] [:error] [pid 3286] [client CLIENT_IP:55491]     from trac.web.main 
import dispatch_request
[DATE] [:error] [pid 3286] [client CLIENT_IP:55491] ImportError: No module 
named trac.web.main


## If I point trac.conf WSGI to a test script: 
def application(environ, start_response):
    start_response('200 OK',[('Content-type','text/html')])
    return ['<html><body>Hello World!</body></html>']

I see the "Hello World" in the browser.  WSGI appears to be working OK.

Something is off in the trac installation but I am unsure what exactly.   
Help is greatly appreciated. 

ams

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to