I am trying to make a chat room but for that first i need a login menu. I'v coded this so far but i want the usernames and passwords to stay in the code forever, even if i stop and then run the code again. PLs help me.
Use sqlalchemy and an sql database. You can put an encryption key into a .env file and read it using
import os key = os.getenv("SECRET_KEY")
In the .env, quotes are not required. If you put quotes, the will be evaluated as part of the string
The previous 2 comments are about using text files and I'm going to explain why you wouldn't want to do this.
1) repl.it doesn't save generated text files, so if you use your code to generate a file it will get deleted afterwards, which defeats the purpose of it.
2) Even if repl.it does save the files, everyone looking at the repl would be able to see the passwords and everything.
A possible solution would be jsonstore.io, although I have no idea how to use it. (I've heard other replers using it)
One thing you can do if store the values in the text file. Create two files, one for usernames (usernames.txt) and the other one for passwords(passwords.txt). After a new usearnames and password are created to add to the file. When checking a username and password exists check through the list. If you are not good with text files with python here is a couple of good resources to learn about it.
My favorite is the guru99 site. Also, if you need additional help specifically on this project just ask me below. If this post helped please like it. :)
@Muhammad_SJC I took a look, your style of coding is a little different than mine. That does not mean it's bad, everybody has a style of coding just like writing. For me, it is a little weird to work on this code just because the format is not usual for me. Thanks for the offer though, but you should try first on your own if you need really specific things than you can ask me.