Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to link a website to html page in flask?

I am trying to include my GitHub page in the html file using anchor tag.
But the jinja library of flask isn’t allowing : which is a part of url.
Is there a way to use anchor tags that reflects external existing websites?

My code is as follows:

<a id="bot" target="_blank" href="{{url_for(https://github.com/<user_name>)}}">

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks in advance

>Solution :

url_for is for generating a URL to an end point within your Flask application.

For external URLs, just use the URL. It doesn’t need calculating since external URLs are fixed (at least generally, if you need to link to different external URLs from your development/staging/production environments then you’ll need logic to handle that, but not url_for).

href="https://github.com/example">
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading