Your code will be running as the Apache user. Your home directory would have 
restrictive permissions on it such that not everyone can access files out of it.

The quickest solution would be to set the process/group that the mod_wsgi 
daemon process runs as.

    WSGIDaemonProcess home=/var/www/wsgi-scripts 
python-path=/home/user/flask_stuff_files user=xxx group=yyy

Replace xxx with your user name and yyy with the group name, likely same as xxx.

Thi presumes the issue isn’t as simple as you having left off the leading slash 
on the path to the python-path option as your snippet showed.

Graham

> On 21 Aug 2016, at 11:41 PM, Tierprot B. <[email protected]> wrote:
> 
> 
> That is what WSGIScriptAlias is doing in giving it the path to the WSGI 
> script file. If you mean something different you need to be clearer.
> 
>> b) that it should include python files from outside directory, for example 
>> home/user/flask_stuff_files ?
> 
> If you are talking about other places to look for Python modules to import, 
> that is what the python-path option for WSGIDaemonProcess that I mentioned is 
> for.
> 
> Graham
> 
> 
> Ok, ive got python modules which i try to import located at 
> home/user/flask_stuff_files, mine wsgi file is in /var/www/wsgi-scripts, now 
> to the code:
> 
> apache-wsgi config:
> ----------------------------
> <VirtualHost *:80>
>       ServerName www.example.com <http://www.example.com/> 
>       DocumentRoot /var/www/html
> 
>       WSGIDaemonProcess home=/var/www/wsgi-scripts 
> python-path=home/user/flask_stuff_files
>       WSGIScriptAlias /test /var/www/wsgi-scripts/simple_app.wsgi
>       
>       <Directory /var/www/wsgi-scripts>
>           Require all granted
>       </Directory>
>  </VirtualHost>
> -------------------------
> 
> simple_app.wsgi:
> ----------------------------------
> import server_handle
> 
> def application(environ, start_response):
>     status = '200 OK'
>     output = b'Hello, World!'
> 
>     response_headers = [('Content-type', 'text/plain'),
>                         ('Content-Length', str(len(output)))]
>     start_response(status, response_headers)
>     return [output]
> ------------------------------------
> 
> server_handle.py module is located at /home/user/flask_stuff_files
> 
> on trying www.example.com/test Apache spits with error ImportError: no module 
> named 'server_handle'  
> 
> adding of code like:
> 
> import sys
> sys.path.insert(0,'/home/user/flask_stuff_files')
> 
> dont solve the problem too (do you know why, btw?)
> 
> Theres something i didn`t properly understood, so sorry for annoying and dumb 
> questions :)
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/modwsgi 
> <https://groups.google.com/group/modwsgi>.
> For more options, visit https://groups.google.com/d/optout 
> <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