whether to use Flask-Navigation

364 views Asked by At

I've implemented navigation in a small flask powered website like this and it seems to do the job:

<!-- Navigation (Stays on Top) -->
<div class="w3-top w3-bar w3-black">
<a href="page1" class="w3-bar-item w3-button">Home</a>
<a href="page2" class="w3-bar-item w3-button">Page 2</a>
<a href="Page3" class="w3-bar-item w3-button">Page 3</a>
</div> 

Inside views.py for Page 2 is :

@imprint.route("/page2")
def page2_view():
    return render_template("page2.html")

and homologous for the other pages.

Is there any security risk or other issue with this, why would one instead use the package - https://flask-navigation.readthedocs.io/en/latest/

1

There are 1 answers

0
Undesirable On BEST ANSWER

I don't see any issues with your approach. As Froggo has pointed out, this might cause a small amount of lag as you are rendering the template for each request, but other than that, it should be fine.

As for the Flask-Navigation package, one of the reasons why people are inclined to use it as it provides a level of convenience for making navigation bars. But looking more closely at the repository, it seems that development has been halted (the last recorded commit was around 7 years ago at the time of writing).

If you do want to use a dedicated navigation package, then Flask-Nav seems to be a good contender, but just as the Flask-Navigation package, this package is also not actively maintained. However, this package is being actively used (according to GitHub), and the community has a workaround to get this package to work with the latest version of Python (3.10.x).

I hope this research helps you.