# 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: template_maker/assets.py

# 
# Path: template_maker/builder/views.py
# def load_user(userid):
# def restrict_access():
# def list_templates():
# def new_template():
# def new_section(template_id, section_type=None):
# def edit_template_metadata(template_id):
# def redirect_to_section(template_id):
# def edit_template(template_id, section_id=None, section_type=None):
# def delete_section(template_id, section_id):
# def publish_template(template_id):
# SECTION_FORM_MAP = {
#     'text': TemplateSectionTextForm,
#     'fixed_text': TemplateSectionTextForm,
#     'dummy': TemplateSectionForm
# }
# 
# Path: template_maker/generator/views.py
# TYPE_VARIABLES_MAP = {
#     1: TextField, 2: DatePickerField, 3: IntegerField, 4: FloatField
# }
# def load_user(userid):
# def restrict_access():
# def list_templates():
# def in_progress_documents():
# def edit_in_progress_document(document_id):
# def new_document(template_id):
# def strip_tags(name):
# def generate_class(placeholder):
# def create_rivets_bindings(placeholder, section_text):
# def edit_document_sections(document_id, section_id=None):
#     class F(Form):
# 
# Path: template_maker/extensions.py



from flask import Flask
from template_maker.settings import DevConfig, ProdConfig
from template_maker.assets import assets
from template_maker.builder import views as b_views
from template_maker.generator import views as g_views
from template_maker import frontmatter, users
from template_maker.extensions import (
    db, migrate, debug_toolbar, login_manager
)


def create_app(config_object=DevConfig):
    app = Flask(__name__)
    app.config.from_object(config_object)
    register_extensions(app)
    register_blueprints(app)
    return app

def register_blueprints(app):
    app.register_blueprint(b_views.blueprint)
    app.register_blueprint(g_views.blueprint)
    app.register_blueprint(frontmatter.views.blueprint)
    app.register_blueprint(users.views.blueprint)
    return None

def register_extensions(app):
    assets.init_app(app)
    db.init_app(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: template_maker/assets.py

# 
# Path: template_maker/builder/views.py
# def load_user(userid):
# def restrict_access():
# def list_templates():
# def new_template():
# def new_section(template_id, section_type=None):
# def edit_template_metadata(template_id):
# def redirect_to_section(template_id):
# def edit_template(template_id, section_id=None, section_type=None):
# def delete_section(template_id, section_id):
# def publish_template(template_id):
# SECTION_FORM_MAP = {
#     'text': TemplateSectionTextForm,
#     'fixed_text': TemplateSectionTextForm,
#     'dummy': TemplateSectionForm
# }
# 
# Path: template_maker/generator/views.py
# TYPE_VARIABLES_MAP = {
#     1: TextField, 2: DatePickerField, 3: IntegerField, 4: FloatField
# }
# def load_user(userid):
# def restrict_access():
# def list_templates():
# def in_progress_documents():
# def edit_in_progress_document(document_id):
# def new_document(template_id):
# def strip_tags(name):
# def generate_class(placeholder):
# def create_rivets_bindings(placeholder, section_text):
# def edit_document_sections(document_id, section_id=None):
#     class F(Form):
# 
# Path: template_maker/extensions.py



# Path: template_maker/app.py
from flask import Flask
from template_maker.settings import DevConfig, ProdConfig
from template_maker.assets import assets
from template_maker.builder import views as b_views
from template_maker.generator import views as g_views
from template_maker import frontmatter, users
from template_maker.extensions import (
    db, migrate, debug_toolbar, login_manager
)



def create_app(config_object=DevConfig):
    app = Flask(__name__)
    app.config.from_object(config_object)
    register_extensions(app)
    register_blueprints(app)
    return app

def register_blueprints(app):
    app.register_blueprint(b_views.blueprint)
    app.register_blueprint(g_views.blueprint)
    app.register_blueprint(frontmatter.views.blueprint)
    app.register_blueprint(users.views.blueprint)
    return None

def register_extensions(app):
    assets.init_app(app)
    db.init_app(app)

    migrate.init_app(app, db)