【问题标题】:Getting Apache Superset deployed on Pythonanywhere在 Pythonanywhere 上部署 Apache Superset
【发布时间】:2018-08-29 11:31:04
【问题描述】:

我试图弄清楚如何使用 uWSGI+nginx 将 Apache Superset 的实例部署为 Pythonanywhere 上的 Web 应用程序。


我已经在 Pythonanywhere 上安装了启动虚拟环境,并按照 instructions on the website 安装和设置了 Superset。在 Pythonanywhere 上启动 Superset 服务器似乎可以工作,但是我找不到任何关于如何将 Superset 与 flask 一起使用的文档,以便 Superset 可以与 xxx.pythonanywhere.com 支持的 uWSGI+nginx 一起使用。


wsgi文件很简单:

import sys

project_home = u'/home/tmo/testsite'
if project_home not in sys.path:
    sys.path = [project_home] + sys.path

from flask_app import app as application

据我所知,在 PythonAnywhere 上,WSGI 方面由 /var/www/you_domain_wsgi.py 中每个域的文件管理。它需要定义一个名为 application 的变量,它与 init.py. 中的应用程序相同,但我看不到在运行 superset runserver 时如何部署任何类型的 Flask 应用程序。在他们的文档中,他们只是声明“请参阅您首选技术的文档,以在您的环境中运行良好的方式设置此 Flask WSGI 应用程序。”。

/superset/bin/ 中有一个名为flask 的文件,其中包含

import re
import sys
from flask.cli import main
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())

但我真的找不到任何看起来像 Superset 的 Flask 包装器的东西。

我是否误解了一些基本的东西?欢迎大家指点。

【问题讨论】:

    标签: flask pythonanywhere superset apache-superset


    【解决方案1】:

    来自 Pythonanywhere suggested this simple solution 的吉尔斯:

    import superset
    from superset import app as application
    

    立即生效。例如。整个烧瓶文件看起来像

    import sys
    import superset
    
    project_home = u'/home/tmo/testsite'
    if project_home not in sys.path:
        sys.path = [project_home] + sys.path
    
    from superset import app as application
    

    其中只有最后一行是超集运行所必需的。

    【讨论】:

      猜你喜欢
      • 2018-01-28
      • 2012-01-13
      • 1970-01-01
      • 2020-09-06
      • 2021-07-02
      • 2020-03-30
      • 2016-09-05
      • 2019-07-30
      • 2014-01-30
      相关资源
      最近更新 更多