添加环境变量判断

This commit is contained in:
pengtao 2019-07-16 17:00:25 +08:00
parent 987550c263
commit f8ee128bfd
3 changed files with 6 additions and 4 deletions

View File

@ -112,7 +112,7 @@ class DispatchHandler(tornado.web.RequestHandler):
if adid:
key = f"ad::{adid}::num"
my_redis.incr(key)
my_redis.incr(key, amount=1)
self.write({'errcode': 0, "errmsg": '', "message": f"{adid} incr success!"})

View File

@ -10,6 +10,8 @@ if ad_env == 'prod':
elif ad_env == 'dev':
redis_company_config = {'host': '192.168.100.20', 'port': 6379, 'db': 2, 'passwd': ''}
mysql_promotion_config = {'user': 'miles', 'pswd': 'aspect', 'host': '192.168.100.30', 'db': 'test'}
else:
raise Exception("GET config with mysql/redis failed!")
expire_time = 7200

View File

@ -17,9 +17,9 @@ app = Flask(__name__)
api = Api(app)
# 设置路由
api.add_resource(Company, '/company')
api.add_resource(Location, '/location')
api.add_resource(Ad, '/ad')
api.add_resource(Company, '/interface/company')
api.add_resource(Location, '/interface/location')
api.add_resource(Ad, '/interface/ad')
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=5015)