from flask import render_template, jsonify
from app import app
import random



@app.route('/')
@app.route('/index')
def index():
    # Feature flags init goes here!

    #

    # noinspection PyDictCreation
    flags = {
        "welcome_text": "welcome to my python FF tutorial!"
    }
    # Flag goes here!
    
    #

    flags["alternate_homescreen"] = False
    return render_template(
        'index.html',
        **flags,
        title='Home'
    )


@app.route('/map')
def map():
    return render_template('map.html', title='Map')


@app.route('/map/refresh', methods=['POST'])
def map_refresh():
    points = [(random.uniform(48.8434100, 48.8634100),
               random.uniform(2.3388000, 2.3588000))
              for _ in range(random.randint(2, 9))]
    return jsonify({'points': points})


@app.route('/contact')
def contact():
    return render_template('contact.html', title='Contact')

[(7, 'app.app.route', 'app.route', (['"""/"""'], {}), False, 'from app import app\n'), (8, 'app.app.route', 'app.route', (['"""/index"""'], {}), False, 'from app import app\n'), (30, 'app.app.route', 'app.route', (['"""/map"""'], {}), False, 'from app import app\n'), (35, 'app.app.route', 'app.route', (['"""/map/refresh"""'], {'methods': "['POST']"}), False, 'from app import app\n'), (43, 'app.app.route', 'app.route', (['"""/contact"""'], {}), False, 'from app import app\n'), (23, 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': '"""Home"""'}), False, 'from flask import render_template, jsonify\n'), (32, 'flask.render_template', 'render_template', (['"""map.html"""'], {'title': '"""Map"""'}), False, 'from flask import render_template, jsonify\n'), (40, 'flask.jsonify', 'jsonify', (["{'points': points}"], {}), False, 'from flask import render_template, jsonify\n'), (45, 'flask.render_template', 'render_template', (['"""contact.html"""'], {'title': '"""Contact"""'}), False, 'from flask import render_template, jsonify\n'), (37, 'random.uniform', 'random.uniform', (['(48.84341)', '(48.86341)'], {}), False, 'import random\n'), (38, 'random.uniform', 'random.uniform', (['(2.3388)', '(2.3588)'], {}), False, 'import random\n'), (39, 'random.randint', 'random.randint', (['(2)', '(9)'], {}), False, 'import random\n')]