Patter's Home

Python Flask - Minimal application

For reference, in case I foul this up

Apache File (using mod_wsgi)

<VirtualHost *:80>

    WSGIDaemonProcess application user=www-data group=www-data threads=5
    WSGIScriptAlias / /home/httpd/dev/application.wsgi

    <Directory /home/httpd/dev>
        WSGIProcessGroup application
        WSGIApplicationGroup %{GLOBAL}
        Order deny,allow
        Allow from all

Application Structure

3 files in the same directory
application.wsgi - wsgi init script - wsgi calls this to start - the flask app


Manually inserting the full path to our

import sys
sys.path.insert(0, '/home/httpd/dev')
from main import app as application

from __future__ import absolute_import

from app import app

if __name__ == '__main__':

from __future__ import absolute_import, unicode_literals

from flask import Flask
app = Flask(__name__)

def root():
    return "Wow this is totally useless so far!"

	def test():
	        return "And this is a test url"