Problem with django administration

Hello django develops, We are using django for over a year now. But for past few days we are unable to use admin part of django(Django Administation) both on localhost and production. We are using DRF.

Settings.py


STATIC_URL = '/static/'

STATIC_ROOT = os.path.join(BASE_DIR, 'static')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

project_name/urls.py


urlpatterns = [
    
    # serve static files
    url(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}), 
    url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}), 
    
    path('admin/', admin.site.urls),
]

Hello there! Looks like this is your first post, thanks for reaching out and welcome to the community.

Well, your post is not really descriptive, when you say you’re unable to use the django admin:

This doesn’t say much about any problem that you’re facing, and this may not have anything in relation with the problem

So let’s try to breakdown the problem so anyone can help.

What errors you’re seeing in the console? or
What you’re expecting to see that you’re not seeing? The reverse can also be true.

Cheers!

Hi @leandrodesouzadev , thanks for replying.

I realized I was passing incorrect app name in template OPTIONS argument in settings.py. But console was not showing any error, all APIs were working as expected but django admin was showing timeout error with https status code 304 on console. But after removing line below and reproducing error by removing and re-adding the same line a few times this worked. The problem was with line highlighted below in OPTIONS.

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'user/email_templates')],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                '**myapp**.custom_context_processors.custom_data'  // this line was causing error
            ],
        },
    },
]

Thank you,