Advertisement
teslariu

webserver

Nov 3rd, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. from flask import Flask, jsonify, request
  5.  
  6. app = Flask(__name__)
  7.  
  8. """
  9. alumnos = [
  10.         {'id':1, 'nombre':'Ale', 'cursos':5},
  11.         {'id':2, 'nombre':'Ana', 'cursos':1},
  12.         {'id':3, 'nombre':'Luisa', 'cursos':2},
  13.         {'id':4, 'nombre':'Juana', 'cursos':3},
  14.     ]
  15. """
  16. alumnos = []
  17.  
  18. @app.route("/")
  19. def home():
  20.     return "En el home"
  21.  
  22. @app.route("/index")
  23. def index():
  24.     return "JAJAJA oops... no hay nada"
  25.    
  26. if __name__ == "__main__":
  27.     app.run(debug = True)
  28.    
  29. # LINUX
  30. # export FLASK_APP=webserver.py
  31. # flask run
  32.  
  33. # WINDOWS
  34. # set FLASK_APP=webserver.py
  35. # python -m flask run
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement