×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
1
Language: Python
Posted by: alphaharris
Added: Sep 25, 2018 8:18 PM
Views: 3471
  1. # Simple flask server
  2.  
  3. from flask import Flask
  4.  
  5. app = Flask("test_name")
  6.  
  7.  
  8. # what kind of reqests should it understand?
  9.  
  10. # use a decorator to define one type of request and endpoint
  11. @app.route('/')  # the endpoint for this request, like http://www.google.com/
  12. def home():
  13.     return 'Hello, world! ' + app.name
  14.  
  15.  
  16. # run the app, passing a port
  17. app.run(port=5000)