You should never call your own Python module/package 'test'. This is because 
there is a 'test' module in the Python distribution itself. So what is 
happening with that error is that, to is finding the 'test' module from Python 
and not your own. This is possibly because you haven't set WSGIPythonPath 
directive, or the python-path option to WSGIDaemonProcess, to tell mod_wsgi 
where your project code is.

For an example of Flask on mod_wsgi, see the Flask documentation.

    http://flask.pocoo.org/docs/1.0/deploying/mod_wsgi/ 
<http://flask.pocoo.org/docs/1.0/deploying/mod_wsgi/>

Note that Flask docs say to modify sys.path rather than above directive/option 
for saying where your project code is. I would recommend the directive or 
option over modifying sys.path. The Flask docs are also wrong in saying to set 
WSGIRestrictStdout and  WSGIScriptReloading. Neither of those are needed. 
Finally, how it says to activate a virtual environment is also not the 
recommended method, see:

    
https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html 
<https://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html>

for preferred method of using a virtual environment.

Graham

> On 29 Apr 2019, at 5:15 am, Richard Kottke <[email protected]> wrote:
> 
> Hi,
> 
> I've been able to setup a very simple python HellloWorld python example on my 
> Centos 7 virtual box:
> 
> http://192.168.1.222/helloworld <http://192.168.1.222/helloworld> ->  Hello 
> World!
> 
> This works great!
> 
> However, I'm having a very difficult time setting up a very simple flask 
> helloworld example using Centos 7, Apache2.4, mod_wsgi and flask.  I can't 
> even find such a working example or tutorial on the web.
> 
> When I try, I continuously get a 500 - "Internal Server Error" that winds up 
> with the following error in the error log:
> [Sun Apr 28 00:11:04.756760 2019] [:error] [pid 17653] [client 
> 192.168.1.102:2420] Traceback (most recent call last):
> [Sun Apr 28 00:11:04.756781 2019] [:error] [pid 17653] [client 
> 192.168.1.102:2420]   File "/var/www/html/sites/test/test.wsgi", line 7, in 
> <module>
> [Sun Apr 28 00:11:04.756908 2019] [:error] [pid 17653] [client 
> 192.168.1.102:2420]     from test.routes import app as application
> [Sun Apr 28 00:11:04.756947 2019] [:error] [pid 17653] [client 
> 192.168.1.102:2420] ImportError: No module named routes
> 
> It would be wonderful if you could post a full minimal working example that 
> works on Centos 7. I can find working examples for flask on Ubuntu or using 
> ngnix, but nothing that works with mod_wsgi.
> 
> Any chance I can get a full very basic or simple example/tutorial on Centos 
> 7, flask, mod_wsgi, Apache/2.4.6 (CentOS)?
> 
> Thanks,
> Rick   
> 
> -- 
> 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 post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to