I am trying to figure out how to deploy an instance of Apache Superset as a web app on Pythonanywhere using uWSGI+nginx.
I have installed started a virtual environment on Pythonanywhere and installed and setup Superset following the instructions on the website. Starting a Superset server on Pythonanywhere seems to work, however I can't find any documentation on how to use Superset together with flask, such that the Superset can be used with uWSGI+nginx as is supported by xxx.pythonanywhere.com.
The wsgi file is simple:
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
From what I can understand, on PythonAnywhere the WSGI side of things is managed by a file per domain in /var/www/you_domain_wsgi.py. It needs to define a variable called application, which is the same as the app in your init.py., but I fail to see how any sort of Flask app is deployed when running superset runserver
. In their documentation, they simply state "Please refer to the documentation of your preferred technology to set up this Flask WSGI application in a way that works well in your environment.".
in /superset/bin/
there is a file called flask
which contains
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())
But I can't really find anything that could remotely look like a Flask wrapper for Superset.
Is there something fundamental I've misunderstood?
giles from Pythonanywhere suggested this simple solution:
import superset from superset import app as application
which worked instantly. E.g. the whole flask file looks like
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
where only the last line is necessary for superset to run.