当前位置: 首页>>代码示例>>Python>>正文


Python Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']方法代码示例

本文整理汇总了Python中flask.app.Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']方法的典型用法代码示例。如果您正苦于以下问题:Python Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']方法的具体用法?Python Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']怎么用?Python Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.app.Flask的用法示例。


在下文中一共展示了Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Flask

# 需要导入模块: from flask.app import Flask [as 别名]
# 或者: from flask.app.Flask import config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS'] [as 别名]
# landportal-data-access-api is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>

"""
Created on 03/02/2014
This file make the setup configuration for the Flask-Server

:author: Herminio García
"""
from flask.app import Flask
from flask.ext.cache import Cache
from flask.ext.track_usage import TrackUsage
from flask.ext.track_usage.storage.sql import SQLStorage
from flask_sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+mysqlconnector://root:[email protected]:3306/landportal'
#app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///foo.db'
app.config['TRACK_USAGE_USE_FREEGEOIP'] = False
app.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS'] = 'exclude'
#cache = Cache(app, config={'CACHE_TYPE': 'simple'})
cache = Cache(app, config={'CACHE_TYPE': 'memcached', 'CACHE_MEMCACHED_SERVERS': ['localhost:11211']})
app.config['DEBUG'] = True
db = SQLAlchemy(app)
sql_database_storage = SQLStorage('mysql+mysqlconnector://root:[email protected]:3306/landportal', table_name='api_usage')
#sql_database_storage = SQLStorage('sqlite:///analytics.db', table_name='api_usage')
t = TrackUsage(app, sql_database_storage)

from app import views

开发者ID:weso,项目名称:landportal-data-access-api,代码行数:31,代码来源:__init__.py


注:本文中的flask.app.Flask.config['TRACK_USAGE_INCLUDE_OR_EXCLUDE_VIEWS']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。