# Path: template_maker/app.py
# def create_app(config_object=DevConfig):
# def register_blueprints(app):
# def register_extensions(app):
# 
# Path: template_maker/settings.py
# class DevConfig(Config):
#     ENV = os.environ.get('TEMPLATE_MAKER_ENV', 'dev')
#     DEBUG = True
#     SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'postgresql://localhost/template_maker')
#     DEBUG_TB_INTERCEPT_REDIRECTS = False
#     BROWSERID_URL = os.environ.get('BROWSERID_URL', 'http://localhost:9000')
#     DEBUG_TB_ENABLED = True
# 
# class ProdConfig(Config):
#     ENV = os.environ.get('TEMPLATE_MAKER_ENV', 'prod')
#     DEBUG = False
#     SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
#     BROWSERID_URL = os.environ.get('BROWSERID_URL')


import os
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from flask.ext.assets import ManageAssets
from template_maker.app import create_app, db
from template_maker.settings import DevConfig, ProdConfig
    from template_maker.users.models import User


if os.environ.get('TEMPLATE_MAKER_ENV') == 'prod':
    app = create_app(ProdConfig)    
else:
    app = create_app(DevConfig)

manager = Manager(app)

def _make_context():
    """Return context dict for a shell session so you can access
    app and db by default.
    """
    return {'app': app, 'db': db}

@manager.command
def seed_email():
    user_exists = User.query.filter(User.email==app.config.get('SEED_EMAIL')).first()
    if not user_exists:
        print 'Creating seed user'
        seed_user = User(email=app.config.get('SEED_EMAIL'), is_admin=True)
        db.session.add(seed_user)

# Path: template_maker/app.py
# def create_app(config_object=DevConfig):
# def register_blueprints(app):
# def register_extensions(app):
# 
# Path: template_maker/settings.py
# class DevConfig(Config):
#     ENV = os.environ.get('TEMPLATE_MAKER_ENV', 'dev')
#     DEBUG = True
#     SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'postgresql://localhost/template_maker')
#     DEBUG_TB_INTERCEPT_REDIRECTS = False
#     BROWSERID_URL = os.environ.get('BROWSERID_URL', 'http://localhost:9000')
#     DEBUG_TB_ENABLED = True
# 
# class ProdConfig(Config):
#     ENV = os.environ.get('TEMPLATE_MAKER_ENV', 'prod')
#     DEBUG = False
#     SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL')
#     BROWSERID_URL = os.environ.get('BROWSERID_URL')


# Path: manage.py
import os
from flask.ext.script import Manager, Shell, Server
from flask.ext.migrate import MigrateCommand
from flask.ext.assets import ManageAssets
from template_maker.app import create_app, db
from template_maker.settings import DevConfig, ProdConfig
    from template_maker.users.models import User



if os.environ.get('TEMPLATE_MAKER_ENV') == 'prod':
    app = create_app(ProdConfig)    
else:
    app = create_app(DevConfig)

manager = Manager(app)

def _make_context():
    """Return context dict for a shell session so you can access
    app and db by default.
    """
    return {'app': app, 'db': db}

@manager.command
def seed_email():
    user_exists = User.query.filter(User.email==app.config.get('SEED_EMAIL')).first()
    if not user_exists:
        print 'Creating seed user'
        seed_user = User(email=app.config.get('SEED_EMAIL'), is_admin=True)
        db.session.add(seed_user)

        db.session.commit()