繁体   English   中英

Flask_restPLUS + NGINX 类型错误

[英]Flask_restPLUS + NGINX TypeError

我正在使用 FLASK restPLUS + NGINX 开发 api 并且我的初始路线出现类型错误:

The view function did not return a valid response. The return type must be a string, dict, tuple, Response instance, or WSGI callable, but it was a Employee.

我的 api.py 看起来像:

from flask import Flask
from flask_restplus import Api, Resource

app = Flask(__name__)
api = Api(app)

@app.route("/employee")
class Employee(Resource):
    def get(self):
        response = dict({'hey': 'there'})
        return response

我的项目树是:

app
├── docker-compose.yml
├── flask
│   ├── Dockerfile
│   ├── .dockerignore
│   ├── app
│   │   ├── __init__.py
│   │   └── api.py
│   ├── app.ini
│   ├── requirements.txt
│   └── run.py
├── nginx
│   ├── Dockerfile
│   └── nginx.conf
├── .gitignore
└── readme.md

装修师错了。 我有app.route需要api.route

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM