Another common technique is to use the local_settings.py way, like so:

# local_settings.py can be used to override environment-specific
settings
# like database and email that differ between development and
production.
try:
    from settings_local import *
except ImportError:
    pass

---

(Note: I call my settings_local.py so it shows up next to settings.py
when sorted alphabetically)

The above code should be the last thing in your settings.py. What it
does is look for a another settings file settings_local.py in this
case, and uses them as overrides to default settings in your normal
settings.py.

This way you can override settings locally.  What we do is don't check
in the settings_local.py into your source control (as that is per
developer), but check in a settings_production.py (or other
settings_*.py) file. Then when we deploy we just copy over
settings_production.py into settings_local.py.

On Mar 14, 8:40 pm, Robert Mela <rm...@rcn.com> wrote:
> We load custom environments at startup based on directory from which the
> app is loaded.   The selection could just as easily be based on
> environment variable, machine name rather than directory path.
>
> The simple trick is to have settings.py serve as a proxy for those
> other, environment-specific settings files.   Values from those settings
> files are imported into the main settings.py file.
>
> In settings.py:
>
>     env_config = get_my_settings_module_name() # we have a function that
>     looks at the path
>                                                # of current settings
>     file, and picks an appropriate
>                                                # environment-specific
>     settings file.
>                                                #
>                                                # Our environments are
>     path-based...
>                                                # /home/user or
>     /Users/user for a developer,
>                                                # /our/deploy/path/dev or
>     /our/deploy/path/prod for
>                                                # deployed apps.
>                                                #
>                                                # You could just as
>     easily key off of an environment
>                                                # variable, etc.
>                                                #
>                                                # This works with both
>     Django's dev WSGI server
>                                                # and mod_wsgi
>
>     exec("from %s import *" % env_config)      # imports everything from
>     your env-specific settings file
>                                                # into main settings.py
>     for the project.
>
>
>
> chiranjeevi muttoju wrote:
> > we have two applications, what we want to do is, one app should run at
> > one address and other app should run at different address. this is my
> > requirement. is it possible to put those two apps in the same
> > project...?(different apps but same project, we sud be able to run
> > both apps separately with the different settings.)
>
> > On Mon, Mar 8, 2010 at 3:39 PM, Atamert Ölçgen <mu...@muhuk.com
> > <mailto:mu...@muhuk.com>> wrote:
>
> >     On Monday 08 March 2010 09:06:05 chiranjeevi muttoju wrote:
> >     > Hi friends,
> >     > i have two apps in my project, and i want to use two different
> >     settings for
> >     > each app. it means same project but i sud run those two apps
> >     separately. is
> >     > it possible..? if anyone of u guys know please reply me. And if
> >     u want any
> >     > further information regarding this post please ask me.
> >     No. But if you tell us which settings you want different and why,
> >     someone
> >     might offer an alternative solution.
>
> >     --
> >     Saygılarımla,
> >     Atamert Ölçgen
>
> >      -+-
> >      --+
> >      +++
>
> >    www.muhuk.com<http://www.muhuk.com>
> >     mu...@jabber.org <mailto:mu...@jabber.org>
>
> >     --
> >     You received this message because you are subscribed to the Google
> >     Groups "Django users" group.
> >     To post to this group, send email to django-users@googlegroups.com
> >     <mailto:django-users@googlegroups.com>.
> >     To unsubscribe from this group, send email to
> >     django-users+unsubscr...@googlegroups.com
> >     <mailto:django-users%2bunsubscr...@googlegroups.com>.
> >     For more options, visit this group at
> >    http://groups.google.com/group/django-users?hl=en.
>
> > --
> > Thanks & Regards,
> > Chiranjeevi.Muttoju
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
>
>
>  rmela.vcf
> < 1KViewDownload

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to