You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For production deployments, you can enable persistent database connections to reduce connection overhead:
59
+
60
+
```sh
61
+
# Enable persistent connections (value in seconds)
62
+
export DB_CONN_MAX_AGE=60
63
+
64
+
# Enable health checks to verify connections before reuse (recommended by Django docs)
65
+
export DB_CONN_HEALTH_CHECKS=True
66
+
```
67
+
68
+
- `DB_CONN_MAX_AGE`: Controls how long database connections are kept open for reuse.
69
+
- `0` (default): Close connection after each request (development mode)
70
+
- Positive integer: Keep connections open for that many seconds
71
+
- Not recommended forlocal development as the dev server creates a new thread per request
72
+
73
+
- `DB_CONN_HEALTH_CHECKS`: When `True`, Django verifies the connection is still alive before reusing it. This prevents errors after database restarts or when connections are terminated by the server.
74
+
55
75
> [!NOTE]
56
76
> It is possible to have authentication issues when escaping special characters. In some cases, it is necessary to add more than one backslash, whilein others, no addition is needed. To assist with this, you can export`DEBUG_DB_VARS=True` to check the database connection info in the terminal, allowing you to determine if the characters got escaped as intended. **This variable should NOT be set to True in production**.
57
77
@@ -229,7 +249,7 @@ In order to debug backend in PyCharm, just follow these steps:
229
249
- in `Run` session of the dialog, select `script`, then find the script `manage.py` at the `backend` folder
230
250
- at `script` name input, just enter `runserver`
231
251
- at `Environment Variables`, enter the following values:
0 commit comments