xTanzu / Fibers

A small flask/python test web-app for Helsinki Uni project course "Database and web-programming"
0 stars 0 forks source link

Problem opening app #2

Open PlatinumFoxTail opened 1 year ago

PlatinumFoxTail commented 1 year ago

Unfortunately I am not able to start the app. Following problems occur:

./init_db.sh -iu -> bash: ./init_db.sh: Permission denied sudo ./init_db.sh -iu -> sudo: ./init_db.sh: command not found sudo ./init_db.sh -r -> sudo: ./init_db.sh: command not found

PlatinumFoxTail commented 1 year ago

I tried to check through the code in the files, and it seems that you know what you are doing. Anyhow, here are still some observations I made that may be useful for you when developing further the app:

xTanzu commented 1 year ago

Unfortunately I am not able to start the app. Following problems occur:

./init_db.sh -iu -> bash: ./init_db.sh: Permission denied sudo ./init_db.sh -iu -> sudo: ./init_db.sh: command not found sudo ./init_db.sh -r -> sudo: ./init_db.sh: command not found

Yeah there is a problem I tried it myself too. There is a permission problem after you clone the project. Not sure if this has to do with the fact that I am using WSL2 on Windows to run Linux, since there is a permission format clash when windows saves the files its own file system that handles permissions differently. That results sometimes that permissions are not carried over properly from WSL to native Linux.

The init_db.sh has full 777 rights on my system on push to github. But when cloning, it comes back down as 744.

So you have to change the permissions before you can run it on your system. You can do this by just running chmod 777 init_db.sh, and you might have to do that with sudo, not quite sure now off the top of my head.

And yeah this might have been a suboptimal way of setting the db through a script, especially when I really am not good with scripting at all. But hope you will get it to work.

All the script does is use psql through bash commands and wire them in way that you can decide if you need to install the whole postgres database, or just set up users and permissions for the tables, or if you need to delete the whole database to reset everything in the db back to zero. I use it myself and it works, but now afterwards I reckon it might have been better to do it in a dbsetup.py file. I remember I just had trouble connecting the app to db before I made a proper user with a password that the app would use and had to use the db through the command line. From there I just made a small script to do this user and permission creation and reckoned I just could do one script file that does the whole setup.

The way that they showed the db connection path thing in the material just did not work for me in WSL, so I had to do a full user based sign in with a password. I know its not cool to distribute passwords in .env file, but I just thought that people will have to test it on their systems so this is the right way. Everybody knows that if it would go live for sure, the user and password would be different 😅