DEV Community

stackbento
stackbento

Posted on

Day 18 Django learnings

🚀 Django Learning Journey – Day 18

Another day, another chapter unlocked in my Django learning journey!

Today, my curiosity took control. I asked myself:
“If the project will eventually be hosted online… why not learn how to use a real cloud database right now?”

So instead of sticking with Django’s default sqlite3, I explored the world of cloud-based PostgreSQL databases — especially the ones offered by Render.

🧭 Exploring Cloud Databases

I spent time reading articles, browsing StackOverflow, and watching YouTube tutorials on how Django connects to external databases.

There are so many choices out there, but I decided not to overwhelm myself.
Since my first project is already deployed on Render, I stuck with it and learned how to provision a PostgreSQL database in the free tier.

⚙️ Setting Up a Test Project

To avoid breaking my main project, I created a test Django project and pretended this was a real production setup.

Surprisingly, all the setup felt like a quick refresher — I almost remember all the commands now!
Also installed the usual suspects right away:

whitenoise

gunicorn

Feels nice to see how the brain actually learns through repetition. 😄

🔑 Key Learnings of the Day

To connect Django to an external PostgreSQL database, these two packages became essential:

pip install psycopg2
pip install dj-database-url

I’m still learning what psycopg2 does under the hood,
but I know now that it helps Django speak to PostgreSQL.

dj-database-url, on the other hand, was very clear:
It helps parse the database URL from environment variables.

Using the parsed URL, I updated the settings.py file and fed the database link through Render’s environment variables.

📤 Pushed to Git → Deployed → Nervous Excitement

After setting everything locally:

Pushed to GitHub

Deployed to Render

And yes… that feeling of watching a project deploy still hits different!
I don’t know if it’s just me, but I genuinely get excited like a kid every time the logs scroll and the “Deploying…” animation runs. 😄

But then…

❌ “Bad Request (400)” — The Plot Twist

Everything looked perfect…
until I hit a 400 Bad Request error.

At this point, I had no clue what the issue was.
Instead of stressing, I chose to stop, breathe, and continue tomorrow with a fresh mind.

❓ Honest Questions to the Community

1️⃣ Should I continue learning with PostgreSQL or stick to Django’s default sqlite3 while learning?
2️⃣ If I build the project using sqlite3, can I later migrate the database to PostgreSQL during deployment?
3️⃣ Is using a cloud database too early for a beginner, or is this the right level of curiosity?

Would love to hear honest suggestions!

❤️ Signing Off

Not a huge coding day, but a massive learning day.
I’m realising something important:

Deployment teaches you things that tutorials never do.

And I’m excited to wake up tomorrow and fix that 400 error!

If you’ve ever felt this same excitement (or confusion!) while connecting databases or deploying, tell me your story in the comments!

Django #Render #WebDevelopment #Python #DeployYourApp #LearningInPublic #100DaysOfCode #BeginnerDev #postgresql

Top comments (0)