# -*- coding: utf-8 -*-
"""Setup the {{project}} application"""
import logging

from {{package}}.config.environment import load_environment

log = logging.getLogger(__name__)

from paste.deploy import loadapp
from pylons import config
from elixir import *
from {{package}}.model import meta
from {{package}} import model

def setup_app(command, conf, vars):
    """Place any commands to setup {{package}} here"""
    load_environment(conf.global_conf, conf.local_conf)
    import datetime
    model.metadata.create_all(checkfirst=True)

    log.info("Adding front page data...")
    page = model.Page()
    page.title = 'FrontPage'
    page.content = 'Welcome to the QuickWiki front page.'
    meta.Session.add(page)
    meta.Session.commit()
    log.info("Successfully set up.")
     