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
{{ message }}
Repository navigation
Commit 70d6fff
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,16 @@ Web app for **wall-clock profiling**, **growth-curve fitting**, and **learning c
16
16
17
17
Environment variables for Django live in `time_complexity_analyzer/time_complexity_analyzer/settings.py` (e.g. `DJANGO_SECRET_KEY`). Use a real secret in production.
18
18
19
+
### Render.com (split static site + API)
20
+
21
+
The UI calls Django under **`/api/...`**. Those routes exist on the **API** service only.
22
+
23
+
1. On the **static site** build, set **`REACT_APP_API_URL`** to your API’s public origin, e.g. `https://your-time-complexity-api.onrender.com` (no `/api` suffix). See `time_complexity_analyzer/frontend/.env.production.example`.
24
+
2.**Rebuild** the static site so Create React App inlines the variable (build-time only).
25
+
3. Keep the **web/API** service running.
26
+
27
+
If `REACT_APP_API_URL` is missing, production builds default the API base to the **static site’s origin**; `POST /api/analyse-code/...` then hits the CDN and often returns **404**. You can also set `window.__TCA_API_BASE__` before the app bundle loads (see `frontend/src/components/Axios.js`).
Copy file name to clipboardExpand all lines: time_complexity_analyzer/frontend/src/components/CalculatorPage.js
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -343,6 +343,10 @@ function CalculatorPage() {
343
343
setError(
344
344
"Sign in or create an account to run analysis. If you self-host the API, set TCA_ALLOW_ANONYMOUS_ANALYSIS=true (default) or DEBUG=true, then restart Django."
345
345
);
346
+
}elseif(err.response?.status===404){
347
+
setError(
348
+
"API returned 404 (not found). On split hosting (e.g. Render static site + separate API), set REACT_APP_API_URL to your Django base URL when building the frontend (example: https://your-api.onrender.com with no trailing /api), redeploy the static site, and confirm the API service is running."
349
+
);
346
350
}else{
347
351
setError(err.message||"Can't calculate it. Please check your code and try again.");
0 commit comments