Hello,
I am new to Python and pythonanywhere. I'm trying to create a simple web app that will update a Tableau datasource via an API. So first, I need to make sure my web app is connecting to Tableau.
I created a pythonanywhere web app with the manual setup using Python 3.6 in a virtual environment. You can see the results at hopemission.pythonanywhere.com.
The Python code that connects to Tableau seems to be working. It gives me a variable called hopemission_info. The end of the code is below. How do I get the variable to show up in the website display?
test = hopemission_info.json()
HELLO_WORLD = """<html>
<body>
<h1>Hello, World!</h1>
<p>
This is the default welcome page.
</p>
</body>
</html>"""
def application(environ, start_response):
if environ.get('PATH_INFO') == '/':
status = '200 OK'
content = HELLO_WORLD
else:
status = '404 NOT FOUND'
content = 'Page not found.'
response_headers = [('Content-Type', 'text/html'), ('Content-Length', str(len(content)))]
start_response(status, response_headers)
yield content.encode('utf8')