0

I have Google Cloud with Debian 9. There are python 2.7a and 3.5. 3.5 I did as default.

I have apache where is PHP and I need to keep it there. I installed libapache2-mod-python configured virtual host and pure python file return me a correct result. I installed Flask framework and it throws an exception that ImportError: No module named Flask It's my first time with Flask and in general with python in web.

For all examples I see mod_wsgi but I can't install it with libapache2-mod-python.

My questions are: Does it's possible to run Flash with libapache2-mod-python module? If no, then does mod_wsgi has no conflict with PHP apache module? Thanks for any hints.

jaroApp
  • 849
  • 3
  • 13
  • 27
  • Yes it's possible to run both mod-python and php with the same apache server. The exception you get is a python exception, so python _is_ running. But you need to make sure the apache worker knows where to find your python modules. The apache worker has a different environment from your regular user, so you have to tell it where to find flask on the file system. https://stackoverflow.com/questions/28688306/how-to-add-python-path-in-mod-python – Håken Lid Aug 12 '18 at 10:21

1 Answers1

0

That sounds like you do not have flask installed. You may for example pip install flask to the particular python version that you are trying to run your flask app with.

conrad
  • 1,783
  • 14
  • 28
  • I have installed Flask. I had to revert the default python to 2.7 because I had a problem with OS dependencies. Now all modules install/uninstall works. Flask still doesn't work. Apache throw error that could not found webtool module for this code `from webtool import app as application` in .wsgi file. For me, weird is a fact that `pip install flask` return info that `Requirement already satisfied: flask in `/usr/local/lib/python3.5/dist-packages` probably apache use default 2.7.x – jaroApp Aug 10 '18 at 21:05
  • My virtual host config is ``` ServerName example.com DocumentRoot /mypath WSGIDaemonProcess webtool threads=5 home=/mypath.com/ WSGIScriptAlias / /mypath/webtool.wsgi WSGIProcessGroup webtool WSGIApplicationGroup %{GLOBAL} WSGIScriptReloading On Options Includes FollowSymLinks MultiViews AllowOverride AuthConfig AllowOverride All Order allow,deny allow from all DirectoryIndex index.py index.html index.html5 ``` – jaroApp Aug 10 '18 at 21:05