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]. 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.
