When using mod_wsgi it will not look in the directory where the WSGI script 
file is, by default, for other modules to import. When you run from command 
line, python will look in current working directory.

You there need to tell mod_wsgi how to find your application and modules. I 
can't easily check right now, but thought Flask deployment guide for mod_wsgi 
explained that.

Ways to do it are to update sys.path in WSGI script file. If using embedded 
mode use WSGIPythonPath directive and if using daemon mode use python-path 
option to WSGIDaemonProcess directive.

Knowing what to look for, check back the Flask docs for mod_wsgi deployment, I 
can't get to them right now.

Graham

> On 27 Apr 2016, at 10:41, Jaqen Nki <[email protected]> wrote:
> 
> Good question.  I was curious about this too.  In the tutorial theres no 
> extra configuration needed (simply installed modwsgi --with-python=python3 
> from source, setup a vhost and a .wsgi file, and my site is auto served once 
> the server boots up).  I tested this by starting python3 shell from inside 
> then outside of the FlaskApp folder (containing the init.py file and project 
> files).  
> 
> In the shell, sitting within the project folder, I can import dbconnect just 
> fine (as should the init.py file since its in the folder).
> 
> But outside of the project FlaskApp folder the import is not found.  I 
> figured this shouldnt matter since the init.py file is the only file 
> importing from dbconnect.py, all within the project folder.  Not sure if it 
> matters but heres the packages in python3 lib:
> 
> /usr/local/lib/python3.4/dist-packages$ ls
> 
> flask                  Flask_WTF-0.12.egg-info     jinja2                
> pymysql                  Werkzeug-0.11.4.dist-info
> Flask-0.10.1.egg-info  itsdangerous-0.24.egg-info  Jinja2-2.8.dist-info  
> PyMySQL-0.7.2.dist-info  wtforms
> flask_wtf              itsdangerous.py             __pycache__           
> werkzeug                 WTForms-2.1.egg-info
> 
> -- 
> 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.

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