forked from digitalocean/sample-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.py
22 lines (18 loc) · 782 Bytes
/
server.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask
# Create an instance of the Flask class that is the WSGI application.
# The first argument is the name of the application module or package,
# typically __name__ when using a single module.
app = Flask(__name__)
# Flask route decorators map / and /hello to the hello function.
# To add other resources, create functions that generate the page contents
# and add decorators to define the appropriate resource locators for them.
@app.route('/')
@app.route('/hello')
def hello():
# Render the page
return "Hello Python! Sample Python Waitress brings flask so its working"
if __name__ == '__main__':
from waitress import serve
serve(app, host="0.0.0.0", port=8080)
# Run the app server on localhost:4449
# app.run('localhost', 4449)