r/learnprogramming • u/Bluebill_365 • 1d ago
Tutorial Django tutorials
I have started practicing Django, I created a simple student admission page:
• Student fills form
• Django validation takes place
• After validation data is stored in database
I used DRF for the validation, and aws PostgreSQL and this is a simple thing I want to use to start my journey in backend dev.
Hosted it on render free tier and when I hit the submit button I used a stopwatch to check how it took to submit and it was 00:00:22.23.
Please I’m still learning and I want to know if it’s okay to have that time for submitting and if not what should I study next and I used the DRF for the form validation with an if statement.
Thank you for feedback and time.
1
u/Explorer651 20h ago
On the 22 seconds, Render's free tier spins a service down after 15 minutes without traffic, and spinning back up on the next request takes about a minute. If you hadn't hit the page for a while, that could be most of the delay, so try submitting twice in a row and time the second one.
1
u/Rare-Pay9795 11h ago
22 seconds is way too slow, and the drf validation with an if statement is not the cause, that part takes milliseconds. since the second and third tries were slow too, it's not just render's free tier cold start. the usual suspect is the database connection: render free web services and an aws postgres instance in some other region means every new connection pays a big handshake cost, and if the db is set to need ssl and the security group is slow to respond it can hang for a long time. quick way to find out is to put time.time() before and after the save call in your view and print both, or open the browser devtools network tab and look at the waiting (ttfb) time. if the db save is the slow part, check that the render region is close to your rds region and that you set conn_max_age in your django DATABASES settings so it reuses connections.
2
u/khaled_shehata 1d ago
The official Django tutorial (the polls app) is honestly the best start, then Django for Beginners by William Vincent — the first chapters are free online. After that, build something small of your own; tutorials stop helping once you're comfortable reading the docs.