Flask: Difference between revisions

From Network Security Wiki
Content added Content deleted
No edit summary
No edit summary
Line 18: Line 18:
http://127.0.0.1:5000/
http://127.0.0.1:5000/


Enable Debugging & access URL over network:
Enable Debugging:
app.run(debug = True, host= '0.0.0.0')
app.debug = True

Access URL over network with custom port:
app.run(host = '0.0.0.0',port=5005)

Revision as of 15:15, 13 June 2018

Installation:

pip3 install flask

Hello World:

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
   return 'Hello World’

if __name__ == '__main__':
   app.run()

Access the above app from:

http://127.0.0.1:5000/

Enable Debugging:

app.debug = True

Access URL over network with custom port:

app.run(host = '0.0.0.0',port=5005)