Use Flask blueprints for modularisation, per Khushboo Vashi.

This commit is contained in:
Dave Page
2015-01-19 16:38:47 +00:00
parent ca6ef66b61
commit 2c1688e6f4
3 changed files with 13 additions and 10 deletions

View File

@@ -9,6 +9,3 @@
#
##########################################################################
from flask import Module
module = Module(__name__, 'utils')

View File

@@ -10,14 +10,17 @@
##########################################################################
import config
from utils import module
from flask import Blueprint
from time import time, ctime
# Initialise the module
blueprint = Blueprint('utils', __name__)
##########################################################################
# A test page
##########################################################################
@module.route("/test")
def index():
@blueprint.route("/test")
def test():
output = """
Today is <b>%s</b>
@@ -31,6 +34,6 @@ Today is <b>%s</b>
##########################################################################
# A special URL used to "ping" the server
##########################################################################
@module.route("/ping")
@blueprint.route("/ping")
def ping():
return "PING"