Documentation: Flask quickstart
Launch the minimalistic Flask application and test it by making a request to it both from a browser (http://localhost:5000).
Create a flask application that can look up location names based on the post code. Store the locations in a dictionary, e.g.,
postcodes = {
"0001": "Oslo",
"4036": "Stavanger",
"4041": "Hafrsfjord",
"7491": "Trondheim",
"9019": "Tromsø"
}
If the user goes to the index page, return the text "Postcode lookup service. Example usage: /postcode/4041", where the example link should be generated automatically (using url_for()
) and should be a link (<a href>...</a>
)
If the post code exists, return the text "Post code {postcode} is {city}"