Jump to content

Why I can't `with` statement in my webapp?


xitiz

Recommended Posts

I am trying to create a webapp where person can store some data(email and password) but i want to use .txt file while storing their data.Mean i want to store their data into the .txt file but if i try to use with statement in my myapp.py then it gives the internal server error.
I am using Flask to create this webapp.

 

Link to comment
Share on other sites

Why not store data in a database?

 

If you insist on writing to a file for some reason, I would bet the reason it is failing is permissions.

How is it is to store that much simple data in database then in .txt file?

I think storing this simple data in data base is very hard then store that in just .txt file?

Don't you think so.

And Can i install some needed package like as pickle?

To save that data in .txt file.

Edited by xitiz
Link to comment
Share on other sites

Yes, I would definitely use a database to store emails and passwords for people. Make sure you don't store the passwords in plaintext either. They need to be salted and hashed. Storing emails and passwords in a text file is probably one of the worst ideas I've heard in a long time. What if someone figures out the name of the text file and just goes to yourdomain.heliohost.org/passwords.txt and everything is displayed? It may take a tiny bit more work now to figure out how to use a database and everything, but it will pay off in the long run. Develop good habits today, and you won't end up with a disaster later on.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...