Add Flask-Debug toolbar

Also, don't bundle and minify assets in dev enviromnet
master
Steven Loria 11 years ago
parent c0c5932e9e
commit e9dfd0573a
  1. 3
      {{cookiecutter.repo_name}}/requirements/dev.txt
  2. 6
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py
  3. 10
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py

@ -9,3 +9,6 @@ Flask-WebTest>=0.0.6
# Management script
Flask-Script
# Debug toolbar
Flask-DebugToolbar

@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
from flask import Flask
from flask.ext.assets import Environment
from flask_debugtoolbar import DebugToolbarExtension
from webassets.loaders import PythonLoader
from {{cookiecutter.repo_name}}.settings import ProdConfig
from {{cookiecutter.repo_name}}.assets import assets
from {{cookiecutter.repo_name}}.extensions import login_manager
from {{cookiecutter.repo_name}}.database import db
from {{cookiecutter.repo_name}}.extensions import db, login_manager
from {{cookiecutter.repo_name}} import public, user
@ -27,11 +27,11 @@ def register_extensions(app):
db.init_app(app)
login_manager.init_app(app)
assets.init_app(app)
toolbar = DebugToolbarExtension(app)
return None
def register_blueprints(app):
# Register blueprints
app.register_blueprint(public.views.blueprint)
app.register_blueprint(user.views.blueprint)
return None

@ -1,19 +1,27 @@
# -*- coding: utf-8 -*-
import os
class Config(object):
SECRET_KEY = 'shhhh'
APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
PROJECT_ROOT = os.path.abspath(os.path.join(APP_DIR, os.pardir))
BCRYPT_LEVEL = 13
DEBUG_TB_ENABLED = False # Disable Debug toolbar
DEBUG_TB_INTERCEPT_REDIRECTS = False
class ProdConfig(Config):
'''Production configuration.'''
ENV = 'prod'
DEBUG = False
SQLALCHEMY_DATABASE_URI = 'postgresql://localhost/example'
SQLALCHEMY_ECHO = False
DEBUG_TB_ENABLED = False # Disable Debug toolbar
class DevConfig(Config):
'''Development configuration.'''
ENV = 'dev'
DEBUG = True
DB_NAME = "dev.db"
@ -21,3 +29,5 @@ class DevConfig(Config):
DB_PATH = os.path.join(Config.PROJECT_ROOT, DB_NAME)
SQLALCHEMY_DATABASE_URI = "sqlite:///{0}".format(DB_PATH)
SQLALCHEMY_ECHO = True
DEBUG_TB_ENABLED = True
ASSETS_DEBUG = True # Don't bundle/minify static assets

Loading…
Cancel
Save