You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs.

1,371 views
Skip to first unread message

Priyanka Sivaratri

unread,
Nov 9, 2022, 10:28:19 AM11/9/22
to Django users
Hi,
I am new to django and I appreciate your quick help. I am able to run django server on localhost:8000 but I am seeing this error :
You are seeing this page because DEBUG=True is in your settings file and you have not configured any URLs.
urls.py:

from django.contrib import admin
from django.urls import path, include
from django.conf.urls import url
from server.views import *


urlpatterns = [
    path('admin/', admin.site.urls),
    #path('', ReactView.as_view(),name="anything"),
    #path('', include('server.urls')),
]

Settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'server',
    'rest_framework',
    'corsheaders',
]

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

views.py:
from django.shortcuts import render
from rest_framework.views import APIView
from . models import *
from rest_framework.response import Response
from . serializer import *
# Create your views here.


class ReactView(APIView):

    serializer_class = ReactSerializer

    def index(request):
        return render(request,'templates/meetups/index.html')

    def get(self, request):
        output = [{"employee": output.employee, "department": output.department}
                  for output in React.objects.all()]
        return Response(output)

    def post(self, request):

        serializer = ReactSerializer(data=request.data)
        if serializer.is_valid(raise_exception=True):
            serializer.save()
            return Response(serializer.data)

models.py:

from django.db import models

# Create your models here.
class React(models.Model):
  employee = models.CharField(max_length=30)
  department = models.CharField(max_length=200)
def __str__(self):
    return self.employee

Kasper Laudrup

unread,
Nov 9, 2022, 12:26:43 PM11/9/22
to django...@googlegroups.com
On 09/11/2022 10.52, Priyanka Sivaratri wrote:
> Hi,
> I am new to django and I appreciate your quick help. I am able to run
> django server on localhost:8000 but I am seeing this error :
> *You are seeing this page because DEBUG=True is in your settings file
> and you have not configured any URLs.*

The error message tells you exactly what is wrong. If you don't
understand it I highly suggest you follow the official Django tutorial
before going any further:

https://docs.djangoproject.com/en/4.1/intro/

After that it should be much clearer what is wrong with your URL
configuration.

Kind regards,
Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Chukwudi Onwusa

unread,
Nov 9, 2022, 3:36:25 PM11/9/22
to django...@googlegroups.com
Please What exactly is the name of your error?
Is it showing 'page not found' ?
If so, then kindly apply the urls to your localhost:8000/urls_name
Regards...

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/84b0068d-2441-ad9f-aa6e-dfea764b51fa%40stacktrace.dk.
Reply all
Reply to author
Forward
0 new messages