这是声明应用程序地址的代码
def includeme(config):
a = config.add_handler
a('fileupload', '{lang}/case/fileupload{sep:/*}{name:.*}', ImageUpload)
这里有类ImageUpload
@action(route_name='fileupload')
class ImageUpload():
def __init__(self,request):
@action(request_method='GET', renderer="json")
def get(self):
@action(request_method='POST', xhr=True, accept="application/json", renderer='json')
def post(self):
当我尝试去ru / case / fileupload /它什么都没有,有什么问题以及如何解决它?
答案 0 :(得分:0)
您需要为自己的行为命名,目前名称为“获取”和“发布”。您可能希望在方法上使用@action(name='index', ...)
,然后config.add_handler(..., action=index')
。
答案 1 :(得分:0)
只有我发现它的决定似乎是
def includeme(config):
a = config.add_handler
a('modeluploadget', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='GET', action='get')
a('modeluploadpost', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='POST', action='post')
a('modeluploaddelete', '/fileupload{sep:/*}{name:.*}', ModelUpload, request_method='DELETE', action='delete')