Skip to content

Commit

Permalink
Merge pull request #40 from RobertIndie/fix_content_type
Browse files Browse the repository at this point in the history
[Fix] 返回内容不会被识别为json格式 close #39
  • Loading branch information
rexwangcc authored Jan 28, 2020
2 parents 424468a + eec2531 commit c123373
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from flask import Flask
from werkzeug.wrappers import Response as ResponseBase
from utils import data
import os

Expand All @@ -10,11 +11,14 @@
app.register_blueprint(data, url_prefix=path_prefix)
# 使用flask蓝图功能来注册http-router

class Response(ResponseBase):
default_mimetype = 'application/json'

def handler(environ, start_response):
return app(environ, start_response)

if __name__ == '__main__':
# 使用aliyun默认端口9000
port = os.environ.get("FC_SERVER_PORT", "9000")
app.response_class = Response
app.run(host='127.0.0.1', port=int(port))

0 comments on commit c123373

Please sign in to comment.