All Questions
25 questions
1
vote
2
answers
2k
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
1
answer
129
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
1
answer
229
views
please help ! till yesterday my app was working almost fine but today its not even starting ! can someone pls explain this to me?
flask.cli.NoAppException: Failed to find application in module "application". Are you sure it contains a Flask application? Maybe you wrapped it in a WSGI middleware or you are using a factory ...
1
vote
1
answer
487
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 ...
0
votes
1
answer
601
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
1
answer
661
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 ...
1
vote
1
answer
1k
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, ...
0
votes
1
answer
513
views
Pset7 Finance, Sell problem with POST requests
My problem is that I'm not getting any value back from my select form. I pass a list of stocks to the jinja template via return render_template("sell.html", stocks=stocks) and on the sell.html page I ...
0
votes
1
answer
233
views
[pset7][Finance-SELL] bootsrap select list to accept symbol(from jinja2 Template) and pass it on to the flask
I was able to create a select list using bootstrap for my 'sell.html':
<div class="form-group">
<select class="form-control","input-group" id="sel1" autocomplete="off" autofocus name="...
0
votes
1
answer
178
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
1
answer
99
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
2
answers
133
views
pset 7 [buy] Unable to render user's cash
I've spent a lot of time trying to solve this problem and can't seem to find were I went wrong. Any help is greatly appreciated.
I am unable to render the user's cash balance on the index.
def ...
1
vote
1
answer
434
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
1
answer
186
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 ...
0
votes
1
answer
514
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 ...
1
vote
1
answer
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, ...
0
votes
1
answer
138
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
1
answer
52
views
Pset 7: Passing basic values between from python to HTML print
I've been trying to pass in some very basic python values into HTML placeholders {{ }}, which ZYMAYLA has mentioned here. I'm doing what she has mentioned but there it doesn't go through, even for ...
0
votes
1
answer
743
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"]...
2
votes
2
answers
819
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 ...
0
votes
1
answer
171
views
Rectify implementation of register function in pset7 - finance (Flask)
def register():
"""Register user."""
if request.method == "POST":
if not request.form.get("username"):
return apology("must provide username")
elif not request....
0
votes
1
answer
589
views
Pset7 'No application seems to be running here'
I've been on and off, coding away at CS50 projects for some years now and I was really excited seeing the course moving away from PHP and into the elegant Python. Now, I want to recreate C$50 Finance ...
0
votes
1
answer
84
views
PSet 7: Issues with flask table output - hint needed
I am trying to produce table headings using loop in flash but I get new lines after each:
{% extends "layout.html" %}
{% block title %}
Portfolio overview
{% endblock %}
{% block main %}
{% ...
5
votes
1
answer
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 ...
0
votes
1
answer
103
views
pset7: CS50 Finance, ide and flask say syntax is incorrect what am I doing wrong that I don't see?
In the "buy" function of applications.py, no matter what I type, the CS50 IDE and flask both say I have a syntax error in my program. I don't see it and have tried removing parts, checked the syntax ...