Questions tagged [flask]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
5
votes
1answer
35k views

How to get a value using flask, from a selected option in a drop down list?

I have the following code for my form in HTML: <div class="container-fluid" id="feedback"> <p><h2>Give us your feedback on the cafe!</h2> <h4><em>...
5
votes
1answer
4k views

cs50 finance / pset-7 confused on index() table

I am trying to work on pset7, but am having a problem printing it out to the screen in the table format. I have all the values I need (the values I have are correct), but just can't figure out how to ...
3
votes
3answers
7k views

Instance of 'scoped_session' has no 'commit' member

I'm working on the project1 from cs50web course. Getting the following problem using flask and SQLAlchemy: "Instance of 'scoped_session' has no 'execute' memberpylint(no-member)". I use Ubuntu 18....
2
votes
1answer
402 views

IndexError in initial state of pset6 Sentiments

I am working on Pset 6, Sentiments and followed the steps to create my app on twitter. I added keys, installed requirements.txt and did everything in order, but when I type "flask run" and visit the ...
2
votes
2answers
616 views

Using jinja to render template based on previous url - pset7 finance

For the finance website homepage, I want to render index.html differently based on the previous url. For example, if I logged in I want to render a panel saying 'logged in', but if I registered I want ...
2
votes
2answers
1k views

Web CS50 Project 1: 'flask.cli.NoAppException' flask app with sqlalchemy

I have been banging my head against the wall trying to get this Flask web app running , which is really frustrating because it is only a preliminary to make sure all the modules and such are working ...
2
votes
1answer
1k views

Flask Sessions Not Working

I'm using VS Code and following along Brian's Flask class in Web50. I have copied his notes program word for word, and somehow I get different results. I've downloaded Flask and Sessions, so that's ...
1
vote
1answer
5k views

Pset7, Index: How to use loops in Python and Jinja?

I felt like I could understand the for loops great in c, but seem to be hitting a wall here. Some generic conceptual questions before i get into it: 1) ANSWERED. what sequence does the program run, ...
1
vote
2answers
135 views

What is a web server?

MDN states that a web server is a computer hosting one or more websites. However, in the CS50 lecture on Flask, at 41:37, Brian mentioned that the Flask class was imported from the flask module to ...
1
vote
1answer
415 views

How to pre-populate sell() and buy() forms from index - Pset7

I'd like to allow users to buy and sell shares they already own from the index page. I've created a button for this on the index, and I simply want to send the user to the /buy.html or /sell.html page ...
1
vote
1answer
695 views

expected 400 but got 200 OK?

I have implemented Pset-7 (Finance) but check50 shows an error called expected 400 but got 200 in all my apology pages and it is being rejected by check50. Since it successfuly landed to apology page, ...
1
vote
1answer
168 views

C$50 PSET7 Flask blank form question

I am attempting to implement quote, buy and sell on the same page, called trade. I believe it would be a more user friendly way of doing things and good experience. However, I am having trouble ...
1
vote
2answers
1k views

Finance: UNIQUE constraint failed: users.username

I've been struggling with this for days. Ignore the '1234' hardcoded into the "insert into" line, just using that to isolate problems. The problem I'm facing is with the username being ...
1
vote
1answer
604 views

Having Issues Setting up Flask Server in Project 1

I am having trouble setting up my flask application in Project 1. Here is some additional screenshots of the error messages I get in browser when running flask. Here is some additional info: Running ...
1
vote
1answer
473 views

Pset 7 - Finance: Clicking Register creates: AttributeError: 'ValueError'

I've been trying to get my register page to work for a couple days now. I think I'm close , but now I'm receiving the following error message in my terminal when I try to click register from the login ...
1
vote
0answers
1k views

Serve pure html files without jinja in flask

As I am making my final project I get stuck at some points where I don't wish to use jinja as I wish to have my html file as a whole without extending any layout html file. In flask render_template ...
1
vote
0answers
58 views

NoAppException in PSET8: Mashup

I am unable to start working on PSET8 Mashup, when I view the web page after running flask I get what appears here: Although I am running flask in the directory of mashup. So I don't know why it can'...
0
votes
1answer
2k views

Runtime Error: API_KEY not set

In Pset8, I continue to get the "API_KEY" not set runtime error, even though i crosschecked with: echo $API_KEY and the response was: AIzaSyDKcW1m49qo95kiJFTpGWTUrj3Iyi-xloA which matched the key ...
0
votes
1answer
486 views

jsonify not working when I add this line of code <<db = SQL("sqlite:///mashup.db")>> to application.py

I am trying to return a JSON on a certain URL in python application. Without this line db = SQL("sqlite:///mashup.db") everything works. The JSON is returned correctly. If I uncomment that line, ...
0
votes
2answers
19 views

Is there a way in jinja to display a block in a specific page?

I have a layout.html page with a <footer> that I want to display in almost all pages using {% extends "layout.html %}. Only in the user profile page the footer will be different. How can I ...
0
votes
2answers
1k views

How do I turn debug mode ON in flask?

I have tried export FLASK_ENV=development then adding app.config['DEBUG'] = True to my program but i keep getting * Serving Flask app "test.py" (lazy loading) * Environment: development * ...
0
votes
1answer
403 views

"flask run" error in pset6 sentiments

When I press "flask run" command I am getting the following error ~/workspace/2017/flask/ $ flask run * Serving Flask app "application" * Forcing debug mode on Traceback (most recent call last): ...
0
votes
1answer
15 views

Flask/Python PSET9 Finance -- Using PRINT() to debug

Having some problems with INDEX that I figure printing variable content to console will help me solve. BUT no matter what I try, print(variable) doesn't result in anything at all on the console/...
0
votes
1answer
29 views

Lab9 -- Buttons to delete DB entries don't work

Can anyone please tell me why my "Remove Entry" from DB buttons don't work? I included the python.app code below the HTML: <!DOCTYPE html> <html lang="en"> ...
0
votes
1answer
22 views

Should I deploy flask app for the final project?

I’m working on a final project, which is a web application using Flask. For it to be graded, should I deploy it on Heroku or only submit my source files. I’m not familiar with Heroku, and from what I ...
0
votes
1answer
78 views

Flask Filter Search/List in Python

I created a country list on the python search page section, the data is sent to the Html table with jinja syntax “ The Html table also has a JavaScript function it functions correctly no help with ...
0
votes
1answer
45 views

PSET9 / can't check until a frown turns upside down

I am getting this message in the following checks :| sell page has all required elements/ :| sell handles invalid number of shares :| sell handles valid sale I guess the problem is in by sell or buy ...
0
votes
1answer
34 views

Check if query returns empty value

I am trying to check using (IF / ELSE) if my query returns any value. What is the simplest way to do this? Thanks result = db.execute("SELECT * FROM home WHERE id = ? AND name = ?", str(conn)...
0
votes
1answer
62 views

Runtime Error Unsupported Value in pset9 Finance

I'm doing Pset09 "Finance" and I have been stuck in the "index" function for quite a while. I tried to use the already existing "trans" table but I am getting an error. ...
0
votes
1answer
65 views

pset9 // register function not registering user

I am having this problem with my register function in pset9 when i register on the web app it says error 500 internal server error and when i check my terminal it says: return self.view_functions[rule....
0
votes
2answers
328 views

CS50 IDE gives error for flask run

I was able to run flask run till yesterday. But today it is not working, it has been giving errors for SQL and I have been able to code today. It gives me this error continuously. ERROR: Error on ...
0
votes
1answer
87 views

Blocked on C$50 Finance suggested personal touch feature - adapting index page to enable transactions in situ

Dug into the docs and trawled all the usual online sources but starting to suspect that I'm trying to solve this in a way that's impossible! This is how I've edited the index page to allow user input ...
0
votes
1answer
49 views

Final Project: Problem to UPDATE table (Flask and SQLite) - RuntimeError ("unsupported value: {}".format(value))

I'm working on a project tracking web app, in which users can create and categorise their own projects. There are more options, but a project can mainly be categorised as active or paid/finished. Any ...
0
votes
1answer
67 views

Internal Error Served if user doesn't own any shares or sell all his shares in Finance

When i sell all the shares i own or even in the case of a new registered user who doesn't own any shares; it doesn't redirect to "/" i.e the main index page but serves me an internal error. It works ...
0
votes
1answer
337 views

Can't access 127.0.0.1 and 0.0.0.0 in CS50 IDE

I am on my final project and i have a simple flask app and and index html template. There are no errors in my app, however when i run flask, flask run, it says Running on http://127.0.0.1:5000/ (Press ...
0
votes
1answer
313 views

flask register, issue with importing cs50 module

Im trying to run a flask app locally with also using the cs50 module but i keep getting an error: NoAppException: While importing "application", an ImportError was raised: Traceback (most recent ...
0
votes
1answer
142 views

PSET 6 [Similarities - less] How is the compare file accessed in this problem since it is not imported to application.py

(Dont be intimidated by length of code chunks, I included all of my guess as to what's going on, so most of it is just stuff to skim over) The folder similarities contains static and template folders ...
0
votes
1answer
67 views

Should my distances function return the matrix in PSET6?

I'm working on the 'more comfortable' version of Similarities in PSET6. When I execute ./score wordone wordtwo, the IDE responds: 'Could not read wordone'. I initially thought the issue was my web ...
0
votes
1answer
124 views

PSET 7 - Finance - application.py

I was wondering if somehow could help me understand the following snippet of code from the pset distribution code: # Ensure responses aren't cached @app.after_request def after_request(response): ...
0
votes
1answer
568 views

Pset7 - Finance (register function) - creating internal server error

I've been trying to figure out the register function for some time now, but I just can't get it to work. I'm also receiving an invalid syntax error for the last line of the function: return redirect(...
0
votes
1answer
550 views

Check50 returning error pset7 register

I get this error in register in pset7/finance when I run check50: :) application.py exists :) application starts up :) register page has all required elements :( registering user succeeds expected ...
0
votes
1answer
95 views

Problem with flask

I install the socketio module with: pip install flask-socketio. After the installation I cannot run: flask run to enable the application. Is there any way to fix this because I want to use socketio ...
0
votes
1answer
159 views

Where is session file and where is company's name in csv file?

I have spent three days on learning the code in pset7 but i still have few questions. 1) In here: # configure session to use filesystem (instead of signed cookies) app.config["SESSION_FILE_DIR"] = ...
0
votes
1answer
1k views

What is next parameter in the url_for function?

redirect(url_for("login", next=request.url)) What is "next" in the url_for function? And where is the documentation about this function?
0
votes
1answer
96 views

What is cache and how could you stop it?

In pset7 code in application.py there is this snippet of code: if app.config["DEBUG"]: @app.after_request def after_request(response): help(response.headers) response.headers["...
0
votes
1answer
107 views

db.execute() executing only single time

When I enter amount, name, expinc in my html form it works for the first time, i.e. the entered data goes into database tables for the first time but whenever I try to enter data again it doesn't ...
0
votes
1answer
1k views

Help needed for CS50 IDE flask server

Please help as I have landed into a trouble with my flask server for pset8/mashup. Per the spec within mashup/ I execute pip install --user -r requirements.txt and then in a terminal window I execute ...
0
votes
1answer
442 views

PSET7 C$50 Flask flashing message categories

I'm in the early stages of pset7. On register, I'm looking to implement flashing messages instead of having the apology redirects, since they look and act more userfriendly. I understand that flash ...
0
votes
1answer
137 views

Pset7, Index, why does it not show other stocks i own?

I'm trying to get all stocks to just show up on my index screen, but can't seem to get my head around the jinja template + Python + SQL commands. Can someone tell me why is it that only my last ...
0
votes
1answer
663 views

Pset 7, why does session["user_id"] not take a variable?

I am able to solve the "register" part of the question by doing this: session["user_id"] = db.execute("SELECT * FROM users WHERE username = :username", username=request.form.get("username"))[0]["id"]...