this installed in Ubuntu server 22 LTS
directory: /home/deli/trac  deploy /var/www/trac

erro:

[Fri Nov 10 14:35:49.887597 2023] [wsgi:warn] [pid 21333:tid 
140020309247872] (2)No such file or directory: mod_wsgi (pid=21333): Unable 
to stat Python home </home/deli/trac>. Python interpreter may not be able 
to be initialized correctly. Verify the supplied path and access 
permissions for whole of the path.
Python path configuration:
  PYTHONHOME = '</home/deli/trac>'
  PYTHONPATH = (not set)
  program name = 'python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '</home/deli/trac>'
  sys.base_exec_prefix = '</home/deli/trac>'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '</home/deli/trac>'
  sys.exec_prefix = '</home/deli/trac>'
  sys.path = [
    '</home/deli/trac>/lib/python310.zip',
    '</home/deli/trac>/lib/python3.10',
    '</home/deli/trac>/lib/python3.10/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the 
filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

--------------------------
deli@vm-delivery:~$ cat /var/www/trac/cgi-bin/trac.wsgi
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
import os
SetEnv PYTHONHOME /usr/bin/python3
SetEnv PYTHONPATH /home/deli/trac
os.environ['PYTHONHOME'] = '/usr/bin/python3'
os.environ['PYTHONPATH'] = '/home/deli/trac'

os.environ['TRAC_ENV'] = '/home/deli/trac'

import trac.web.main
import dispatch_request
def application(environ, start_response):
  environ['trac.env_path'] = '/home/deli/trac'
  return trac.web.main.dispatch_request(environ, start_response)

Current thread 0x00007f5904cb4780 (most recent call first):
  <no Python frame>
------------------------------------------------
deli@vm-delivery:~$ cat /etc/apache2/sites-available/trac-alias.conf 
<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/trac/htdocs

    Alias /chrome/common /var/www/trac/htdocs/common
    Alias /chrome/site /var/www/trac/htdocs/site

    <Directory "/var/www/trac/htdocs">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride None
        Require all granted
    </Directory>

##    WSGIScriptAlias /trac /var/www/trac/cgi-bin/trac.wsgi
WSGIDaemonProcess trac python-home=</home/deli/trac> display-name=%{GROUP}
WSGIScriptAlias /trac /var/www/cgi-bin/trac.wsgi process-group=trac 
application-group=%{GLOBAL}

    <Directory "/var/www/trac/cgi-bin">
        AllowOverride None
  WSGIApplicationGroup %{GLOBAL}
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Require all granted
    </Directory>

<Location "/trac/login">
  AuthType Basic
  AuthName "Trac"
  AuthUserFile /home/deli/env/.htpasswd
  Require valid-user
</Location>

</VirtualHost>

this line 

SetEnv PYTHONPATH /home/deli/trac
it does not solve?
Em sexta-feira, 10 de novembro de 2023 às 11:08:22 UTC-3, Jun Omae escreveu:

> On Fri, Nov 10, 2023 at 10:30 PM Jun Omae <jun...@gmail.com> wrote:
> > "ModuleNotFoundError: No module named 'trac'" is logged. So that mod-wsgi
> > cannot find Trac. If you haven't install to standard directory, the 
> installed
> > location should be configured using mod-wsgi directives in apache 
> configuration
> > file.
> >
> > e.g.
> >
> > WSGIScriptAlias /trac /var/www/cgi-bin/trac.wsgi
> >
> > ↓
> >
> > # Replace </path/to/your-virtualenv> with your virtualenv location
> > WSGIDaemonProcess trac python-home=</path/to/your-virtualenv> 
> display-name=%{GROUP}
> > WSGIScriptAlias /trac /var/www/cgi-bin/trac.wsgi process-group=trac 
> application-group=%{GLOBAL}
>
> Where is directory you've install Trac to? How have you installed?
>
> Also, the installed directory should be readable from apache process
> (www-data) or configure user parameter of WSGIDaemonProcess.
>
> See also:
>
> https://modwsgi.readthedocs.io/en/master/configuration-directives/WSGIDaemonProcess.html#user
>
> Your trac.wsgi has another issue:
>
> ====
> import os
>
> os.environ['TRAC_ENV'] = '/home/deli/trac'
> os.environ['PYTHON_EGG_CACHE'] = '/home/deli/trac/eggs'
>
> from trac.web.main import dispatch_request
> def application(environ, start_response):
> environ['trac.env_path'] = '/usr/local/trac/mysite'
> return trac.web.main.dispatch_request(environ, start_response)
> ====
>
> Only one of os.environ['TRAC_ENV'] and environ['trac.env_path'] is enough.
> And, two paths should be same.
>
> -- 
> Jun Omae <jun...@gmail.com> (大前 潤)
>

-- 
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 trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/724ef912-1a44-4bbe-93d5-47691b1d2995n%40googlegroups.com.

Reply via email to