【问题标题】:Python to Web ApplicationPython 到 Web 应用程序
【发布时间】:2017-07-07 16:13:56
【问题描述】:

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

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

通过 jupyter.org 发布的 jupyter notebook 是个好主意吗?

我需要用 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 文件中返回结果。

任何想法将不胜感激。

【问题讨论】:

  • Jupyter 可能没问题,但对它不熟悉,但如果它适合您的要求,请试一试。它似乎有一个专门的焦点,可能适合你。无论如何 - 对于 StackOverflow 问题,我们努力做到不偏不倚,所以更一般的问题,比如“什么是好工具”,不是这里回答的问题,而是更具体的问题,比如关于 Jupyter 问题的具体问题等

标签: python django jupyter-notebook jupyter


【解决方案1】:

我认为您正在寻找一些轻量级的东西来开始,即尝试一些想法,您还不想在您的 Python 应用程序上运行 Amazon。因此,这有助于将选择范围缩小到像 Flask 这样简单的东西: http://flask.pocoo.org/

关于 Excel 的问题,这里有一个使用 Flask 的 send_file 的例子:how to output xlsx generated by Openpyxl to browser?

【讨论】:

  • 当然不想经营亚马逊。 Flask 应用程序可以在 jupyter、github 甚至 Dropbox 之类的地方运行吗?我什至没有网络服务器。
  • GitHub 和 DropBox 更多地用于存储,我认为您的意思是像 Amazon AWS 或 Heroku 这样的托管服务提供商?一般来说,这些提供商擅长支持很多。我对 AWS 和 Heroku 很熟悉,所以举个例子:blog.miguelgrinberg.com/post/…
猜你喜欢
  • 2011-09-20
  • 2020-08-08
  • 1970-01-01
  • 2023-03-11
  • 1970-01-01
  • 1970-01-01
  • 2015-01-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多