>
> So you know for future. In a multi part email chain it can be difficult to 
> go back and extract what configuration may have been used that you might be 
> referring to. So when you ask questions you should always repeat what is 
> occurring in your case. It is even better not to reply on a previous email 
> chain and the history of the previous issue, which may not be the same, can 
> just confuse things. So I am just going to ask for the configuration again.
>

Understood. No problem. 

Where is the Flask package installed?

On my Ubuntu 16.04 system, anaconda python and all python modules are 
installed in my home directory. There is no virtual environment. When I 
log-in the PATH environment variable is set so any invocation of python 
uses the desired python distribution. All my python code is able to find 
all other installed modules. There is history and legacy here. 

My immediate objective is to have the Apache server boot and use the python 
distribution in my home directory for all Flask/WSGI related processing.


> From the command line, if you run the 'python' you want to use, what do 
> you get when from the interpreter you do:
>
>     import flask
>     print(flask.__file__)
>

/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/__init__.py
 

>
> Also what do you get for:
>
>     import sys
>     print(sys.prefix)
>
> /home/rajeev/anaconda3



 

> The prior configuration example in the email chain was not setting up the 
> Python virtual environment correctly so can't be used as a guide.
>
> I need to see what is in the wsgi.load file if still using system package 
> for mod_wsgi.
>

*/etc/apache2/mods-enabled*$ cat wsgi.load 

LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so


notes:

1) was able to successfully pip install mod_wsgi

pip install mod_wsgi

Requirement already satisfied: mod_wsgi in 
./anaconda3/lib/python3.6/site-packages (4.6.4)


2) updated softlink to use new object

*/usr/lib/apache2/modules*$ ll mod_wsg*

-rwxr-xr-x 1 root root 974744 Jun 13 14:45 
*mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so**

lrwxrwxrwx 1 root root     45 Jun 13 14:47 *mod_wsgi.so* -> 
*mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so**

-rw-r--r-- 1 root root 207952 Jan 25  2016 mod_wsgi.so-3.5

3) server log shows the new mod_wsgi is being loaded.

tail -l /var/log/apache2/error.log

[Wed Jun 13 15:08:13.942743 2018] [mpm_prefork:notice] [pid 23851] AH00169: 
caught SIGTERM, shutting down

[Wed Jun 13 15:12:14.024133 2018] [ssl:warn] [pid 24110] AH01909: 
198.105.244.228:443:0 server certificate does NOT include an ID which 
matches the server name

[Wed Jun 13 15:12:14.114890 2018] [ssl:warn] [pid 24111] AH01909: 
198.105.244.228:443:0 server certificate does NOT include an ID which 
matches the server name

[Wed Jun 13 15:12:14.121149 2018] [mpm_prefork:notice] [pid 24111] AH00163: 
Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.6.4 Python/3.6 configured 
-- resuming normal operations

[Wed Jun 13 15:12:14.121185 2018] [core:notice] [pid 24111] AH00094: 
Command line: '/usr/sbin/apache2'
 

>
> I then need to see what you may have set WSGIPythonHome, WSGIPythonPath, 
> and general configuration for mod_wsgi in the VirtualHost, including 
> WSGIDaemonProcess. Basically, include all what you are using in your 
> response. I really need to see what you are using, and not what someone 
> else used, even if you think it is the same.
>


*/etc/apache2/mods-enabled*$ cat wsgi.conf 

<IfModule mod_wsgi.c>

    WSGIPythonHome /home/rajeev/anaconda3

    WSGIPythonPath /home/rajeev/anaconda3/lib/python3.6/site-packages


</IfModule>

 */etc/apache2/sites-available*$ cat FlaskApp.conf 

<VirtualHost *:83>

    ServerName flaskapp.com


    WSGIDaemonProcess flaskapp.com python-path=/home/rajeev/anaconda3

    WSGIProcessGroup %{GLOBAL}


    WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi

    <Directory /var/www/FlaskApp/FlaskApp/>

        Require all granted

    </Directory>

</VirtualHost>

>
> Also show anything you have added in the WSGI script file to try and 
> activate a virtual environment, or changes you are making to sys.path.
>

*/var/www/FlaskApp*$ cat flaskapp.wsgi 

#!/home/rajeev/anaconda3/bin/python

import sys

import logging

logging.basicConfig(stream=sys.stderr)

sys.path.insert(0,"/var/www/FlaskApp/")


from FlaskApp import app as application

application.secret_key = 'Add your secret key'


Testing:

curl -sH 'Host: flaskapp.com' localhost:83|grep title

<*title*>500 Internal Server Error</*title*>



tail -l /var/log/apache2/error.log

[Wed Jun 13 15:46:22.636400 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]     from flask import Flask

[Wed Jun 13 15:46:22.636406 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]   File 
"/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/__init__.py", 
line 21, in <module>

[Wed Jun 13 15:46:22.636409 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]     from .app import Flask, Request, Response

[Wed Jun 13 15:46:22.636413 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]   File 
"/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/app.py", line 25, 
in <module>

[Wed Jun 13 15:46:22.636416 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]     from . import cli, json

[Wed Jun 13 15:46:22.636421 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]   File 
"/home/rajeev/anaconda3/lib/python3.6/site-packages/flask/cli.py", line 18, 
in <module>

[Wed Jun 13 15:46:22.636424 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]     import ssl

[Wed Jun 13 15:46:22.636429 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]   File "/home/rajeev/anaconda3/lib/python3.6/ssl.py", line 
101, in <module>

[Wed Jun 13 15:46:22.636432 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068]     import _ssl             # if we can't import it, let 
the error propagate

[Wed Jun 13 15:46:22.636453 2018] [wsgi:error] [pid 2199] [client 
127.0.0.1:38068] ImportError: 
/home/rajeev/anaconda3/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so:
 
undefined symbol: SSLv2_method



*/var/www/FlaskApp/FlaskApp*$ python __init__.py 

 * Serving Flask app "__init__" (lazy loading)

 * Environment: production

   WARNING: Do not use the development server in a production environment.

   Use a production WSGI server instead.

 * Debug mode: off

 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

127.0.0.1 - - [13/Jun/2018 15:48:53] "GET / HTTP/1.1" 200 -

127.0.0.1 - - [13/Jun/2018 15:48:53] "GET /favicon.ico HTTP/1.1" 404 -


Using browser on server (http://localhost:5000)is able to load test page


This is where I am at...


Your help is greatly appreciated. Perhaps I should consider setting a new 
virtual environment...


Thanks,

--Rajeev



-- 
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 modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to