main.py 633 B

123456789101112131415161718192021222324252627
  1. from flask import render_template, jsonify
  2. from app import app
  3. import random
  4. @app.route('/')
  5. @app.route('/index')
  6. def index():
  7. return render_template('index.html', title='Home')
  8. @app.route('/map')
  9. def map():
  10. return render_template('map.html', title='Map')
  11. @app.route('/map/refresh', methods=['POST'])
  12. def map_refresh():
  13. points = [(random.uniform(48.8434100, 48.8634100),
  14. random.uniform(2.3388000, 2.3588000))
  15. for _ in range(random.randint(2, 9))]
  16. return jsonify({'points': points})
  17. @app.route('/contact')
  18. def contact():
  19. return render_template('contact.html', title='Contact')