Every file would need to have a WSGI application entry point called 
"application". The error says you don't have one in that file.

Overall this sort of approach of using AddHandler with separate WSGI files in a 
directory to handle different routes is generally regarded as bad practice 
these days. Instead of this approach you are much better off using a WSGI 
framework. A lightweight example of a WSGI framework is Flask. I strongly 
recommend you go look at Flask and how it works rather than pursuing your 
current path.

https://flask.palletsprojects.com/en/2.0.x/ 
<https://flask.palletsprojects.com/en/2.0.x/>

Graham

> On 3 Nov 2021, at 3:47 pm, Tin Tun Naing <[email protected]> wrote:
> 
> We installed python version 3.6 and apache 2.4 on CentOS 8 and connect with 
> postgresql. 
> And then installed mod_wsgi for run python code.
> After we make some configuration in /etc/httpd/conf.d/wsgi.conf  as follows -
> 
> --------------------------------------------------------------------------------
> LoadModule wsgi_module /etc/httpd/modules/mod_wsgi_python3.so
> Alias /map /var/www/map/
> 
> <Directory /var/www/orikomap/>
> Options ExecCGI MultiViews Indexes
> MultiViewsMatch Handlers
> 
> AddHandler wsgi-script .py
> AddHandler wsgi-script .wsgi
> DirectoryIndex index.html index.php index.py app.wsgi
> 
> Order allow,deny
> Allow from all
> </Directory>
> ----------------------------------------------------------------------------------------
> 
> And then we add python code to target directory -> /var/www/map/index.py as 
> follow
> 
> -------------------------------------------------------------------------------------------
> import sys
> 
> def application(environ, start_response):
> status = '200 OK'
> output = u'mod_wsgi.process_group = %s' % 
> repr(environ['mod_wsgi.process_group'])
> response_headers = [('Content-type', 'text/plain'),
> ('Content-Length', str(len(output)))]
> start_response(status, response_headers)
> 
> return [output.encode('UTF-8')]
> ----------------------------------------------------------------------------------------
> 
> we got follow result -
> https://gyazo.com/bcedcd91870832e1af231feabbd966c2
> 
> After we add a new python file on the same directory -> /var/www/map/map.py .
> 
> https://gyazo.com/0ace24266d716794a0961ce13454ca3a
> 
> but we can't call another python file as follow.
> http//:ipaddress/polygon.py
> 
> ----------------------------------------------------------------------------------------------
> [Fri Oct 29 03:56:35.064042 2021] [wsgi:error] [pid 2840:tid 140610811930368] 
> [client 192.168.1.8:53246] mod_wsgi (pid=2840): Target WSGI script 
> '/var/www/map/polygon.py' does not contain WSGI application 'application'.
> 
> 
> So how can we solve this problem, how to run other Python files on the same 
> directory using wsgi.
> 
> Thank you.
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "modwsgi" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/modwsgi/e33beebb-e3c7-4c0c-a573-21bc1a536b93n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/modwsgi/e33beebb-e3c7-4c0c-a573-21bc1a536b93n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/B7EC9A21-2CAE-4B76-B521-4ED40B0BD08B%40gmail.com.

Reply via email to