0

I went to do, when any user come my wabsite than only one url/view show him page is UnderConstruction?

I know full site UnderConstruction but don't only one page...

This is my middelware.py:

class UnderConstruction:
    def __init__(self,get_response):
        self.get_response = get_response

    def __call__(self,request, *args, **kwargs):
        response = reverse("about")
        return response

I went to show him only about view so, I provide only about views

views.py:

from .middelware import UnderConstruction
from django.utils.decorators import decorator_from_middleware

@decorator_from_middleware(UnderConstruction)
def about(request):
    return render(request, 'blog/about.html')

setting.py:

By the way my app name is blog

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',

#.......This middelware for site UnderConstruction........#
    'blog.middelware.UnderConstruction'
    
]

URLs.py:

path('base/', base, name='base'),

Error page: click here

So, I think I went to change/add in middelwaer.py file.

Dharman
  • 26,923
  • 21
  • 73
  • 125
Biswajit Paloi
  • 569
  • 1
  • 13
  • Do not undelete your question after deleting it and then replace it with a totally new question. Instead, ask a new question in the normal way, with the "Ask Question" button. – Karl Knechtel Dec 30 '21 at 14:04

0 Answers0