'Django 404 error-page not found, how can I solve this problem?

My project is named main, and when I runserver I get this error.Anybody have any clue how to fix this error.

Page not found (404)
Request Method: GET
Request URL:    http://127.0.0.1:8000/detail//3
Using the URLconf defined in movieReview.urls, Django tried these URL patterns, in this order:
admin/
[name='home']
detail/<str:slug>/<int:id> [name='detail']
category [name='category']
celebrity [name='celebrity']
category/<str:slug>/<int:id> [name='category-movies']
celebrity/<str:slug>/<int:id> [name='celebrity-movies']
recent-released [name='recent-released']
upcoming [name='upcoming']
accounts/register [name='register']
accounts/profile [name='profile']
accounts/changepassword [name='changepassword']
my-reviews [name='my-reviews']
delete-review/<int:id> [name='delete-review']
^media/(?P<path>.*)$
accounts/
The current path, detail//3, didn’t match any of these.

My settings.py file looks like this...

"""
Django settings for movieReview project.

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

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

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

import os
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/3.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!


# 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',
    'main',
]

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 = 'movieReview.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',
                'main.context_processor.top_movies',
                'main.context_processor.upcoming_movies',
            ],
        },
    },
]

WSGI_APPLICATION = 'movieReview.wsgi.application'


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

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


# Password validation
# https://docs.djangoproject.com/en/3.1/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/3.1/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

LOGIN_REDIRECT_URL='/'
LOGOUT_REDIRECT_URL='login'

and my urls.py in my main folder is

from django.urls import path
from . import views

from django.conf import settings
from django.conf.urls.static import static

urlpatterns=[
    path('',views.home,name='home'),
    path('detail/<str:slug>/<int:id>',views.detail,name='detail'),
    path('category',views.category,name='category'),
    path('celebrity',views.celebrity,name='celebrity'),
    path('category/<str:slug>/<int:id>',views.category_movies,name='category-movies'),
    path('celebrity/<str:slug>/<int:id>',views.celebrity_movies,name='celebrity-movies'),
    path('recent-released',views.recent_released,name='recent-released'),
    path('upcoming',views.upcoming_movies,name='upcoming'),
    path('accounts/register',views.register,name='register'),
    path('accounts/profile',views.profile,name='profile'),
    path('accounts/changepassword',views.change_password,name='changepassword'),
    path('my-reviews',views.my_reviews,name='my-reviews'),
    path('delete-review/<int:id>',views.delete_review,name='delete-review'),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

And I can't open this page: 127.0.0.1:8000/detail

{% extends 'base.html' %}
{% load static %}
{% block title %}Home Page{% endblock %}
{% block content %}
        <h3 class="border-bottom pb-2 mt-3">{{data.title}}</h3>
        <div class="row mt-4">
            <!-- Left Content -->
            <div class="col-12 col-sm-8">
                <span class="movie-rating btn btn-warning btn-sm mb-3">{{data.total_rating|floatformat:1}}/5</span>
                <p><img src="/media/{{data.image}}" class="img-fluid" /></p>
                <div class="movie-content">
                    <h5>Movie Plot</h5>
                    <p>{{data.plot}}</p>
                    <hr/>
                    <h5 class="my-3">Cast and Crew</h5>
                    <table class="table table-bordered">
                        {% for celeb in data.celebrity.all %}
                        <tr>
                            <td><a href="/celebrity/{{celeb.name|slugify}}/{{celeb.id}}"><img src="/media/{{celeb.image}}" width="100" /></a></td>
                            <td><a href="/celebrity/{{celeb.name|slugify}}/{{celeb.id}}">{{celeb.name}}</a></td>
                            <td>{{celeb.celeb_type}}</td>
                        </tr>
                        {% endfor %}
                    </table>
                    <hr/>
                    <h5 class="my-3">Movie Gallery</h5>
                    <div class="row">
                        {% for image in data.movieimage_set.all %}
                        <div class="col-12 col-sm-3">
                            <a href="/media/{{image.image}}" data-lightbox="moviegallery"><img src="/media/{{image.image}}" class="img-fluid" alt="{{data.title}}" /></a>
                        </div>
                        {% endfor %}
                    </div>
                    <hr/>
                    {% if user.is_authenticated %}
                    <!-- Add Comment Start -->
                    <div class="card mt-4">
                        <h5 class="card-header">Rating with Comment</h5>
                        <div class="card-body">
                            {% for msg in messages %}
                            <p class="text-success">{{msg}}</p>
                            {% endfor %}
                            <form method="post">
                                {% csrf_token %}
                                <table class="table table-bordered">
                                    {{review_form.as_table}}
                                    <tr>
                                        <td colspan="2">
                                            <input type="submit" class="btn btn-dark" />
                                        </td>
                                    </tr>
                                </table>
                            </form>
                        </div>
                    </div>
                    <!-- Add Comment End -->
                    {% endif %}
                    <!-- List Comment Start -->
                    <div class="card mt-4 shadow">
                        <h5 class="card-header">Comments</h5>
                        <div class="card-body">
                            {% for review in reviews %}
                            <blockquote class="blockquote">
                              <p class="mb-0">{{review.review}}</p>
                              <footer class="blockquote-footer">Comment by {{review.user}} ({{review.rating}}/5)</footer>
                            </blockquote>
                            <small class="text-muted">{{review.add_time}}</small>
                            <hr/>
                            {% endfor %}
                        </div>
                    </div>
                    <!-- List Comment End -->
                </div>
            </div>
            <!-- ## End -->
            {% include 'sidebar.html' %}
        </div>

<!-- LightBox -->
<link rel="stylesheet" href="{% static 'lib/lightbox/css/lightbox.min.css' %}">
<script src="{% static 'lib/lightbox/js/lightbox.min.js' %}"></script>
{% endblock %}

I think my problem is either in my urls.py, or my settings.py but I am unsure.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source