我已经安装了 apache 超集,我需要使用 apache 的 mod_wsgi 通过 wsgi 服务器运行它。我是 python 和配置 apache 的新手。我需要帮助了解我的 superset.wsgi 和我的 superset.conf 到底是什么样子。
这是我的会议
<VirtualHost *:80>
WSGIDaemonProcess superset python-home=/var/www/superset
WSGIScriptAlias / /var/www/superset/superset.wsgi
WSGIProcessGroup superset
WSGIApplicationGroup %{GLOBAL}
<Directory /var/www/>
# set permissions as per apache2.conf file
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
这是我的 superset.wsgi
import sys
import site
sys.path.insert(0,'/var/www/superset')
sys.path.insert(0,'/var/www/superset/lib/python3.8/site-packages')
site.addsitedir('/var/www/superset/lib/python3.8/site-packages')
from superset import app as application
这是我在 apache2/error.log 中的错误
Exception occurred processing WSGI script '/var/www/superset/superset.wsgi'.
Traceback (most recent call last):
File "/var/www/superset/lib/python3.8/site-packages/werkzeug/local.py", line 316, in __get__
obj = instance._get_current_object() # type: ignore[misc]
File "/var/www/superset/lib/python3.8/site-packages/werkzeug/local.py", line 513, in _get_current_>
raise RuntimeError(unbound_message) from None
RuntimeError: Working outside of application context.
This typically means that you attempted to use functionality that needed
the current application. To solve this, set up an application context
with app.app_context(). See the documentation for more information.
请帮忙,谢谢
问题在
superset.wsgi
上。
根据文档,要调用的正确方法是create_app()
。然后 wsgi 文件应该是下面的。
from superset.app import create_app
application = create_app()