Skip to content

Magenaut

  • Home
  • Topics
    • Notes
    • Tutorial
    • Bug fixing
    • Extension
    • Server
  • Q&A
  • Privacy Policy
  • About

flask

Handling multiple requests in Flask

August 16, 2022 by Magenaut

My Flask applications has to do quite a large calculation to fetch a certain page. While Flask is doing that function, another user cannot access the website, because Flask is busy with the large calculation.

Categories Python, Q&A Tags flask, python Leave a comment

Trailing slash triggers 404 in Flask path rule

August 16, 2022 by Magenaut

I want to redirect any path under /users to a static app. The following view should capture these paths and serve the appropriate file (it just prints the path for this example). This works for /users, /users/604511, and /users/604511/action. Why does the path /users/ cause a 404 error?

Categories Python, Q&A Tags flask, python Leave a comment

Execute a function after Flask returns response

August 16, 2022 by Magenaut

I have some code that needs to execute after Flask returns a response. I don’t think it’s complex enough to set up a task queue like Celery for it. The key requirement is that Flask must return the response to the client before running this function. It can’t wait for the function to execute.

Categories Python, Q&A Tags flask, multithreading, python Leave a comment

ImportError: No Module Named bs4 (BeautifulSoup)

August 16, 2022 by Magenaut

I’m working in Python and using Flask. When I run my main Python file on my computer, it works perfectly, but when I activate venv and run the Flask Python file in the terminal, it says that my main Python file has “No Module Named bs4.” Any comments or advice is greatly appreciated.

Categories Python, Q&A Tags beautifulsoup, flask, importerror, python Leave a comment

How to schedule a function to run every hour on Flask?

August 16, 2022 by Magenaut

I have a Flask web hosting with no access to cron command.

Categories Python, Q&A Tags asynchronous, cron, flask, python, scheduled-tasks Leave a comment

Pass JavaScript variable to Flask url_for

August 16, 2022 by Magenaut

I have an endpoint that takes a value in the url and produces some content that will be inserted into a div. I want to build the url with url_for using a JavaScript variable. However, $variable1 is passed as a string, rather than the value of variable1. How can I pass the value of a JavaScript variable to url_for?

Categories Python, Q&A Tags flask, javascript, jinja2, python Leave a comment

Uploading multiple files with Flask

August 16, 2022 by Magenaut

Is there a way to receive multiple uploaded files with Flask? I’ve tried the following:

Categories Python, Q&A Tags file-upload, flask, python Leave a comment

redirect while passing arguments

August 16, 2022 by Magenaut

In flask, I can do this:

Categories Python, Q&A Tags flask, python Leave a comment

Get list of all routes defined in the Flask app

August 16, 2022 by Magenaut

I have a complex Flask-based web app. There are lots of separate files with view functions. Their URLs are defined with the @app.route('/...') decorator. Is there a way to get a list of all the routes that have been declared throughout my app? Perhaps there is some method I can call on the app object?

Categories Python, Q&A Tags flask, python Leave a comment

What is an ‘endpoint’ in Flask?

August 15, 2022 by Magenaut

The Flask documentation shows:

Categories Python, Q&A Tags flask, python Leave a comment
Older posts
Newer posts
← Previous Page1 … Page7 Page8 Page9 … Page13 Next →
  1. michealSmith07 on Is there a way to dynamically refresh the less command?August 21, 2022

    That is a very nice post. I like this post.

  2. anonymous on Fix libwacom9 dependency issue when upgrade DebianJune 27, 2022

    saved my day!! Thanks for the help…

  3. sreedhar on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    Thanks its working

  4. saintnick on Fix libwacom9 dependency issue when upgrade DebianMay 10, 2022

    remove libwacom2 worked for me as well

  5. ranafoul on Fix libwacom9 dependency issue when upgrade DebianApril 22, 2022

    apt remove libwacom2 helped on kali 2022.01. gr8

.net ajax asp.net asp.net-core asp.net-mvc asp.net-mvc-3 asp.net-mvc-4 asp.net-web-api bash c# command-line css custom-post-types custom-taxonomy dataframe dictionary django entity-framework functions gridview html iis javascript jquery json linux list matplotlib numpy pandas php plugin-development plugins posts python python-2.7 python-3.x security shell shell-script sql string vb.net webforms wp-query

© 2026 Magenaut • Built with GeneratePress