When I try to access admin sitename.herokuapp .com/admin , then it shows this Programming Error
Views.py file
from django.shortcuts import render
from . serializers import apiserializer
from rest_framework import viewsets
from .models import apimodel
class apiview(viewsets.ModelViewSet):
queryset = apimodel.objects.all()
serializer_class = apiserializer
API's fully works fine on localhost and I can POST & GET data even by django admin or via postman
models.py file
from django.db import models
# Create your models here.
class apimodel(models.Model):
name = models.CharField(max_length=30)
age = models.IntegerField(default=0)
city = models.CharField(max_length=20)
def __str__(self):
return self.name
admin.py file
from django.contrib import admin
from . models import apimodel
admin.site.register(apimodel)
serializers.py file
from rest_framework import serializers
from .models import apimodel
class apiserializer(serializers.ModelSerializer):
class Meta:
model = apimodel
fields = ('id', 'name', 'age', 'city')
project/urls.py file
from django.contrib import admin
from django.urls import path, include
from apiapp import urls
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('apiapp.urls'))
]
app/urls.py file
from django.urls import path, include
from . import views
from rest_framework import routers
router = routers.DefaultRouter()
router.register('api', views.apiview)
urlpatterns = [
path('', include(router.urls) )
]
I am unable to access django admin page after getting it deployed on herokuapp. I have already created superuser and also I have deployed by changing DEBUG=True and False, in both ways it didn't work.