Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8271523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:52:18+00:00 2026-06-08T06:52:18+00:00

I have a list of folders in my python file, and in an HTML

  • 0

I have a list of folders in my python file, and in an HTML file I iterate over the list to display the names of each folder on my page.

{% for folder in folders %}
<li><a href = {{folder}}> {{folder}}</a></li>
{% endfor %}

What I am trying to do is make it so when you click on the folder, it will do the same thing, but inside the clicked folder. I have a function open_folder that takes one parameter (the clicked folder name), but my problem is that I don’t really know how to call the function with a parameter in the HTML file. A lot of pages or tutorials I have seen only have the python files. In my main file I also have the route as

/<route>/

I am new to Flask and was just wondering if anybody had examples for how to do this. It would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T06:52:21+00:00Added an answer on June 8, 2026 at 6:52 am

    With the assumption that folder is something whose contents you’d want to return dynamically as its own page, the appropriate way to do this would be to have a separate route and view that handles folders. Something like the following:

    @app.route("/folder/<folder_name>/")
    def folder(folder_name):
        # do something with folder_name
        pass
    

    And in your HTML you would link to it as follows:

    <a href="{% url_for('folder', folder_name=folder) %}">{{ folder }}</a>
    

    Obviously you’d want to update the route accordingly, depending on the contents of folder, but that’s the “Flask way” of linking to dynamic content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of folders. Each folder names for example: pippo1 containing the
I have a table containing a list of folders, each folder has an ID
I created a list in Python: mylist=os.listdir(/User/Me/Folder) now I have a list of files
I have a list of folders that has those names variations: (there are around
I have a txt file where I list some folders I want to remove
i have a list box and i want to add a folder/directory to that
i want to have an alias t to enter a folder and list the
I have list of articles on the page in table and i want to
i have list of images and on mouse over there is option box shows
Problems to get permissions of each file in every folder to find files which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.