Python到Web应用程序

时间:2017-02-18 00:40:18

标签: python django jupyter-notebook jupyter

我编写了一个python应用程序,它可以提取一些excel文件,进行一些数据分析,然后将结果写入一个创建绘图的excel文件中。

目前通过argparse使用输入参数设置选项。我想知道是否有一个好的,低开销的方法来使它成为一个Web应用程序。

通过jupyter.org发布的jupyter笔记本是个好主意吗?

我需要用django做点什么吗?

目前我的argparse代码看起来像这样。我使用Gooey来处理我的GUI。

def get_args():
    """Get CLI arguments and options"""
    parser = GooeyParser(description='AngioTool File Analyzer - Version ' + __version__,
                         formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument('Path',
                        help="Path to the AngioTool output files (.xls).",
                        widget='DirChooser')

    parser.add_argument('--Norm_Interval',
                        help='Name of the interval to which all the other intervals will be normalized.'
                             '\r\"auto\" tries to find the smallest interval and normalizes to that',
                        default='auto')

    parser.add_argument('--Control_Device',
                        help='Name of the control device to which all devices should be ratioed',
                        default='D1')


    parser.add_argument('--Ratio_to_Control_Device', dest='Ratio_to_Control_Device',
                        widget='CheckBox',
                        help='Check to ratio to the control device',
                        action='store_true', default='False')

    parser.add_argument('--Plot_Measurements',
                        help="List of measurements to plot",
                        default=('Total Vessels Length', 'Total Number of End Points', 'Total Number of Junctions'))

    parser.add_argument('--Chart_Titles', help='List of titles to be placed on plot',
                        default=('Total Vessels Length', 'Total Number of End Points', 'Total Number of Junctions'))

    args = parser.parse_args()

    return args

我需要从本地路径读取文件,允许用户通过某种Web UI设置选项,并将结果返回到新的Excel文件中。

任何想法都会非常感激。

1 个答案:

答案 0 :(得分:0)

我认为你正在寻找轻量级的东西,即尝试一些想法,你不打算在你的Python应用程序上运行亚马逊。因此,这有助于缩小选项范围,如Flask: http://flask.pocoo.org/

关于Excel的问题,这是使用Flask的send_file的示例:how to output xlsx generated by Openpyxl to browser?