在Pythonanywhere上部署Apache Superset

问题描述 投票:1回答:1

我试图找出如何使用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个回答
2
投票

来自Pythonanywhere suggested this simple solution的giles:

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

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

© www.soinside.com 2019 - 2024. All rights reserved.