本文整理匯總了Python中flask.app.Flask.config['TRACK_USAGE_USE_FREEGEOIP']方法的典型用法代碼示例。如果您正苦於以下問題:Python Flask.config['TRACK_USAGE_USE_FREEGEOIP']方法的具體用法?Python Flask.config['TRACK_USAGE_USE_FREEGEOIP']怎麽用?Python Flask.config['TRACK_USAGE_USE_FREEGEOIP']使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flask.app.Flask
的用法示例。
在下文中一共展示了Flask.config['TRACK_USAGE_USE_FREEGEOIP']方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Flask
# 需要導入模塊: from flask.app import Flask [as 別名]
# 或者: from flask.app.Flask import config['TRACK_USAGE_USE_FREEGEOIP'] [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