I am trying to build a Python Flask application, but I cannot access it. Flask recognizes the request, but for some reason doesn’t execute the function. Here is my code: I am currently running it by typing flask run the Windows CMD. The GET request is detected, but main_page is not called and 404 is returned. 127.0.0.1 – – [01/Apr/2022
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
Ηow to select a dataframe index via a dropdown menu in Flask?
Context and what I want to do : Hi, here is an example with the iris dataset. I have imported my machine learning model, and my web-app idea is : that instead of entering floating values of features in fields myself to run an iris class estimation, I want to use instead the index of the dataframe in a dropdown
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
flask: redirecting a user to a particular section of the html page
My problem is the following: i have a simple web app that requires a user to upload a file, submitting a POST request to the flask server. If the file does not match the the requirements set by the application, the user is redirected to the same html page containing a form, and a message warning the user of their
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
How to access Flask test server from the outside of local network? [duplicate]
This question already has answers here: Configure Flask dev server to be visible across the network (17 answers) Closed 3 months ago. I am doing experiments with requests trough proxy for web-scraping project. In order to test requests headers and content i’ve build a simple flask server like this: Which is run perfectly fine if access through localhost by 127.0.0.1:5000