Spaces:
Runtime error
Runtime error
Download init_env.py from lmends/MoneyCouple: direct link, hf CLI and curl.
- Browser
- Download file 945 Bytes
-
https://huggingface.co/spaces/lmends/MoneyCouple/resolve/main/init_env.py
- Command line
-
hf download hf://spaces/lmends/MoneyCouple/init_env.py
-
curl -L -o init_env.py https://huggingface.co/spaces/lmends/MoneyCouple/resolve/main/init_env.py
945 Bytes
| """Run this once to generate .env with a secure encryption key.""" | |
| import os | |
| import secrets | |
| from cryptography.fernet import Fernet | |
| env_path = os.path.join(os.path.dirname(__file__), ".env") | |
| if os.path.exists(env_path): | |
| print(".env already exists, skipping.") | |
| else: | |
| key = Fernet.generate_key().decode() | |
| content = f"""SECRET_KEY={secrets.token_urlsafe(32)} | |
| JWT_SECRET_KEY={secrets.token_urlsafe(32)} | |
| ENCRYPTION_KEY={key} | |
| # Supabase / PostgreSQL connection string | |
| # Pegue em: Supabase -> Project Settings -> Database -> Connection string -> URI | |
| DATABASE_URL=postgresql://postgres:SENHA@db.SEU-PROJETO.supabase.co:5432/postgres | |
| AUTO_CREATE_TABLES=false | |
| FLASK_ENV=development | |
| FLASK_DEBUG=1 | |
| """ | |
| with open(env_path, "w") as f: | |
| f.write(content) | |
| print(f"Created .env successfully.") | |
| print(f"Encryption key: {key}") | |
| print("\n!! Lembre-se de preencher DATABASE_URL com a connection string do seu projeto Supabase.") | |