Getting Page Not Found?

Everything is fine But stil I got Page Not Found Error

Welcome @saitejanani12 !

You’re going to need to provide a lot more details here about the issue you’re facing. Start with describing what URL you’re trying to access, and post your urls.py file(s).

Note: When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

But I got every time same error eventhough everything is fine…

same code working in other’s laptops not in my system …
what should i do to solve this type of issue…
could you please help me…
is there any other way to solve this error?

from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.

def home(request):
    return HttpResponse("Sai Teja")

urls.py

from django.contrib import admin
from django.urls import path
from chandu import views
urlpatterns = [
    path('admin/', admin.site.urls),
    path('',views.home),
]

settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'chandu'
]

You have posted a views.py, urls.py and settings.py. Please identify which directory each of those files are in.

Side note, when posting blocks of code, you need to use three backtick - ` characters before and after the block, not apostrophes - ' or quotes - ". (I’ve taken the liberty of fixing this post for you.)

from django.http import HttpResponse

# Create your views here.
def home(request):
    return HttpResponse("GOOD EVENING")

from django.contrib import admin
from django.urls import path
from testapp import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('greet/', views.home),
]

"""
Django settings for day1 project.

Generated by 'django-admin startproject' using Django 5.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/5.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""

from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-#%84jus0_a24j6lqr%0mp4f4nt5uwnud8i^@lj$zb@h-s-2e3l'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'testapp',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'day1.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'day1.wsgi.application'

# Database
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}

# Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

How to fix this please give one suggestion…
views.py in app directory
settings.py and urls.py in project directory …
i tried create urls.py in app directory also but everytime getting same error as like in
message

Please identify what directory each of those files posted are in. Also, it does not help to group different files together in your post.

views.py file having in app directory
settings.py and urls.py having in project directory …
i tried create urls.py in app directory also but everytime getting same error

What is the name of that directory?

What is the name of that directory?

You have posted two different urls.py files, which one are we trying to diagnose?

How are you running your project? (Are you running this from the command line, or are you using an IDE?)

What operating system are you using?

I’m running sometimes in CMD and sometimes in VS code IDE…
HP windows 11 system.

Please help me why I am getting this error