我在首页的位置使用了如下代码:

import flask
@page_index.route('/')
def index():
    #lask.redirect('/pythoncgi/')

结果站点出现以下错误:

[11/Nov/2019 15:03:01] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 2463, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 2449, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 1866, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib64/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    return self.finalize_request(rv)
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 1967, in finalize_request
    response = self.make_response(rv)
  File "/usr/local/lib64/python3.6/site-packages/flask/app.py", line 2097, in make_response
    "The view function did not return a valid response. The"
TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.

暂时将首页代码修改为如下:

@page_index.route('/')
def index():
    return '', 302, {'Location':'/pythoncgi/'}
01-12 00:45