Create a Django App and Configure Urls for it

python manage.py startapp myapp

Register the App

Open the settings.py file in your project directory (myproject/myproject/settings.py). Add your new app to the INSTALLED_APPS list:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myapp',  # Add this line
]

Create a View

In your app directory (myapp), open the views.py file and add the following function:

from django.http import HttpResponse

def home(request):
    return HttpResponse("Hello, world. This is my first Django app.")

Set Up URLs

In your app directory, create a file named urls.py and add the following code:

from django.urls import path
from . import views

urlpatterns = [
    path('', views.home, name='home'),
]

Then, include the app’s URLs in your project’s URLs. Open the urls.py in your project directory (myproject/myproject/urls.py) and modify it like this:

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

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include('myapp.urls')),  # Include this line
]