def application(environ, start_response):
status = '200 OK'
output = add.echo()
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]-------------------------
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]"Hello, World!"--
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+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.
On 21 Aug 2016, at 8:35 PM, Tierprot B. <tier...@gmail.com> wrote:Thanks for the fast reply! I did what you`ve wrote and yay it worked! Now i wondering how can i tell to mod_wsgi two things - a) that wsgi file itself lies in /var/www/wsgi-scripts and
b) that it should include python files from outside directory, for example home/user/flask_stuff_files ?
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
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]To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+unsubscribe@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
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 a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/mDhEH4ChXgE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+unsubscribe@googlegroups.com.
On 22 Aug 2016, at 8:16 AM, Tierprot B. <tier...@gmail.com> wrote:return render_template('index.html')def index()@app.route('/'):Aha! Thanks! Addition of proper user and group options to WSGIDaemonProcess solved the ImportError! The last question i have might be not related to mod_wsgi directly, but still.I have a Flask app, purpose of which to be able to upload files provided by user, do some math and return result on a new page. Simplified code looks like this:
...@app.route('/analysis', methods=['POST'])def upload():uploaded_files = request.files.getlist('files')
...for file in uploaded_files:
...return render_template('analysis.html')
...The folder with static files which Flask renders is:
home/user/flask_stuff_files/templates
in Apache ive corrected document root folder and added directory with static files:
apache-wsgi config:
----------------------------
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot /home/user/flask_stuff_files/templates
WSGIDaemonProcess home=/var/www/wsgi-scripts python-path=/home/user/flask_stuff_files user=user group=user
WSGIScriptAlias /test /var/www/wsgi-scripts/simple_app.wsgi process-group=app application-group=%{GLOBAL}
<Directory /var/www/wsgi-scripts>
Require all granted
</Directory>
<Directory /home/user/flask_stuff_files>WSGIProcessGroup appWSGIApplicationGroup %{GLOBAL}Require all granted
</Directory>
<Directory /home/user/flask_stuff_files/templates>WSGIProcessGroup appWSGIApplicationGroup %{GLOBAL}Require all granted
</Directory>
</VirtualHost>So, www.example.com/test - it renders main page as intended, but when i select files and submit them via POST request ive got a forbidden access with error_log : Permission denied [...] : acces to /analysis denied (filesystempath '/home/user/flask_stuff_files') because search permissions are missing on a component of the path, referer: www.example.com/test.For the test, i set permissions of the folder /home/user/flask_stuff_files to the drwxrwxrwx, it belongs to user user.So, could you share your thoughts on what is wrong here?
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.