ML Entrepreneurship - Introduction

Examples

A Simple Hello World Example on PythonAnywhere

In [3]:
from IPython.display import Image
Image(filename="img/python-anywhere-logo.png")
Out[3]:

Let's do the same thing on PythonAnywhere. As mentioned before, this is a real cool hosting platform where you can do a lot of your testing in the cloud for free.

It is also really easy to create a 'Hello World' web application as it is built into the wizards we will use to get started. So, go ahead and sign up for an account.

Sign up for a free account on PythonAnywhere.com and log into it (you will have to confirm your email address).

Setting Up Flask Web Framework

Let's create a web server on PythonAnywhere with the Flask web-serving platform. It is super easy to do. Under the 'Web' tab, click the 'Add a new web app' blue button. And accept the defaults until you get to the 'Select a Python Web framework' and click on 'Flask' and then the latest Python framework.

In [4]:
Image(filename="img/python-anywhere-select-framework.png")
Out[4]:

You will get to the landing configuration page, hit the green 'Reload your account.pythonanywhere.com' button and take your new URL for a spin.

In [5]:
Image(filename="img/python-anywhere-reload-and-link.png")
Out[5]:

You should see a simple but real web page with the 'Hello from Flask!' message right out of the box

In [6]:
Image(filename="img/python-anywhere-live-web-app.png")
Out[6]:

There it is, a real Flask web application running on the Internet! For more examples, see the PythonAnywhere help docs and step-by-step guides at:

https://help.pythonanywhere.com/pages/