Sorry, I meant to do that. Here it is:

<VirtualHost *:443>

    ServerName mywebsite.com
    LoadModule wsgi_module /var/www/mywebsite.com
/flask/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
    WSGIDaemonProcess flask processes=2 threads=12 python-home=/var/www/
mywebsite.com/flask/bin/ python-path=/var/www/mywebsite.com/flask/bin/
    WSGIScriptAlias / /var/www/mywebsite.com/flask/flask.wsgi
    <Directory /var/www/mywebsite.com/flask>
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog /var/www/mywebsite.com/public_html/error.log
    CustomLog /var/www/mywebsite.com/public_html/requests.log combined
    sslengine on
    sslcertificatefile /etc/ssl/certs/STAR.mywebsite.com.crt
    sslcertificatekeyfile /etc/ssl/certs/mywebsite.com.key
</VirtualHost>



On Wednesday, July 11, 2018 at 5:26:24 PM UTC-7, Graham Dumpleton wrote:
>
> You haven't shown your Apache configuration for mod_wsgi.
>
> You need to tell mod_wsgi/Python that your virtual environment is at:
>
>     /var/www/mywebsite.com/flask
>
> Adding that directory to sys.path is not enough.
>
> Read:
>
>     
> http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
>
> as it explains what you need to do.
>
> I can't be more specific since you didn't include the Apache configuration 
> for mod_wsgi.
>
> Graham
>
> On 12 Jul 2018, at 9:45 am, jerry100 <[email protected] <javascript:>> 
> wrote:
>
> Hello all! The requests module was installed in the site-packages folder 
> in the virtual environment as I expected. I ran "pip install requests". 
> Since I run the flask app on apache and the virtual environment is 
> inactive, by design, as we are using mod_wsgi, the requests module is not 
> being imported by Apache.
>
> /var/www/mywebsite.com/flask/lib/python3.6/site-packages/requests
>
> This is how I am trying to import the module:
>
> from flask import Flask, render_template, request
> import requests
>
>
> Here's my flask.wsgi file. Are we supposed to import modules in this file 
> instead of init.py file?
>
> import sys
>
> sys.path.insert(0, "/var/www/mywebsite.com/flask/")
>
> from init import app as application
>
>
> This is the error I get. What am I doing wrong?
>
> [Wed Jul 11 16:16:18.941771 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794] Traceback (most recent call last):
> [Wed Jul 11 16:16:18.941850 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794]   File "/var/www/mywebsite.com/flask/flask.wsgi", line 5, in 
> <module>
> [Wed Jul 11 16:16:18.941864 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794]     from init import app as application
> [Wed Jul 11 16:16:18.941876 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794]   File "/var/www/mywebsite.com/flask/init.py", line 2, in 
> <module>
> [Wed Jul 11 16:16:18.941881 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794]     import requests
> [Wed Jul 11 16:16:18.941909 2018] [wsgi:error] [pid 7244] [client 192.168.
> 1.2:64794] ModuleNotFoundError: No module named 'requests'
>
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>
> .
> Visit this group at https://groups.google.com/group/modwsgi.
> For more options, visit 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