提交 43fd266f 编写于 作者: 鞋子不会飞's avatar 鞋子不会飞

新架构第一次跑通

上级 9e6b2488
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from aliyunsdkcore.request import RpcRequest
class SendSmsRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'Dysmsapi', '2017-05-25', 'SendSms')
def get_TemplateCode(self):
return self.get_query_params().get('TemplateCode')
def set_TemplateCode(self,TemplateCode):
self.add_query_param('TemplateCode',TemplateCode)
def get_PhoneNumbers(self):
return self.get_query_params().get('PhoneNumbers')
def set_PhoneNumbers(self,PhoneNumbers):
self.add_query_param('PhoneNumbers',PhoneNumbers)
def get_SignName(self):
return self.get_query_params().get('SignName')
def set_SignName(self,SignName):
self.add_query_param('SignName',SignName)
def get_ResourceOwnerAccount(self):
return self.get_query_params().get('ResourceOwnerAccount')
def set_ResourceOwnerAccount(self,ResourceOwnerAccount):
self.add_query_param('ResourceOwnerAccount',ResourceOwnerAccount)
def get_TemplateParam(self):
return self.get_query_params().get('TemplateParam')
def set_TemplateParam(self,TemplateParam):
self.add_query_param('TemplateParam',TemplateParam)
def get_ResourceOwnerId(self):
return self.get_query_params().get('ResourceOwnerId')
def set_ResourceOwnerId(self,ResourceOwnerId):
self.add_query_param('ResourceOwnerId',ResourceOwnerId)
def get_OwnerId(self):
return self.get_query_params().get('OwnerId')
def set_OwnerId(self,OwnerId):
self.add_query_param('OwnerId',OwnerId)
def get_SmsUpExtendCode(self):
return self.get_query_params().get('SmsUpExtendCode')
def set_SmsUpExtendCode(self,SmsUpExtendCode):
self.add_query_param('SmsUpExtendCode',SmsUpExtendCode)
def get_OutId(self):
return self.get_query_params().get('OutId')
def set_OutId(self,OutId):
self.add_query_param('OutId',OutId)
\ No newline at end of file
# # Licensed to the Apache Software Foundation (ASF) under one
# # or more contributor license agreements. See the NOTICE file
# # distributed with this work for additional information
# # regarding copyright ownership. The ASF licenses this file
# # to you under the Apache License, Version 2.0 (the
# # "License"); you may not use this file except in compliance
# # with the License. You may obtain a copy of the License at
# #
# # http://www.apache.org/licenses/LICENSE-2.0
# #
# #
# #
# # Unless required by applicable law or agreed to in writing,
# # software distributed under the License is distributed on an
# # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# # KIND, either express or implied. See the License for the
# # specific language governing permissions and limitations
# # under the License.
#
# from aliyunsdkcore.request import RpcRequest
# class SendSmsRequest(RpcRequest):
#
# def __init__(self):
# RpcRequest.__init__(self, 'Dysmsapi', '2017-05-25', 'SendSms')
#
# def get_TemplateCode(self):
# return self.get_query_params().get('TemplateCode')
#
# def set_TemplateCode(self,TemplateCode):
# self.add_query_param('TemplateCode',TemplateCode)
#
# def get_PhoneNumbers(self):
# return self.get_query_params().get('PhoneNumbers')
#
# def set_PhoneNumbers(self,PhoneNumbers):
# self.add_query_param('PhoneNumbers',PhoneNumbers)
#
# def get_SignName(self):
# return self.get_query_params().get('SignName')
#
# def set_SignName(self,SignName):
# self.add_query_param('SignName',SignName)
#
# def get_ResourceOwnerAccount(self):
# return self.get_query_params().get('ResourceOwnerAccount')
#
# def set_ResourceOwnerAccount(self,ResourceOwnerAccount):
# self.add_query_param('ResourceOwnerAccount',ResourceOwnerAccount)
#
# def get_TemplateParam(self):
# return self.get_query_params().get('TemplateParam')
#
# def set_TemplateParam(self,TemplateParam):
# self.add_query_param('TemplateParam',TemplateParam)
#
# def get_ResourceOwnerId(self):
# return self.get_query_params().get('ResourceOwnerId')
#
# def set_ResourceOwnerId(self,ResourceOwnerId):
# self.add_query_param('ResourceOwnerId',ResourceOwnerId)
#
# def get_OwnerId(self):
# return self.get_query_params().get('OwnerId')
#
# def set_OwnerId(self,OwnerId):
# self.add_query_param('OwnerId',OwnerId)
#
# def get_SmsUpExtendCode(self):
# return self.get_query_params().get('SmsUpExtendCode')
#
# def set_SmsUpExtendCode(self,SmsUpExtendCode):
# self.add_query_param('SmsUpExtendCode',SmsUpExtendCode)
#
# def get_OutId(self):
# return self.get_query_params().get('OutId')
#
# def set_OutId(self,OutId):
# self.add_query_param('OutId',OutId)
\ No newline at end of file
......@@ -22,9 +22,13 @@ pytz==2018.7
redis==2.10.6
requests==2.21.0
six==1.11.0
SQLAlchemy==1.2.14
SQLAlchemy
sqlparse==0.4.1
tzlocal==1.5.1
tzlocal
urllib3==1.24.1
vine==1.1.4
Werkzeug==2.0.1
flask_sqlalchemy
jwt
celery
aliyunsdkcore
......@@ -112,12 +112,12 @@ def create_app(config, enable_config_file=False):
from .resources.user import user_bp
app.register_blueprint(user_bp)
# 注册新闻模块蓝图
from .resources.news import news_bp
app.register_blueprint(news_bp)
# 注册搜索模块蓝图
from .resources.search import search_bp
app.register_blueprint(search_bp)
# # 注册新闻模块蓝图
# from .resources.news import news_bp
# app.register_blueprint(news_bp)
#
# # 注册搜索模块蓝图
# from .resources.search import search_bp
# app.register_blueprint(search_bp)
return app
......@@ -8,10 +8,12 @@ import os
# sys.path.insert(0, os.path.join(BASE_DIR, 'im'))
from flask import jsonify
from . import create_app
from .settings.default import DefaultConfig
from wyh_web_tools import create_app
# 创建flask应用
from wyh_web_tools.settings.default import DefaultConfig
app = create_app(DefaultConfig, enable_config_file=True)
......@@ -23,3 +25,8 @@ def route_map():
rules_iterator = app.url_map.iter_rules()
return jsonify(
{rule.endpoint: rule.rule for rule in rules_iterator if rule.endpoint not in ('route_map', 'static')})
if __name__ == '__main__':
print(app.url_map)
app.run(debug=True)
......@@ -2,7 +2,7 @@ from flask import Blueprint
from flask_restful import Api
from utils.output import output_json
from . import passport, profile, following
# from . import passport, profile, following
# 创建蓝图对象
user_bp = Blueprint('user', __name__)
......@@ -13,19 +13,19 @@ from . import views # 从当前包中导入views文件
user_api = Api(user_bp)
# 指定自定义的json返回格式
user_api.representation('application/json')(output_json)
# 添加类视图
user_api.add_resource(passport.SMSVerificationCodeResource, '/v1_0/sms/codes/<mobile:mobile>',
endpoint='SMSVerificationCode')
user_api.add_resource(passport.AuthorizationResource, '/v1_0/authorizations',
endpoint='Authorization')
user_api.add_resource(profile.PhotoResource, '/v1_0/user/photo',
endpoint='Photo')
user_api.add_resource(profile.CurrentUserProfileResource, '/v1_0/user',
endpoint='CurrentUser')
user_api.add_resource(following.FollowingListResource, '/v1_0/user/followings',
endpoint='Followings')
#
# # 添加类视图
# user_api.add_resource(passport.SMSVerificationCodeResource, '/v1_0/sms/codes/<mobile:mobile>',
# endpoint='SMSVerificationCode')
#
# user_api.add_resource(passport.AuthorizationResource, '/v1_0/authorizations',
# endpoint='Authorization')
#
# user_api.add_resource(profile.PhotoResource, '/v1_0/user/photo',
# endpoint='Photo')
#
# user_api.add_resource(profile.CurrentUserProfileResource, '/v1_0/user',
# endpoint='CurrentUser')
#
# user_api.add_resource(following.FollowingListResource, '/v1_0/user/followings',
# endpoint='Followings')
......@@ -19,7 +19,7 @@ class DefaultConfig(object):
# 日志
LOGGING_LEVEL = 'DEBUG' # 日志级别
LOGGING_FILE_DIR = '/home/python/logs' # 日志文件目录
LOGGING_FILE_DIR = 'D:/wyh/Python_project/wyh_web_tools/logs' # 日志文件目录
LOGGING_FILE_MAX_BYTES = 300 * 1024 * 1024 # 日志文件大小
LOGGING_FILE_BACKUP = 10 # 日志文件数量
PROPAGATE_EXCEPTIONS = True # 设置为False, 则flask内置日志会写入文件, 但错误信息将不会显示到网页上
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册