Questions tagged [cs50-web-programming-with-python]

Filter by
Sorted by
Tagged with
0
votes
0answers
16 views

how do I perform a search

This is project one for wiki and I am stuck this is my last thing to do. below are screenshots of the views.py, util.py and template. We are suppose to use the functions from util.py(This is the last ...
0
votes
0answers
13 views

I keep getting invalid syntax at else. I am trying to redirect a page

here is the code. I keep getting invalid syntax at else. Can someone explain why and help please.
0
votes
0answers
20 views

I keep getting - TypeError: unhashable typ

can't get page to redirect please help. I keep getting the error TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries":...
0
votes
0answers
16 views

how to save an entry and also add it to an existing list

My code won't work need help. for some reason when I try to save an entry it just refreshes me back to the homepage without adding or saving the new entry I tried to create. what can I do different? ...
0
votes
0answers
66 views

CS50 Web 2020, Project 1 - Wiki, CSS not working

I'm currently using Django as explained in cs50w 2020 lecture 3. Under the static folder inside encyclopedia directory is the styles.css. This was in the distro code and there is already some styles ...
0
votes
1answer
46 views

CS50Web python. I can't get a new entry to save and show on the homepage of my wiki project. I am using Django with python

I can't get my code to save a new entry and return an error message if entry already existed. its just the views.py I can't figure out help please. code below
0
votes
0answers
47 views

CS50W - Wiki w/ Django - Search Bar

I cannot for the life of me get the HTML form to transfer the user's search into my search function within views.py. I've tried this a number of different ways and I either just get no movement (as I ...
0
votes
0answers
15 views

Facing issues while trying to Post HTML form contents to views.py route using fetch method POST in javascript

Hello I am trying to post information i get from a form to an API that submits it to the views.py file in Django. Can anyone tell me where i am going wrong. Below is my javascript code ...
0
votes
0answers
37 views

Help please: I keep getting - TypeError: unhashable type: 'dict'

I keep getting - TypeError: unhashable type: 'dict' at line: return HttpResponseRedirect (reverse("encyclopedia:index", { "entries": util.save_entry(title, content) })) My code is ...
1
vote
0answers
51 views

CS50W - Project 0 - “I'm Feeling Lucky”

For the "I'm Feeling Lucky" part, I'm getting a redirect notice (like this: https://images.app.goo.gl/Mgk6knNBYHfe5YKB7). How do I bypass this? Thank you!
0
votes
1answer
65 views

CS50W - Wiki with Django - I want to edit a wiki entry, but I don't know how to send the default value to the template if I use Django forms

I've tried to do this: class editPage(forms.Form): title = forms.CharField() textContent = forms.CharField(widget=forms.Textarea(attrs={'class' : 'textContent'})) def edit(request,name): ...
0
votes
0answers
64 views

raise JSONDecodeError(“Expecting value”, s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@app.route('/api/<string:isbn>', methods = ['GET']) def isbn(isbn): #import api from Goodreads (stats) book_data = db.execute("SELECT * FROM books WHERE isbn=:isbn",{'isbn':isbn})....
0
votes
0answers
31 views

How do I create an advanced query page using HTML and CSS? Should I use any other langauges to make it a faster process?

How do I create an advanced query in HTML and CSS? I have to create a front end similar to Google and have already outfitted the first two pages, it's the 3rd page, the advanced query page that I need ...
0
votes
0answers
28 views

decoding to str: need a bytes-like object, HttpResponse found

While converting markdown to html i am getting this error def title(request, title): global mdValue mdValue = util.get_entry(title) htmlValue = m.convert(mdValue) # error occurs on this ...
0
votes
1answer
30 views

CS50 Web Programming Mail Pset - DOM reloading on every form submission

On the mail pset the inbox page loads as default whenever the DOM is loaded. Whenever I submit my form to send an email the DOM is reloaded and inbox pops up. I'm trying to get the sent mailbox to pop ...
0
votes
0answers
17 views

Placing django_markdown2 somewhere in my PYTHONPATH

I am going over the documentation for using django-markdown2 in Project1, and I don't know what is the best way to: 'Place django_markdown2 somewhere in your PYTHONPATH.' https://github.com/...
0
votes
0answers
6 views

Does __tablename__ create a new table for each object? And what is .query.all? Is it a method?

I am really confused In CS50'S Web Programming with Python and Javascript-ORMs and APIs. There is weird syntax like class.query.all. What is Its definition (a method, a function, etc).
0
votes
0answers
33 views

CS50W Final Project: I need help with deploying my website

for my final project, i made a website that i want to also deploy to production, because i want to be able to implement it in real life. I have made the docker image according to what Brian ...
0
votes
0answers
31 views

HTML: Trying to download files from directory

On the quote.html page I have a download button that I want to download the text.txt file in the files folder but when I press the button it tries to downloads text.htm and outputs an error since ...
0
votes
0answers
20 views

Session issue on CS50s project 1 Book Review

I need to learn more about session. I have book route which goes to a book page stating the description of the book, reviews from other users and write a review. I create a form in html and submit my ...
0
votes
0answers
15 views

Flask-socketio not able to send instant messages

I am trying to make a basic chat application with rooms using flask-socketio, but whenever I run the code on my browser, a weird error comes on the console and I am not able to send any messages ...
0
votes
0answers
14 views

href not working properly

i have a layout html file in the following path: C:\Users\user1.vscode\files\web50p1\templates\layout.html in which i have the following code: <a href="/logout">Log Out</a></li&...
1
vote
0answers
27 views

cs50w Project 1: Web page running very slow

I just finished my book review page for project 1 and everything is working fine, but the site takes forever to load certain parts. When trying to log in or create a new account, or when trying to ...
0
votes
1answer
52 views

Can't import books.csv using import.py

I'm on a project1, here is the link to it: https://docs.cs50.net/ocw/web/projects/1/project1.html I've successfully made a Table books using my Python script, however when I try to import the "books....
0
votes
0answers
18 views

Problem with Flask Flashing message - messages appears twice

I'm newbie at Flask. I am trying to manage the flash alerts to appear where I want them. When I write the code get_flashed_messages() in the .html module the messages appears twice, without this code ...
1
vote
1answer
113 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 ...
0
votes
0answers
16 views

Failing to extract data from html selector

I am currently doing the project1 of the CS50 web programming course and having issues extracting data from an html selector into a flask route. I think its probably best if I just describe what I ...
0
votes
0answers
31 views

Trying to flask run the task session on the CS50 web Lecture DATABASE issue

I had a great time learning about HTML and CSS. Then came this intimidating flask feature. I was able to create a session["username"] to login and logout. I'm trying to use session to create a todo ...
0
votes
0answers
140 views

sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string

Traceback (most recent call last): File "list.py", line 9, in engine = create_engine(os.getenv("DATABASE_URL")) File "C:\python 3.8\flask_env\env1\venv\lib\site-packages\sqlalchemy\...
0
votes
0answers
21 views

CS50 Web Project 1: Is it necessary to use raw SQL queries?

This is not strictly a coding question, can we use the SQLAlchemy ORM for the Books project? I know it is forbidden to use as per the requirements, but I am unable to run my program using raw ...
0
votes
1answer
54 views

Problem in importing from csv file

I am currently trying to import the contents of the books.csv file into my PostgreSQL database on Adminer. Here's my code: import csv import os from sqlalchemy import create_engine from sqlalchemy....
0
votes
0answers
10 views

Can I use databases to take in signup information from the user?

Can I use database in my Project 1 website for the user signup and login, to store the user information? Or is it necessary to use sessions, as mentioned in the 'hints' section of the Project 1 ...
0
votes
2answers
83 views

adminer.cs50.net giving “Session expired, please login again.” error when attempting to login

This seems to have happened 11 Sept 2019 but it is occurring again. I tried logging into Adminer today and am receiving this error: "Session expired, please login again." I thought my Heroku ...
0
votes
0answers
83 views

NameError: name 'db' is not defined

I've made a simple code using python, where with the help of Flask_sqlalchemy I am trying to create 2 tables in a database which is being hosted by Heroku. The file db.py contains my table details ...
0
votes
0answers
44 views

CS50W Project 2: socket.io is not working for me

I am trying to create the channels real time so they can be broadcasted and i save them in a list on the backend. I will later make sure that all the channels in the list are also put in the list but ...
0
votes
0answers
26 views

CS50W Project 2: Rooms vs Namespaces

I would like to set up separate rooms (or namespaces? which one is better?) for the channels so the messages can only go to the specific channel. I would do this by getting the name of the channel and ...
0
votes
0answers
68 views

CS50W: “flask.cli.NoAppException” Can anyone explain this?

flask.cli.NoAppException: While importing "application", an ImportError was raised: Traceback (most recent call last): File "c:\users\hp\appdata\local\programs\python\python38\lib\site-packages\flask\...
0
votes
1answer
16 views

Project0 bot marks

I am doing a course called Web Development with Python and JavaScript, i did my project0 and submitted it. After a few days i got an email from c50 bot as shown in the image, i cant understand it ...
0
votes
0answers
88 views

ValueError: not enough values to unpack (expected 2, got 0)

I'm having this value error when I run my menu function. Please help me solve this error. Thank you. python code : def index(request): if not request.user.is_authenticated: return render(request,...
0
votes
1answer
84 views

error while trying to update database using python and sqlalchemy

While I was trying to run create.py file having the following code: import os from flask import Flask, render_template, request from models import * app = Flask(__name__) app.config["...
0
votes
1answer
18 views

Flash message disappears after redirect

So, during my work on CS50 WEB programming course I came up with this issue. In my Books application (Project 1), when user tries to leave a second review to the same book, the code doesn't let him ...
0
votes
0answers
34 views

can't fetch value from frontend… “document.querySelector('#text').value;” not working

<html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script> <script src="http://ajax.googleapis....
0
votes
0answers
15 views

flask.cli.NoAppException

I am getting an error while executing code of Lecture 2 macros.Traceback is below... Traceback (most recent call last): File "c:\users\acer\desktop\src2\first\env\lib\site-packages\flask\cli.py", ...
0
votes
1answer
43 views

Instance of 'scoped_session' has no 'execute' member

Getting the following problem using flask and SQLAlchemy: "Instance of 'scoped_session' has no 'execute' member pylint(no-member)". I use Windows 10, Flask. I suppose that the problem is somehow ...
0
votes
1answer
98 views

sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedFunction) operator does not exist: character varying = integer

In this code when I search in the book 0 index it shows the error ..... but the statements in elif statement work perfectly. When I manually enter the value instead of putting sea variable in my query ...
0
votes
1answer
92 views

CS50W Project2: communication between SocketIO and JavaScript

I'm trying to get new channel names input by the user to 1) show up on the screen in an unordered list and 2) also show up on other users' screens. I tried to closely follow the template that was used ...
0
votes
0answers
19 views

What is the difference between regular cs50.harvard and extension cs50.harvard?

I am planning to take CS50 web course. However I find the following two: https://cs50.harvard.edu/web/ and https://cs50.harvard.edu/extension/web/2020/spring/ What is different between of them? ...
0
votes
1answer
24 views

How to simulate different users using only one machine

I am using LocalStorage to save the display name and it does remember the display name after the browser is closed. However to simulate different users on the same machine chatting to each other, I ...
0
votes
0answers
105 views

CS50W Project1 TypeError: can't pickle _thread._local objects

My register app @app.route("/register", methods=["POST","GET"]) def signup(): #function to create new users #checking request method if request.method == 'GET': return ...
0
votes
1answer
30 views

C$50 FINANCE- BUY ERROR

I have a problem with my code on buy. I was wondering if anyone can help me identify the error. Whenever I go to the buy and enter the symbol and shares and click buy, it shows a 500 Internal Server ...