[Flask] Fwd: Need help deploying using mod_wsgi (Apache)

King Kong kingkong88 at gmail.com
Sat Feb 6 10:58:30 EST 2016


I am trying to deploy a simple test app on a Raspberry Pi by following the
instructions at http://flask.pocoo.org/docs/0.10/deploying/mod_wsgi/.

I need help in what should be in the *yourapplication.wsgi* file. Does this
file contain Python code?

My project folder is /Z/flask and it runs fine in the development server,
ie http://localhost:5000.


*/Z/flask/app.py* contains:


#!/usr/bin/python3
from flask import Flask, jsonify, session, g, render_template

app = Flask(__name__)

from views import general
app.register_blueprint(general.mod)

if __name__ == '__main__':
    app.run(host='0.0.0.0',debug=True)


*/Z/flask/views/general.py* contains:

from flask import Blueprint, render_template, session, redirect, url_for, \
      request, flash, g, jsonify, abort

mod = Blueprint('general', __name__)

@mod.route('/')
def index():
   return "<h1>Who are you?</h1>"

@mod.route('/test')
def text():
   return "<h1>Testing...</h1>"



*/Z/flask/views/__init__.py* is an empty file

What should be in *yourapplication.wsgi*?  Also, what does this paragraph
in that documentation page mean:

"If you don’t have a factory function for application creation but a
singleton instance you can directly import that one as application."


The folder /Z/flask is owned by user *pi*.  I think apache2 runs using user
*www-data*.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160206/92d35343/attachment.html>


More information about the Flask mailing list