A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.geeksforgeeks.org/python/django-dealing-with-warnings/ below:

Django - Dealing with Unapplied Migration Warnings

Django - Dealing with Unapplied Migration Warnings

Last Updated : 11 Jul, 2025

Django is a powerful web framework that provides a clean, reusable architecture to build robust applications quickly. It embraces the DRY (Don't Repeat Yourself) principle, allowing developers to write minimal, efficient code.

Create and setup a Django project:

Prerequisite: Django - Creating project

After setting up a new Django project, your directory structure may look something like this:

At first, it might seem confusing to see two folders with the same name. Here’s the clarification:

For example, renaming the outer folder to geeksforgeeks will give you:

Unapplied Migrations Warning

After completing your setup, run the server using command:

python manage.py runserver

You may encounter a red warning message like:

You have 15 unapplied migrations. Your project may not work properly until you apply the migrations...

These warnings indicate that there are pending database schema changes that haven’t been applied yet. While your project might run, these should not be ignored.

How to Fix:

Stop the development server using CTRL+C and run:

python manage.py migrate

Now on your command prompt, you will see something like this:

This command applies all pending migrations and sets up your database schema correctly.

Now, restart the server:

python manage.py runserver

Doing this will remove the warnings.

Moving towards Django Apps

As our project grows, it’s a best practice to shift functionality into separate Django apps. These apps help modularize features and keep your code maintainable and scalable.

If you’ve added a function-based view like this in views.py:

Python
# geeks_site/views.py
from django.http import HttpResponse

def hello_geeks(request):
    return HttpResponse("Hello, Geeks!")

Add this route in urls.py:

Python
from geeks_site.views import hello_geeks

urlpatterns = [
    path('geek/', hello_geeks),
]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4