Re: wsgi on RedHat 9

Tonu Mikk via Roundup-users <[email protected]> Wed, 7 Feb 2024 14:48:41 -0600
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <CABDFm8jpdukd-rbVbpcKxnFHPEgCuZK7NPTfveSKLZvCMVEbjA@mail.gmail.com>
--===============2958888638821400675==
Content-Type: multipart/alternative; boundary="000000000000156f8d0610d0d4ac"

--000000000000156f8d0610d0d4ac
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

The command
   python3 -c 'import roundup'
runs without an error.

I changed the test_wsgi.py to contain this:
import sys

def application(environ, start_response):
    status =3D '200 OK'

    output =3D u''
    output +=3D u'sys.version =3D %s\n' % repr(sys.version)
    output +=3D u'sys.prefix =3D %s\n' % repr(sys.prefix)

    response_headers =3D [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output.encode('UTF-8')]

Now the output in the browser shows:
sys.version =3D '3.9.18 (main, Sep  7 2023, 00:00:00) \n[GCC 11.4.1 2023060=
5
(Red Hat 11.4.1-2)]'
sys.prefix =3D '/usr'

I will try to use the virtual environment with mod_wsgi. Thanks for
pointing this out!

 '3.9.18 (main, Sep 7 2023, 00:00:00) \n[GCC 11.4.1 20230605 (Red Hat
11.4.1-2)]'

sys.prefix =3D '/usr'


On Tue, Feb 6, 2024 at 5:06=E2=80=AFPM John P. Rouillard <[email protected]=
> wrote:

> Hi Tonu:
>
> In message <CABDFm8gy3bPV+sk_kKtqfENncALrA9c-dY5X+OWW=3D=3D
> [email protected]>
> ,
> Tonu Mikk writes:
> >Thanks Ralf and John! The file permissions need fixing.  And there was
> >indeed an error in the Apache Virtual config file. The line
> >
> > WSGIScriptAlias /piano /opt/trackers/classic_wsgi.py
> >
> >Should have been
> > WSGIScriptAlias /piano /opt/trackers/classic/classic_wsgi.py
> >
> >Once I changed it and restarted Apache, I now get the following error:
> >
> >[Tue Feb 06 13:42:39.162045 2024] [wsgi:error] [pid 3131857:tid 3132046]
> >[remote 10.20.27.232:52794]   File
> "/opt/trackers/classic/classic_wsgi.py",
> >line 1, in <module>
> >[Tue Feb 06 13:42:39.162058 2024] [wsgi:error] [pid 3131857:tid 3132046]
> >[remote 10.20.27.232:52794]     from roundup.cgi.wsgi_handler import
> >RequestDispatcher
> >[Tue Feb 06 13:42:39.162089 2024] [wsgi:error] [pid 3131857:tid 3132046]
> >[remote 10.20.27.232:52794] ModuleNotFoundError: No module named
> 'roundup'
>
> Can you run
>
>    python3 -c 'import roundup'
>
> without error?
>
> If so, it looks like test_wsgi isn't running the python environment in
> which you installed Roundup. With your wsgi-test try adding:
>
>   import sys
>
> and replace output... with:
>
>   output =3D b'Hooray, mod_wsgi is working: %s, %s' % (sys.version,
> sys.prefix)
>
> That should show your system installed python version and /usr.
>
> If the `python3 -c 'import roundup'` fails, then something went weird
> with your install.
>
> As an aside, you can use a venv created from the vendor's python3 by
> adding a python-home setting.
>
>
> https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environment=
s.html
>
> Hope this helps.
> --
>                                 -- rouilj
> John Rouillard
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
> My employers don't acknowledge my existence much less my opinions.
>


--=20
Tonu Mikk
Developer | Disability Resource Center | disability.umn.edu
University of Minnesota | umn.edu
[email protected]
Pronouns: He/Him

--000000000000156f8d0610d0d4ac
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The command<div>=C2=A0 =C2=A0python3 -c &#39;import roundu=
p&#39;</div><div>runs without an error.=C2=A0</div><div><br></div><div>I ch=
anged the test_wsgi.py to contain this:</div><div>import sys<br><br>def app=
lication(environ, start_response):<br>=C2=A0 =C2=A0 status =3D &#39;200 OK&=
#39;<br><br>=C2=A0 =C2=A0 output =3D u&#39;&#39;<br>=C2=A0 =C2=A0 output +=
=3D u&#39;sys.version =3D %s\n&#39; % repr(sys.version)<br>=C2=A0 =C2=A0 ou=
tput +=3D u&#39;sys.prefix =3D %s\n&#39; % repr(sys.prefix)<br><br>=C2=A0 =
=C2=A0 response_headers =3D [(&#39;Content-type&#39;, &#39;text/plain&#39;)=
,<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 (&#39;Content-Length&#39;, str(len(output)))]<br>=C2=A0 =C2=
=A0 start_response(status, response_headers)<br><br>=C2=A0 =C2=A0 return [o=
utput.encode(&#39;UTF-8&#39;)]<br></div><div><br></div><div>Now the output =
in the browser shows:</div><div>sys.version =3D &#39;3.9.18 (main, Sep =C2=
=A07 2023, 00:00:00) \n[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]&#39;</div><=
div>sys.prefix =3D &#39;/usr&#39;</div><div><br></div><div>I will try to us=
e the virtual environment with mod_wsgi. Thanks for pointing this out!</div=
><div><span style=3D"color:rgb(255,255,255)"><br></span></div><div><span st=
yle=3D"color:rgb(255,255,255)">=C2=A0&#39;3.9.18 (main, Sep  7 2023, 00:00:=
00) \n[GCC 11.4.1 20230605 (Red Hat 11.4.1-2)]&#39;</span></div><div><pre s=
tyle=3D"color:rgb(255,255,255)">sys.prefix =3D &#39;/usr&#39;</pre></div></=
div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On=
 Tue, Feb 6, 2024 at 5:06=E2=80=AFPM John P. Rouillard &lt;<a href=3D"mailt=
o:[email protected]">[email protected]</a>&gt; wrote:<br></div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex">Hi Tonu:<br>
<br>
In message &lt;CABDFm8gy3bPV+sk_kKtqfENncALrA9c-dY5X+OWW=3D=3D<a href=3D"ma=
ilto:mhQ5%[email protected]" target=3D"_blank">[email protected]</=
a>&gt;<br>
,<br>
Tonu Mikk writes:<br>
&gt;Thanks Ralf and John! The file permissions need fixing.=C2=A0 And there=
 was<br>
&gt;indeed an error in the Apache Virtual config file. The line<br>
&gt;<br>
&gt; WSGIScriptAlias /piano /opt/trackers/classic_wsgi.py<br>
&gt;<br>
&gt;Should have been<br>
&gt; WSGIScriptAlias /piano /opt/trackers/classic/classic_wsgi.py<br>
&gt;<br>
&gt;Once I changed it and restarted Apache, I now get the following error:<=
br>
&gt;<br>
&gt;[Tue Feb 06 13:42:39.162045 2024] [wsgi:error] [pid 3131857:tid 3132046=
]<br>
&gt;[remote <a href=3D"http://10.20.27.232:52794" rel=3D"noreferrer" target=
=3D"_blank">10.20.27.232:52794</a>]=C2=A0 =C2=A0File &quot;/opt/trackers/cl=
assic/classic_wsgi.py&quot;,<br>
&gt;line 1, in &lt;module&gt;<br>
&gt;[Tue Feb 06 13:42:39.162058 2024] [wsgi:error] [pid 3131857:tid 3132046=
]<br>
&gt;[remote <a href=3D"http://10.20.27.232:52794" rel=3D"noreferrer" target=
=3D"_blank">10.20.27.232:52794</a>]=C2=A0 =C2=A0 =C2=A0from roundup.cgi.wsg=
i_handler import<br>
&gt;RequestDispatcher<br>
&gt;[Tue Feb 06 13:42:39.162089 2024] [wsgi:error] [pid 3131857:tid 3132046=
]<br>
&gt;[remote <a href=3D"http://10.20.27.232:52794" rel=3D"noreferrer" target=
=3D"_blank">10.20.27.232:52794</a>] ModuleNotFoundError: No module named &#=
39;roundup&#39;<br>
<br>
Can you run<br>
<br>
=C2=A0 =C2=A0python3 -c &#39;import roundup&#39;<br>
<br>
without error?<br>
<br>
If so, it looks like test_wsgi isn&#39;t running the python environment in<=
br>
which you installed Roundup. With your wsgi-test try adding:<br>
<br>
=C2=A0 import sys<br>
<br>
and replace output... with:<br>
<br>
=C2=A0 output =3D b&#39;Hooray, mod_wsgi is working: %s, %s&#39; % (sys.ver=
sion, sys.prefix)<br>
<br>
That should show your system installed python version and /usr.<br>
<br>
If the `python3 -c &#39;import roundup&#39;` fails, then something went wei=
rd<br>
with your install.<br>
<br>
As an aside, you can use a venv created from the vendor&#39;s python3 by<br=
>
adding a python-home setting.<br>
<br>
=C2=A0 <a href=3D"https://modwsgi.readthedocs.io/en/develop/user-guides/vir=
tual-environments.html" rel=3D"noreferrer" target=3D"_blank">https://modwsg=
i.readthedocs.io/en/develop/user-guides/virtual-environments.html</a><br>
<br>
Hope this helps.<br>
--<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 -- rouilj<br>
John Rouillard<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
<br>
My employers don&#39;t acknowledge my existence much less my opinions.<br>
</blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si=
gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d=
iv dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><span sty=
le=3D"border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"=
><font color=3D"#666666"><div>Tonu Mikk</div><div>Developer | Disability Re=
source Center | <a href=3D"https://disability.umn.edu" target=3D"_blank">di=
sability.umn.edu</a></div><div>University of Minnesota | <a href=3D"http://=
umn.edu" target=3D"_blank">umn.edu</a>=C2=A0</div><div><a href=3D"mailto:tm=
[email protected]" target=3D"_blank">[email protected]</a>=C2=A0</div><div>Pronouns: =
He/Him</div></font></span></div></div></div></div></div>

--000000000000156f8d0610d0d4ac--


--===============2958888638821400675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============2958888638821400675==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users

--===============2958888638821400675==--