web server 经典实例

2021-01-14 10:34:39 浏览数 (1)

文章目录

  • 源代码

源代码

代码语言:javascript复制
# -*- coding:utf-8 -*-
# /usr/bin/python
'''
@Author:  Yan Errol  
@Email:2681506@gmail.com   
@Date:  2019-05-28  17:11
@File:webserver.py
@Describe:webserver
'''


from flask import Flask
from flask import request
import pandas as pd
import server_demo


# 传递根目录
class WebServer:
    '''
    导入Flask框架,这个框架可以快捷地实现了一个WSGI应用
    '''

    def __init__(self, properties):
        self.port = properties['port']
        self.host = None
        if 'host' in properties.keys():
            self.host = properties['host']
        self.app = Flask('predict service')
        self.properties = properties

        @self.app.route('/')
        def predict():
            param_dict = {}
            if request.method

0 人点赞