Getting Started with Flask on Cloud9

Monday, Sep 8, 2014 14:15 · 214 words · 2 minutes read

What is Flask?

Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions.

What is Cloud9?

“Cloud9” in Wikipedia: Cloud9 provides an open source integrated development environment in the cloud. It supports more than 40 languages, with class A support for PHP, Ruby, Python, JavaScript/Node.js, and Go. It enables developers to get started with coding immediately with pre-setup environments (workspaces), collaborate with their peers with collaborative coding features, and web development features like live preview and browser compatibility testing available from http://en.wikipedia.org/wiki/Cloud9_IDE

The online documentation of Cloud9 is very rich and helpful. The following help section explains how to get started with the online IDE.

How to install Flask on Cloud9?

The Cloud9 IDE provides developers with a bash terminal, which can be used to install Python packages. To install the Flask package the easy_install python module should be used:

sudo easy_install Flask

Hello World Flask Application

Create an app.py file within your Python application and enter the following code snippet:

Press F5 or click on the Run button to start your Flask application.

Your code is running at https://your-workspace-and-username-goeshere.c9.io.

Important: use os.getenv(PORT, 8080) as the port and os.getenv(IP, 0.0.0.0) as the host in your scripts!

Running on http://0.0.0.0:8080/

Now you could access your Flask application on the provided url.

comments powered by Disqus

Buy Me A Coffee