Skip to content
Advertisement

Tag: flask

How to pass a dictionary to ChartJS?

I’m trying to pass a dictionary from my Flask file to my ChartJS but the data doesn’t load on my chart. I think there’s a problem on passing my data. Here is the format of my dictionary. Basically, it’s a time series dataframe I converted as dict. Here is my flask file: Here is my HTML file Answer I solved

No data available in table | Flask/Python/Sqlite

I am trying to use a simple app to display database information using Python, Flask and SQLite. I have three files server_table.html, server_table.py and base.html. My SQLite database testdb.db is constructed successfully and I am able to pull/push data to it. The columns and data type are correct for the database model. However, when I run server_table.py, the webpage renders

SQLAlchemy changes value after commit

Seemingly out of nowhere, my Flask app is now inserting the same value for one column in a table in my database no matter what when it had been previously working. I have a model here: and code in my application: The result of the prints is So it looks like after the record is committed, the number changes and

Validation of WTForms in Flask using Postman

I am trying to Create a user using WTForms. But always I am getting validation error when checked using POSTMAN. I am not sure why this happens routes.py forms.py models.py Postman screen shot what can be the reason for validation always failing in this case. Thanks in advance Answer For this to work from POSTMAN, set the config

I don’t know why while sending the variable to HTML it is showing UnboundLocalError. I tried similar Stackoverflow solution but it didn’t solve

I don’t know why while sending the variable to HTML it is showing UnboundLocalError: local variable ‘prdct’ referenced before assignment. When I don’t pass any values from render_template() method then the code is running fine. Also the output that I’m printing using print(prdct) is also working fine. Following is my code: Answer Your code does not create prdct in all

Is there a way to parse a file through to a tag in HTML

I’m trying to make a private file host and I have it set to return a send_file() when the, for example, /media/someSong.mp3 url is called. But I want to make it more styled so when you visit /media/someSong.mp3, instead of your browser trying to play that MP3 in it, it will use a HTML page with a tag that parses

Advertisement