Code Monkey home page Code Monkey logo

hello_flask_app's Introduction

This is a Simple Python Code that prints Hello World using Flask framework

#Setup Environment #Install Git #Install python tools & nginx(Optional)

$ sudo yum update $ sudo yum install python3 (If not installed already) $ sudo yum install python-pip3

Install virtualenv from pip so that the python packages for the flask app will be in isolation.

$ sudo pip3 install virtualenv

Create the project & setup the virtual environment.

Create Project

$ cd Hello_Flask_App

Create virtualenv

$ virtualenv venv

Activate virtualenv

$ source ./venv/bin/activate

Now the prompt should look like: (venv)user@host:~/Hello_Flask_App$

Creating a Flask App: app.py

Install the dependencies under your virtualenv

(venv)user@host:~/Hello_Flask_App$ pip3 install gunicorn flask

Test your flask app:

(venv)user@host:~/Hello_Flask_App$ python app.py

Go to your browser and enter the url to your server, appending the port number you specified in app.py. You should see Hello World! displayed

##############################################################################################################################################

Binding with Gunicorn

Create the WSGI entrypoint ~/Hello_Flask_App/wsgi.py.

Run app.py

(venv)user@host:~/Hello_Flask_App$ gunicorn --bind 0.0.0.0:8080 wsgi:app

#Note: If you didn't name your app as application, for example as app, use wsgi:app instead of wsgi, since application is the name to be picked up by default.

Go to your browser again and read the Hello World! response

###############################################################

To perform Test on the app.py using test_app.py

$python test_app.py

The above will not return anything of success

hello_flask_app's People

Contributors

chia5 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.