Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:37:48+00:00 2026-05-28T01:37:48+00:00

I am using Django 1.3 with mod_wsgi In my settings.py DISABLE_SYSTEM = False DISABLE_USER_INTERFACE

  • 0

I am using Django 1.3 with mod_wsgi

In my settings.py

DISABLE_SYSTEM = False
DISABLE_USER_INTERFACE = False
MIDDLEWARE_CLASSES = [
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
]
if DISABLE_SYSTEM:
    MIDDLEWARE_CLASSES.insert(0, 'SomeMiddleware')
if DISABLE_USER_INTERFACE:
    MIDDLEWARE_CLASSES.append('SomeOtherMiddleware')

When i set DISABLE_SYSTEM to True, SomeMiddleware‘s process_request function returns a warning message with HttpResponse and following Middewares do not run at all. That gives me a kind of System shutdown for maintenance

DISABLE_USER_INTERFACE filters request and any view function called by a user is blocked, while admin urls and management functions runs normally.

Up to now, i used this for maintenance of different kinds, and i simply change it from the file and touch wsgi to re-reload python modules. But now, i need to use a kind of scheduled routine to stop user based requests and do some maintanance on the background and some from admin.

At this point, i system (but not user) needs to set DISABLE_USER_INTERFACE to True from settings.py and start maintenance. But i could not find porper way to do it or a better way to handle this not from settings.py but somewhere else.

Lines in settings py than changes DISABLE_USER_INTERFACE is because i need to use this function once per day and using these two middleware for each request do not seem logical to me. So in my current model, they run only when they are needed to be run

Any suggestions will be appreciated.

UPDATE: What i want to do is disabling user interface during 19:00 – 19:30 everyday. I am not sure about making a middleware level check like:

if 19:00<now()<19:30:
    stop system

for every request. I need something more efficient that avoids unnecessary process. Or is middleware the right choice for that kind of works?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:37:49+00:00Added an answer on May 28, 2026 at 1:37 am

    When you have scheduled changes to your settings, you might want to reconsider what you’re doing.

    Your Middleware can be much, much smarter. This makes it possible for your settings to be much, much dumber.

    I would strongly suggest that you have one SomeMiddleware class which is always installed.

    That SomeMiddleware class can then check the settings and decide which behavior it should perform.

    There are still better ways to do this.

    You don’t necessarily need to revise the settings for the scheduled maintenance. You have lots and lots of ways of communicating with your middleware in a running Django application. One of the fastest is through the database.

    You have can an “operating mode” class definition with one (or a few) attributes which are simply fetched by the middleware to see what’s going on. You can write your admin apps to do a simple Update on this table to change the mode.

    You can have an “operating mode” file names which (if present) change the middleware’s behavior. You need only do os.path.exists() kind functions to check (quickly) what to do.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm deploying my Django app to another host/server using mod_wsgi and MySQLdb. Right now,
Using django comments framework http://docs.djangoproject.com/en/dev/ref/contrib/comments/ Not sure is there option, to make all comments
I'm using nginx as a reverse proxy to apache/mod_wsgi and Django. Currently everything is
I want to deploy my django app using apache + mod_wsgi again. I seem
I'm using mod_wsgi/apache2/django for deployment. In my virtualhost file i don't set a documentroot.
I'm using virtual env with mod_wsgi and django. I set my virtual env at
I am using django 1.1.4 and python 2.6.6 with mod_wsgi to build a website
I'm using Django 1.3 on an Apache server and mod_wsgi(daemon mode), with Nginx for
I finished the tutorial on Django's site about using mod_wsgi ( here ), and
I am using mod-wsgi with django, and in django I use pylucene to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.