calebthewood / flask-warbler

0 stars 0 forks source link

DRY Up the URLs #5

Open calebthewood opened 2 years ago

calebthewood commented 2 years ago

Throughout the app, there are many, many places where URLs for the app are hardcoded throughout – consider the number of places that refer to URLs like /users/[user-id].

Flask has a nice feature, url_for(), which can produce the correct URL when given a view function name. This allows you to not use the URLs directly in other routes/templates, and makes it easier in the future if you even needed to move URLs around (say, is /users/[user-id] needed to change to /users/detail/[user-id].

Learn about this feature and use it throughout the site.