DEV Community

Cover image for Getting started with Python Django
Clement Odok
Clement Odok

Posted on

Getting started with Python Django

As someone who just started learning Python basics and recently stepped into Django, I want to share my journey with other beginners.

Learning Python is exciting because it's one of the most beginner-friendly languages. Its simple syntax allows you to quickly build scripts, solve problems, and understand programming fundamentals.

After building a strong foundation in Python basics—variables, data types, loops, functions, and object-oriented programming—I discovered Django. Django is a high-level Python web framework designed for building web applications quickly with clean, reusable code. It's trusted by major companies like Instagram, Pinterest, and Mozilla.

For a beginner like me, Django felt both exciting and challenging, but I decided to take the leap.


Why Start with Python and Django?

  • Python basics give you problem-solving skills and coding confidence
  • Django lets you quickly transition from simple scripts to real web applications
  • You can build practical projects like to-do apps, personal blogs, or simple dashboards
  • The community and documentation are incredibly beginner-friendly—you'll never feel stuck

Setting Up Django

Here's how I got started, step by step:

1. Install Python and create a virtual environment

python3 -m venv env
source env/bin/activate   # Linux
Enter fullscreen mode Exit fullscreen mode

2. Install Django

pip install django
Enter fullscreen mode Exit fullscreen mode

3. Create your first project

django-admin startproject myproject
cd myproject
python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

When I opened http://127.0.0.1:8000 in my browser, I saw the Django welcome page. That moment felt like magic—I had just set up my first backend framework!


Building My First App

In Django, projects are made up of apps (think of them as different features). I created my first app with:

python manage.py startapp myapp
Enter fullscreen mode Exit fullscreen mode

Inside the views.py file, I wrote my first function:

from django.http import HttpResponse

def home(request):
    return HttpResponse("Hello, Django! This is my first app.")
Enter fullscreen mode Exit fullscreen mode

Then I connected it in urls.py (inside the app folder):

from django.urls import path
from . import views

urlpatterns = [
    path("", views.home, name="home"),
]
Enter fullscreen mode Exit fullscreen mode

I also had to include this in the main project's urls.py:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('myapp.urls')),
]
Enter fullscreen mode Exit fullscreen mode

When I refreshed my browser, I saw my first custom Django page! 🎉


What's Next on My Journey

I'm currently learning Django step by step:

  • Setting up projects and apps
  • Understanding how views, models, and templates work together
  • Building my first database-backed app
  • Adding HTML templates and styling

I plan to share the small projects I build along the way.


Tips for Fellow Beginners

If you're just starting your Django journey too, here's what's helping me:

  • Stay consistent - Even 30 minutes daily makes a difference
  • Don't skip the fundamentals - Understanding Python first made Django much easier
  • Use the documentation - Django's docs are surprisingly readable for beginners

What's your experience with Django? Are you just starting out too? I'd love to hear about your journey in the comments!

Top comments (0)