Documentation Index
Fetch the complete documentation index at: https://mintlify.com/edimez14/password_generator/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Password Generator application uses environment variables to manage configuration across different environments. This guide covers all required and optional environment variables for both frontend and backend.Backend Environment Variables
Required Variables
These variables must be set for the Django backend to function properly:Django secret key for cryptographic signing. Generate a secure random string.
Enable or disable debug mode. Must be
False in production.PostgreSQL database connection URL (production only).
In development with
DEBUG=True, SQLite is used automatically and DATABASE_URL is not required.Deployment Configuration
Comma-separated list of allowed hostnames for production.
Comma-separated list of allowed hostnames for development.
CORS Configuration
Cross-Origin Resource Sharing (CORS) settings allow the frontend to communicate with the backend API:Comma-separated list of allowed origins for production.
Comma-separated list of allowed origins for development.
Comma-separated list of trusted origins for CSRF protection in production.
Comma-separated list of trusted origins for CSRF protection in development.
Database Configuration
The application uses different database configurations based on theDEBUG setting:
Development (DEBUG=True)
settings.py
Production (DEBUG=False)
settings.py
The production configuration uses
dj-database-url to parse the DATABASE_URL and enables SSL connections.JWT Authentication Configuration
The application uses JWT tokens for authentication with the following settings:settings.py
How long access tokens remain valid.
How long refresh tokens remain valid.
Generate a new refresh token when refreshing.
Blacklist old refresh tokens after rotation.
Fly.io Specific
Automatically set by Fly.io. The app name is added to
ALLOWED_HOSTS.settings.py
Frontend Environment Variables
API Configuration
Backend API URL. Must be prefixed with
NEXT_PUBLIC_ to be exposed to the browser..env.local
Environment File Examples
Backend .env (Development)
.env
Backend .env (Production)
.env
Frontend .env.local
.env.local
Django Settings Configuration
The application usesdjango-environ to read environment variables:
settings.py
REST Framework Configuration
The Django REST Framework is configured with JWT authentication:settings.py
Static Files Configuration (Production)
settings.py
Localization Settings
The application is configured for Colombian Spanish:settings.py
Security Best Practices
Use different keys per environment
Never reuse the same
SECRET_KEY across development, staging, and production.Environment Variable Checklist
Backend Production
SECRET_KEYis set to a strong random valueDEBUG=FalseDATABASE_URLpoints to PostgreSQLALLOWED_HOSTS_DEPLOYincludes your domainCORS_ALLOWED_ORIGINS_DEPLOYincludes your frontend domainCSRF_TRUSTED_ORIGINS_DEPLOYincludes your frontend domain
Backend Development
SECRET_KEYis set (can be simple for dev)DEBUG=TrueALLOWED_HOSTS_DEVincludes localhostCORS_ALLOWED_ORIGINS_DEVincludes localhost:3000
Frontend
NEXT_PUBLIC_API_URLpoints to backend API- Updated
Request.api.jsto use environment variable
Troubleshooting
”SECRET_KEY” KeyError
If you see this error, theSECRET_KEY environment variable is not set:
CORS Errors
If you see CORS errors in the browser console:- Verify
CORS_ALLOWED_ORIGINS_DEPLOYincludes your frontend URL (with protocol) - Ensure there are no trailing slashes
- Check the backend logs for CORS rejection messages
Database Connection Failed
If the database connection fails:Next Steps
Frontend Deployment
Deploy the Next.js frontend
Backend Deployment
Deploy the Django backend
