Add Flask-Cache

master
Steven Loria 11 years ago
parent 64e28cfdaa
commit 82eca9190d
  1. 4
      README.rst
  2. 3
      {{cookiecutter.repo_name}}/requirements/prod.txt
  3. 4
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/app.py
  4. 7
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/extensions.py
  5. 2
      {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/settings.py

@ -23,9 +23,10 @@ Features
- Flask-WTForms with login and registration forms
- Flask-Login for authentication
- Procfile for deploying to a PaaS (e.g. Heroku)
- Flask-Testing, Flask-Webtest, nose, and Factory-Boy for testing
- Flask-Testing, Flask-Webtest, nose, and Factory-Boy for testing (example tests included)
- A simple ``manage.py`` script.
- CSS and JS minification using Flask-Assets
- Caching using Flask-Cache
- Useful debug toolbar
- Utilizes best practices: `Blueprints <http://flask.pocoo.org/docs/blueprints/>`_ and `Application Factory <http://flask.pocoo.org/docs/patterns/appfactories/>`_ patterns
@ -73,6 +74,7 @@ Changelog
- Use WebTest for functional testing.
- Add Flask-Debugtoolbar.
- Migrations using Flask-Migrate.
- Caching using Flask-Cache.
0.2.0 (09/21/2013)
******************

@ -30,3 +30,6 @@ jsmin>=2.0.4
# Auth
Flask-Login>=0.2.7
Flask-Bcrypt>=0.5.2
# Caching
Flask-Cache>=0.12

@ -4,7 +4,8 @@ from flask_debugtoolbar import DebugToolbarExtension
from {{cookiecutter.repo_name}}.settings import ProdConfig
from {{cookiecutter.repo_name}}.assets import assets
from {{cookiecutter.repo_name}}.extensions import db, login_manager, migrate
from {{cookiecutter.repo_name}}.extensions import (db, login_manager, migrate,
cache)
from {{cookiecutter.repo_name}} import public, user
@ -26,6 +27,7 @@ def register_extensions(app):
login_manager.init_app(app)
assets.init_app(app)
toolbar = DebugToolbarExtension(app)
cache.init_app(app)
migrate.init_app(app, db)
return None

@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
"""Extensions module."""
"""Extensions module. Each extension is initialized in the app factory located
in app.py
"""
from flask.ext.bcrypt import Bcrypt
bcrypt = Bcrypt()
@ -12,3 +14,6 @@ db = SQLAlchemy()
from flask.ext.migrate import Migrate
migrate = Migrate()
from flask.ext.cache import Cache
cache = Cache()

@ -9,6 +9,7 @@ class Config(object):
BCRYPT_LEVEL = 13
DEBUG_TB_ENABLED = False # Disable Debug toolbar
DEBUG_TB_INTERCEPT_REDIRECTS = False
CACHE_TYPE = "simple" # Can be "memcached", "redis", etc.
class ProdConfig(Config):
@ -31,3 +32,4 @@ class DevConfig(Config):
SQLALCHEMY_ECHO = True
DEBUG_TB_ENABLED = True
ASSETS_DEBUG = True # Don't bundle/minify static assets
CACHE_TYPE = "simple" # Can be "memcached", "redis", etc.

Loading…
Cancel
Save