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
我正在使用 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