Karri6 / db-and-web-dev

0 stars 0 forks source link

Peer review 1 #3

Open jakubgrad opened 3 months ago

jakubgrad commented 3 months ago

Peer review per instructions Tied to the course

Hey! It seems like the app is going well. I had a major problem with database connection and I think it can't work by default on any computer, but I added some suggestions on how to fix it.

Minor things:

Problem with database url and solution:

After setting the secret file according to the instructions in the repository, starting psql and running the flask app I can go to the website on localhost. However, when I try to sign up the terminal window that runs the app prints:

Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?

(Background on this error at: https://sqlalche.me/e/20/e3q8)
127.0.0.1 - - [10/Apr/2024 14:05:35] "POST /signup HTTP/1.1" 500 -

The terminal window that I started start-pg.ssh in says:

The psql server is listening:
2024-04-10 13:57:56.158 EEST [14928] LOG:  database system is ready to accept connections

So it seems like it didn't even realize something was trying to connect to it. My hunch is that you need to write an initialization scheme for the database or change DATABASE_URL to something more universal, because:

postgresql://pajar:paprikamajoneesi@localhost/webdev_db

Seems to be using a username pajar that’s unknown by my psql and a database webdev_db that wasn’t yet created. These are probably familiar to your computer but not mine. To make it work on the my university [VMware Cubbli](https://helpdesk.it.helsinki.fi/ohjeet/tietokone-ja-tulostaminen/etakaytettavat-tyopoydat-vdi) I fired uppsql`:

$ psql
<username> # CREATE DATABASE test_for_karri6;

Then changed the db_url.env to:

DATABASE_URL=postgresql+psycopg2:///test_for_karri6

This way:

Codewise:

Otherwise:

I like how the app looks! There’s definitely a lot of features running already, and the UI feels intuitive. In a moment of free time you could add a few <br /> newlines to separate the links and text in the UI, but apart from that it seems to be going in a great direction :))

Karri6 commented 3 months ago

Sweet, thanks for the feedback. Also sorry for the mixup with the psql instructions, mistakenly left the local address in there that I'm using, but seems that you got it working either way. Cleaned up the instructions updated the commands that need to be executed. Cheers.