Retour à pip install au lieu de Poetry
This commit is contained in:
parent
2a7b056698
commit
a5403db464
11 changed files with 158 additions and 3958 deletions
25
generate_secret_key.py
Normal file
25
generate_secret_key.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import secrets
|
||||
import os
|
||||
|
||||
def generate_secret_key():
|
||||
return secrets.token_hex(16) # 16 bytes = 32 hex characters
|
||||
|
||||
def update_env_file(secret_key):
|
||||
env_path = os.path.join(os.path.dirname(__file__), '.env')
|
||||
|
||||
with open(env_path, 'r') as file:
|
||||
lines = file.readlines()
|
||||
|
||||
with open(env_path, 'w') as file:
|
||||
for line in lines:
|
||||
if line.startswith('SECRET_KEY='):
|
||||
file.write(f'SECRET_KEY={secret_key}\n')
|
||||
else:
|
||||
file.write(line)
|
||||
|
||||
if __name__ == "__main__":
|
||||
new_secret_key = generate_secret_key()
|
||||
print(f"Generated Secret Key: {new_secret_key}")
|
||||
|
||||
update_env_file(new_secret_key)
|
||||
print("The .env file has been updated with the new SECRET_KEY.")
|
Loading…
Add table
Add a link
Reference in a new issue