diff frontend/mfrontend/views/frontend.py @ 5:3ba60dfc1d64

Dodałem prosty instalator aplikacji tworzący bazę danych ze schematu
author Michał Rudowicz <michal.rudowicz@fl9.eu>
date Sun, 27 Feb 2011 09:33:03 +0100
parents cf786ee26a22
children 27d63cac76ac
line wrap: on
line diff
--- a/frontend/mfrontend/views/frontend.py	Tue Feb 22 20:38:51 2011 +0000
+++ b/frontend/mfrontend/views/frontend.py	Sun Feb 27 09:33:03 2011 +0100
@@ -1,7 +1,8 @@
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 
-from flask import Module, render_template, request, url_for, escape, session, redirect, flash
+from flask import Module, render_template, request, url_for
+from flask import escape, session, redirect, flash, abort
 from mfrontend import db, utils
 frontend = Module(__name__)
 
@@ -9,6 +10,16 @@
 def index():
     return render_template('hello.html')
 
+@frontend.route('/install')
+def install():
+    """Instaluje aplikację, tworząc pustą bazę danych
+       według schematu.
+    """
+    if db.init_db():
+        return render_template('install_ok.html')
+    else:
+        abort(404)
+
 @frontend.route('/login', methods=['GET', 'POST'])
 def login():
     if request.method == 'POST':