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

  • Home
  • SEARCH
  • 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 4024156
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:41:12+00:00 2026-05-20T10:41:12+00:00

I’ve got a Django project that has multiple settings files (www site, mobile site,

  • 0

I’ve got a Django project that has multiple settings files (www site, mobile site, an API..) and I recently got around to cutting the config/deployment over to buildout. Unfortunately, the only way I can get djangorecipe to generate separate WSGI files for me is to specify each site as its own block, which creates a whole separate django lib for each one.

I suppose that’s not really a problem per se, and a workaround would be to manually create the WSGI files…but if there was a way to have that all happen by buildout instead and share the same django lib, that would be ideal.

Here’s what I have now, which creates separate Django installs:

[buildout]
parts =
    python
    web
    mobile
    <etc...>

[python]
recipe = zc.recipe.egg
eggs = <etc...>

[web]
recipe = djangorecipe
interpreter = python
version = trunk
project = proj
settings = web_settings
eggs = ${python:eggs}
wsgi = true

[mobile]
recipe = djangorecipe
interpreter = python
version = ${web:version}
project = ${web:project}
settings = mobile_settings
eggs = ${python:eggs}
wsgi = true

<etc...>
  • 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-20T10:41:13+00:00Added an answer on May 20, 2026 at 10:41 am

    Since it is not possible to set environment variable in apache config and retrieve it in wsgi script (explained in: mod-wsgi wiki) it seems that the most elegant solution is to have separate wsgi scripts.

    (There was a related discussion on SO: Django – Can't pass Environment Variable to Apache/Passenger on the WSGI Interface)

    Now if you are about to create wsgi scripts manually you will have to deal with sys.path manually. So it seems that to it is easier to have few sections of django.recipe.


    It is also possible not to use django-recipe at all. At least I prefer this because then I have full freedom to setup my wsgi/manage scripts. And it is not that hard to configure buildout in a way that it will wrap your manually written scripts into bin folder with sys.path automatically configured.

    Here is how to achieve it:

    • Create your wsgi, manage scripts manually at myproject.scrpits.* as described in django documentation. However, wrap the “active” part to a def main(): method. Then, your scripts can be used as modules.

    • Create proper setup.py script for your project. It will install scripts which you created in the first step. Entry-points part is important here:

      from distutils.core import setup
      setup(name='mygroject',
            packages=['myproject'],
            entry_points="""
            [console_scripts]
            manage = myproject.scripts.manage:main
            wsgi = mygroject.scripts.wsgi:main
            """
           )
      
    • Configure buildout. python:scripts is important here:

      [buildout]
      ...
      # Add directory where your setup.py can be found.
      # I assume that you placed your setup.py in same directory as your buildout file.
      develop=.
      
      [python]
      recipe = zc.recipe.egg:scripts
      # django is no longer instlled by django-recipe so has to be listed in eggs.
      # myproject also has to be listed here.
      eggs= ... django myproject
      # Now scripts from the setup.py:
      scripts = manage wsgi
      # fallowing will create bin/python, might be useful:
      interpreter = python
      
    • Now buildout will generate scripts in bin folder which you defined in steps 1-2.

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

Sidebar

Related Questions

No related questions found

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.