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 8070701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T13:29:13+00:00 2026-06-05T13:29:13+00:00

I need a way to distinguish development server in Django (run eg. by ./manage.py

  • 0

I need a way to distinguish development server in Django (run eg. by ./manage.py runserver 0.0.0.0:8000) from the one being run on Apache. In case of Apache I use WSGI daemon mode, but I would like to find some more reliable solution for detecting execution on Django’s development server.

What I currently use is similar to:

wsgi_wrapper = request.META.get('wsgi.file_wrapper')
wsgi_wrapper_path = wsgi_wrapper.__module__ if wsgi_wrapper else None

which seemingly gives wsgi_wrapper_path storing:

  • “wsgiref.util” string when run on Django’s built-in development server,
  • None when run on Apache / WSGI in daemon mode,

The problem here is I am not sure if I can rely on that check (eg. if the production/staging/development server or my localhost configuration changes). I was not able to find any documentation regarding that.

I need that check primarily because of one issue with Django’s development server: it sets request’s CONTENT_TYPE (request.META['CONTENT_TYPE']) to “text/plain” even if the HTTP request itself had no content type set (eg. it was a GET request).

Any ideas regarding Django’s development server detection (or solving issue with incorrect request content type on it) will be appreciated. Thanks.

Ps. I am basically asking this question: How can I tell whether my Django application is running on development server or not? for Django 1.4, trying to determine the solution that will be reliable enough in case configuration changes.

  • 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-06-05T13:29:14+00:00Added an answer on June 5, 2026 at 1:29 pm

    As a principle – when using a Production and Dev servers, they should have different configs – it is most common that they will use different databases, different mail settings, etc.
    So the best place to tell the kind of the server is the configuration. I can point to two most-used approaches:

    • Config file

    then in settings.py just add:

    server = config.get("SERVER_TYPE", "DEV")
    

    and have SERVER_TYPE only in the config file on PRODUCTION

    • Environment

    Set SERVER_TYPE as environment variable when running the web server. I.e. for Supervisord, running the webserver:

    environment=SERVER_TYPE=PROD
    

    or for Apache:

    SetEnv SERVER_TYPE PROD
    

    This way you will be sure that as long as you don’t mix the config files, you will always get the real server type, no matter how you start the server.
    At least that why config files are used for.

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

Sidebar

Related Questions

I need fastest way to convert files from latin1 to utf-8 in python. The
I need to distinguish between a Queens style address, from a valid ranged address,
Need to distinguish between iPhone3x and iPhone4x . Is there any way to figure
I need to distinguish 0 from 0 in Firebug console.log output. If you type
I need to distinguish two consecutive cells. Each one in a row, if they
Is there a way to distinguish the active development device with a precompiler definition.
I need to know a generic way to distinguish between a call of activity
I need to assign colours to distinguish between different items. Simple case: order rows
I need a way to store application-level data (i.e. cross user sessions) in ASP.NET.
I need a way for a single variable to represent two kinds of objects

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.