Skip to content
Advertisement

Tag: flask

demystify Flask app.secret_key

If app.secret_key isn’t set, Flask will not allow you to set or access the session dictionary. This is all that the flask user guide has to say on the subject. I am very new to web development and I have no idea how/why any security stuff works. I would like to understand what Flask is doing under the hood. Why

PostgreSQL ILIKE query with SQLAlchemy

I’d like to run a query that selects all posts, case insensitive, that have titles that match ‘%’ + [some_phrase] + ‘%’. That is, select all rows that have titles that contain some phrase, case insensitive. From the research I’ve done, it looks like I need to use Postgres’s ILIKE query for it to match case insensitive. How can I

Add a prefix to all Flask routes

I have a prefix that I want to add to every route. Right now I add a constant to the route at every definition. Is there a way to do this automatically? Answer The answer depends on how you are serving this application. Sub-mounted inside of another WSGI container Assuming that you are going to run this application inside of

How to upload a file using an ajax call in flask

Hi I’m quite new to flask and I want to upload a file using an ajax call to the server. As mentioned in the documentation, I added a file upload to the html as folows: and I wrote the ajax handler as this I do not know how to get the uploaded file (not the name) from this and save

How to execute raw SQL in Flask-SQLAlchemy app

How do you execute raw SQL in SQLAlchemy? I have a python web app that runs on flask and interfaces to the database through SQLAlchemy. I need a way to run the raw SQL. The query involves multiple table joins along with Inline views. I’ve tried: But I keep getting gateway errors. Answer Have you tried: or: Note that db.engine.execute()

Playing a wavefile from the html using flask framework?

This is my run.py code This my base.html file this my tasks.html This my s1.html In the s1.html i have a hyperlink to a audio wav file . I want to play the audio file from the s1.html. The wav file is present in the root directory. It is throwing error GET /ps.wav HTTP/1.1″ 404 Please tell how to solve

Advertisement