[Flask] Need help deploying using mod_wsgi (Apache)
kingkong88 at gmail.com
Wed Feb 10 00:57:28 EST 2016
nitori, does that mean that I must first convert my app into a package with
a __init__.py file?
I am now hitting a 403 Forbidden (You don't have permission to access /api
on this server.) Log shows: [authz_core:error] [pid 6817:tid 3021182000]
[client 220.xxx.xxx.xxx:56401] AH01630: client denied by server
configuration: /Z/flask/app.wsgi. (I think my app.wsgi file hasn't got the
chance to run yet.)
My /Z/flask folder is pretty liberal with rights:
-rwxr-xr-x 1 pi pi 302 Feb 5 18:04 app.py
-rwxr-xr-x 1 pi pi 39 Feb 10 13:42 app.wsgi
-rwxr-xr-x 1 pi pi 37 Feb 6 15:41 index.py
drwxr-xr-x 3 pi pi 4096 Feb 5 17:56 views
I am confused over the user/group in the config file. Read the
but couldn't figure out what it means regarding the user parameter.
My /etc/apache2/sites-available/000-default.conf contains:
WSGIDaemonProcess app user=pi group=pi threads=5
WSGIScriptAlias /api /Z/flask/app.wsgi
#Alias /api /Z/flask/
<Directory /Z/flask >
Options Indexes FollowSymLinks MultiViews ExecCGI
Allow from all
Addhandler wsgi-script .py
Am I using the correct user/group values? What is causing the access error?
> Message: 2
> Date: Sun, 7 Feb 2016 11:33:01 +0100
> From: Lars Peter S?ndergaard <lps at chireiden.net>
> To: flask at python.org
> Subject: Re: [Flask] Fwd: Need help deploying using mod_wsgi (Apache)
> Message-ID: <20160207113301.5d7a89f6 at ikarus.ikarus>
> Content-Type: text/plain; charset="utf-8"
> On Sat, 6 Feb 2016 23:58:30 +0800 King Kong <kingkong88 at gmail.com>
> > 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
> If you use python3, you'll probably want to install
> libapache2-mod-wsgi-py3 instead. Though I do not know what python3
> version it uses on your machine, if it happens to be anything below
> python3.3, you'll probably have bad luck with your deployment.
> > */Z/flask/views/general.py* contains:
> > */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.
> In the case of flask, you just want to import your "app" from your
> app.py file, and name it "application"
> I usually just call the file "wsgi.py", because well, it's supposed to
> be a python file. But that shouldn't actually matter to much.
> That file should be located in /Z/flask/ and probably contain something
> from app import app as application
> That's pretty much all.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Flask