Kickstarting a Modern Django Project (using UV) in 2025
Software engineer and founder with a background in finance and tech. Currently building aVenture.vc, a platform for researching private companies. Based in San Francisco.

Software engineer and founder with a background in finance and tech. Currently building aVenture.vc, a platform for researching private companies. Based in San Francisco.

This guide covers setting up a modern Django project, including:
This part covers setting up a standard, default Django project using your preferred workflow (Terminal, VS Code, or PyCharm).
Now that you have a basic Django project running using your preferred setup method, the next sections will cover creating your first app and using modern project templates.
A Django project is the overall container for your application's settings and configurations (e.g., database settings, installed apps, URL routing at the project level). A project can contain multiple apps, which are modular components that handle specific functionalities (like a blog, a user management system, etc.). Think of the project as the building and apps as the distinct rooms or services within it.
With the default project running, let's create your first Django app and understand core concepts.
App labels need to be valid Python identifiers. Stick to lowercase letters and optional underscores (for example, my_first_app) so the generated package imports cleanly.
INSTALLED_APPS in your project's settings.py file:INSTALLED_APPS = [
# ... other apps
'my_first_app', # Or 'my_first_app.apps.MyFirstAppConfig' if using AppConfig
# ... django apps ...
]
my_first_app/models.py:from django.db import models
class Greeting(models.Model):
message = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.message
my_first_app/views.py:from django.http import HttpResponse
from .models import Greeting
def hello_world(request):
greeting = Greeting.objects.first() # Get the first greeting, or None
if not greeting:
greeting_text = "No greetings yet!"
else:
greeting_text = greeting.message
return HttpResponse(f"<h1>{greeting_text}</h1><p>From my_first_app!</p>")
my_first_app/urls.py:from django.urls import path
from . import views
urlpatterns = [
path('hello/', views.hello_world, name='hello_world'),
]
urls.py (e.g., config/urls.py):from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('app/', include('my_first_app.urls')), # This adds your app URLs
]
http://127.0.0.1:8000/app/hello/ to see your view in action.These templates reduce boilerplate for common functionalities (auth, UI components, deployment setup), so you can focus on your application logic.
Django has built-in features for web applications:
django.contrib.auth for user management.django.contrib.admin for data management.DATABASES dictionary in settings.py:For production, use environment variables for database credentials, not hardcoded values:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.environ.get('DB_NAME', 'mydatabase'),
'USER': os.environ.get('DB_USER', 'mydatabaseuser'),
'PASSWORD': os.environ.get('DB_PASSWORD', 'mypassword'),
'HOST': os.environ.get('DB_HOST', '127.0.0.1'),
'PORT': os.environ.get('DB_PORT', '5432'),
}
}
admin.py file:from django.contrib import admin
from .models import Greeting
@admin.register(Greeting)
class GreetingAdmin(admin.ModelAdmin):
list_display = ('message', 'created_at')
search_fields = ('message',)
http://127.0.0.1:8000/admin/ and log in with superuser credentials.list_display: Fields to show in list viewsearch_fields: Fields to search throughlist_filter: Enable filtering by fieldsfieldsets: Organize fields in detail viewreadonly_fields: Fields that can't be editedExecute from project root with virtual environment active.
While this guide focuses on setting up your local development environment, deploying your Django application to a production server involves additional steps. Unlike the built-in development server, production deployments typically use a Web Server Gateway Interface (WSGI) server (like Gunicorn or uWSGI) to handle requests, often in conjunction with a web proxy server (like Nginx or Apache, or AWS Lambda).
For more on deployment strategies and options, I made a recent post sharing my current hosting preferences: How I Host My Apps: How to Deploy in 2025
Ctrl+C in the terminalCtrl+Z was used: Use fg then Ctrl+C, or jobs and kill %JOB_NUMBER# Find the process using port 8000
lsof -i :8000
# Kill the process
kill <PID>
INSTALLED_APPSmodels.pypython manage.py showmigrationsSTATIC_URL, ensure files are in app_name/static/app_name/collectstatic, configure web server for STATIC_ROOTTemplateDoesNotExist Error:INSTALLED_APPSapp_name/templates/app_name/settings.py# Import your model
from my_first_app.models import Greeting
# Query data
Greeting.objects.all()
# Create test data
Greeting.objects.create(message="Hello, Django!")