|
42 | 42 | cp .env.example .env
|
43 | 43 | ```
|
44 | 44 | - Edit the `.env` file and update the values according to your setup:
|
45 |
| - - `SECRET_KEY`: Generate a unique secret key for Django |
| 45 | + - `SECRET_KEY`: Generate a unique secret key for Django using one of these methods: |
| 46 | + ```bash |
| 47 | + # Method 1: Using Django's built-in utility (Recommended) |
| 48 | + python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())" |
| 49 | + |
| 50 | + # Method 2: Using Python's secrets module |
| 51 | + python -c "import secrets; print(secrets.token_urlsafe(50))" |
| 52 | + |
| 53 | + # Method 3: Using openssl (if available) |
| 54 | + openssl rand -base64 50 |
| 55 | + ``` |
46 | 56 | - `MONGODB_URI`: MongoDB connection string (default: `mongodb://localhost:27017`)
|
47 | 57 | - `DB_NAME`: Your database name
|
48 | 58 | - `GOOGLE_OAUTH_CLIENT_ID` and `GOOGLE_OAUTH_CLIENT_SECRET`: OAuth credentials for Google authentication
|
49 |
| - - `PRIVATE_KEY` and `PUBLIC_KEY`: Generate RSA key pairs for JWT token signing |
| 59 | + - `PRIVATE_KEY` and `PUBLIC_KEY`: Generate RSA key pairs for JWT token signing using one of these methods: |
| 60 | + ```bash |
| 61 | + # Method 1: Using openssl (Recommended) |
| 62 | + # Generate private key (2048-bit RSA) |
| 63 | + openssl genrsa -out private_key.pem 2048 |
| 64 | + |
| 65 | + # Generate public key from private key |
| 66 | + openssl rsa -in private_key.pem -pubout -out public_key.pem |
| 67 | + |
| 68 | + # View the keys and copy them to your .env file |
| 69 | + cat private_key.pem |
| 70 | + cat public_key.pem |
| 71 | + |
| 72 | + # Method 2: Using ssh-keygen |
| 73 | + ssh-keygen -t rsa -b 2048 -m PEM -f jwt_key -N '' |
| 74 | + openssl rsa -in jwt_key -pubout -out jwt_key.pub |
| 75 | + ``` |
| 76 | + **Note**: Copy the entire content including `-----BEGIN...-----` and `-----END...-----` headers |
50 | 77 | - Other settings can be left as default for local development
|
51 | 78 | 7. Install [docker](https://docs.docker.com/get-docker/) and [docker compose](https://docs.docker.com/compose/install/)
|
52 | 79 | 8. Start MongoDB using docker
|
|
0 commit comments