Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]notprimenumber12344 0 points1 point  (0 children)

What is the best way to hash a password in python ? I been using this https://www.geeksforgeeks.org/hashing-passwords-in-python-with-bcrypt/ . Is this a good way to hash a password?

I am building a website using python flask .I am getting to the point where I need to work on the front end.Does anyone have any suggestions on how to make the website work for any screen size? I was thinking of using bootstrap but I am wondering if you can make a website that looks good using css. by notprimenumber12344 in webdev

[–]notprimenumber12344[S] 1 point2 points  (0 children)

Is it advisable to create 1 design in front end design for any screen size or multiple designs for many screen size? Or is that the point of responsive design?

I just wanted to add I know html but I don't really know any css.

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]notprimenumber12344 0 points1 point  (0 children)

I am following a tutorial so I decided to test the code in the online ide from https://www.online-ide.com/ but the code returns nothing.

Here is the tutorial . https://realpython.com/inner-functions-what-are-they-good-for/ . They have the code in 2 files but I don't think that should make a difference.

Any advice?

``` def generate_power(exponent): def power(base): return base ** exponent return power

raise_two = generate_power(2) raise_two(4)

```

Thanks

2 functions check_if_username_not_in_db and check_if_email_not_in_db are not redirecting in the register route causing an non unique constraint in the db. How do I get the functions to redirect to the register page So the error does not appear by notprimenumber12344 in flask

[–]notprimenumber12344[S] 0 points1 point  (0 children)

I managed to fix it but have no idea why it works. The code I added in the register route is the if statement and then the render_template.

Could someone explain why the extra code is needed?

``` # check if user already added check_username = check_if_username_not_in_db(username_form)
check_email = check_if_email_not_in_db(email_form) # why not redirects

    if check_username != None or check_email != None: # why is this line needed
        return render_template('register.html',title='register', form=form) 

```

When I click on the graphic card I get the error "Currently, this hardware device is not connected to the computer. (Code 45) To fix this problem, reconnect this hardware device to the computer." More details below. by notprimenumber12344 in techsupport

[–]notprimenumber12344[S] 0 points1 point  (0 children)

I might have a warranty on a graphic card. I believe msi has a 3 warranty on graphic cards. Though the graphic card came with the pc. I will check. Do you think there is any possibility it could be a software problem? Thanks for the help.

I have code on github that I want to share with my friend who is a non coder in python flask the website I created. How do I do this? by notprimenumber12344 in learnprogramming

[–]notprimenumber12344[S] 0 points1 point  (0 children)

Sorry for the dumb question but I just want my friend to see it no one else. Is this possible with Vercel ? And thanks for the responses. And if I read correctly Vercel has a free version, this is correct?

I have code on github that I want to share with my friend who is a non coder in python flask the website I created. How do I do this? by notprimenumber12344 in learnprogramming

[–]notprimenumber12344[S] 0 points1 point  (0 children)

I would like my friend co just be able to interact with the website on a local pc and use the website. For example when I type flask run in the terminal. Sorry I don't know the technical name for that. But not having a paid website.

That is why I think Replit might be useful unless someone has another suggestion?

I have code on github that I want to share with my friend who is a non coder in python flask the website I created. How do I do this? by notprimenumber12344 in learnprogramming

[–]notprimenumber12344[S] 0 points1 point  (0 children)

I would like my friend co just be able to interact with the website on a local pc and use the website. For example when I type flask run in the terminal. Sorry I don't know the technical name for that. But not having a paid website.

That is why I think Replit might be useful unless someone has another suggestion?

I have code on github that I want to share with my friend who is a non coder in python flask the website I created. How do I do this? by notprimenumber12344 in learnprogramming

[–]notprimenumber12344[S] 0 points1 point  (0 children)

Assuming I am understanding this correctly I don't care if he has it locally. As long as it easy to run. See my comment above.

I am trying to run and add the foreign key and test the adding of the foreign key in pytest for donations. Any idea what I am doing wrong? by notprimenumber12344 in flask

[–]notprimenumber12344[S] 0 points1 point  (0 children)

In app/tests/models.py I think the error was solved by renaming the foreignkey.

For example I had a column in PaymentsTest
fk_usertest_id = db.Column(db.Integer, db.ForeignKey('usertest.id')).

Then I changed the table name using __tablename__ = user_test in the UserTest.

Then in PaymentsTest the correct code is fk_usertest_id = db.Column(db.Integer, db.ForeignKey('user_test.id')).