Re: Customizing the settings configuration

2007-07-25 Thread Wolfram Kriesing

the mentioned  "local_config.py.default" is ONLY a template for
copying, its never really used.

wolfram

On 7/25/07, Wolfram Kriesing <[EMAIL PROTECTED]> wrote:
> we are doing the following pretty successfully:
> inside settings.py
> --
>
> import local_config
>
> DEBUG = local_config.DEBUG
> TEMPLATE_DEBUG = local_config.DEBUG
> LOG_LEVEL = local_config.LOG_LEVEL
>
> DATABASE_ENGINE = local_config.DATABASE_ENGINE
> DATABASE_NAME = local_config.DATABASE_NAME
> DATABASE_USER = local_config.DATABASE_USER
> DATABASE_PASSWORD = local_config.DATABASE_PASSWORD
> DATABASE_HOST = local_config.DATABASE_HOST
> DATABASE_PORT = local_config.DATABASE_PORT
>
>
>
> and the local_config simply lies in the same dir as the settings.py
> local_config.py
> -
>
> DATABASE_ENGINE = 'mysql'
> DATABASE_NAME = 'dbname'
> DATABASE_USER = 'root'
> DATABASE_PASSWORD = ''
> DATABASE_HOST = ''
> DATABASE_PORT = ''
> DEBUG = True
>
>
>
> the clue is, that the local_config.py is NOT under version control!
> we have a "local_config.py.default" that is under SVN, and locally you
> always copy it initially, and adapt it as needed (usually just once).
> So our deployed version always has DEBUG=false and stuff ... it pretty
> handy imho
>
> hih
>
> wolfram
>
>
>
> On 7/25/07, gorans <[EMAIL PROTECTED]> wrote:
> >
> > Thanks for the help.
> >
> > That's going to save me heaps and heaps of time.
> >
> > Thanks again.
> >
> > Goran
> >
> > On Jul 25, 10:01 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> > wrote:
> > > On 7/24/07, gorans <[EMAIL PROTECTED]> wrote:
> > >
> > >
> > >
> > > > I though that there could be a way to trick Django into reading
> > > > special development settings for me, something like having a settings
> > > > 'package' import separate settings files:
> > >
> > > No need for any special handling - just use the --settings option to
> > > manage.py, or the DJANGO_SETTINGS_MODULE environment variable.
> > >
> > > ./manage.py --settings=mysite.localsettings runserver
> > >
> > > or
> > >
> > > ./manage.py --settings=mysite.serversettings runserver
> > >
> > > If there are common elements in the two settings file, then put
> > >
> > > from mysite.commonsettings import *
> > >
> > > at the top of your localsettings/serversettings file. This will pull
> > > in all the settings from the common settings file.
> > >
> > > If putting your settings files into a package will make organization
> > > easier, go right ahead - just remember to put the extra path into your
> > > --settings. e.g.:
> > >
> > > ./manage.py --settings=mysite.settings.serversettings runserver
> > >
> > > Yours,
> > > Russ Magee %-)
> >
> >
> > > >
> >
>
>
> --
> cu
>
> Wolfram
>


-- 
cu

Wolfram

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the settings configuration

2007-07-25 Thread Wolfram Kriesing

we are doing the following pretty successfully:
inside settings.py
--

import local_config

DEBUG = local_config.DEBUG
TEMPLATE_DEBUG = local_config.DEBUG
LOG_LEVEL = local_config.LOG_LEVEL

DATABASE_ENGINE = local_config.DATABASE_ENGINE
DATABASE_NAME = local_config.DATABASE_NAME
DATABASE_USER = local_config.DATABASE_USER
DATABASE_PASSWORD = local_config.DATABASE_PASSWORD
DATABASE_HOST = local_config.DATABASE_HOST
DATABASE_PORT = local_config.DATABASE_PORT



and the local_config simply lies in the same dir as the settings.py
local_config.py
-

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'dbname'
DATABASE_USER = 'root'
DATABASE_PASSWORD = ''
DATABASE_HOST = ''
DATABASE_PORT = ''
DEBUG = True



the clue is, that the local_config.py is NOT under version control!
we have a "local_config.py.default" that is under SVN, and locally you
always copy it initially, and adapt it as needed (usually just once).
So our deployed version always has DEBUG=false and stuff ... it pretty
handy imho

hih

wolfram



On 7/25/07, gorans <[EMAIL PROTECTED]> wrote:
>
> Thanks for the help.
>
> That's going to save me heaps and heaps of time.
>
> Thanks again.
>
> Goran
>
> On Jul 25, 10:01 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
> wrote:
> > On 7/24/07, gorans <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > I though that there could be a way to trick Django into reading
> > > special development settings for me, something like having a settings
> > > 'package' import separate settings files:
> >
> > No need for any special handling - just use the --settings option to
> > manage.py, or the DJANGO_SETTINGS_MODULE environment variable.
> >
> > ./manage.py --settings=mysite.localsettings runserver
> >
> > or
> >
> > ./manage.py --settings=mysite.serversettings runserver
> >
> > If there are common elements in the two settings file, then put
> >
> > from mysite.commonsettings import *
> >
> > at the top of your localsettings/serversettings file. This will pull
> > in all the settings from the common settings file.
> >
> > If putting your settings files into a package will make organization
> > easier, go right ahead - just remember to put the extra path into your
> > --settings. e.g.:
> >
> > ./manage.py --settings=mysite.settings.serversettings runserver
> >
> > Yours,
> > Russ Magee %-)
>
>
> >
>


-- 
cu

Wolfram

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the settings configuration

2007-07-24 Thread gorans

Thanks for the help.

That's going to save me heaps and heaps of time.

Thanks again.

Goran

On Jul 25, 10:01 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 7/24/07, gorans <[EMAIL PROTECTED]> wrote:
>
>
>
> > I though that there could be a way to trick Django into reading
> > special development settings for me, something like having a settings
> > 'package' import separate settings files:
>
> No need for any special handling - just use the --settings option to
> manage.py, or the DJANGO_SETTINGS_MODULE environment variable.
>
> ./manage.py --settings=mysite.localsettings runserver
>
> or
>
> ./manage.py --settings=mysite.serversettings runserver
>
> If there are common elements in the two settings file, then put
>
> from mysite.commonsettings import *
>
> at the top of your localsettings/serversettings file. This will pull
> in all the settings from the common settings file.
>
> If putting your settings files into a package will make organization
> easier, go right ahead - just remember to put the extra path into your
> --settings. e.g.:
>
> ./manage.py --settings=mysite.settings.serversettings runserver
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the settings configuration

2007-07-24 Thread Russell Keith-Magee

On 7/24/07, gorans <[EMAIL PROTECTED]> wrote:
>
> I though that there could be a way to trick Django into reading
> special development settings for me, something like having a settings
> 'package' import separate settings files:

No need for any special handling - just use the --settings option to
manage.py, or the DJANGO_SETTINGS_MODULE environment variable.

./manage.py --settings=mysite.localsettings runserver

or

./manage.py --settings=mysite.serversettings runserver

If there are common elements in the two settings file, then put

from mysite.commonsettings import *

at the top of your localsettings/serversettings file. This will pull
in all the settings from the common settings file.

If putting your settings files into a package will make organization
easier, go right ahead - just remember to put the extra path into your
--settings. e.g.:

./manage.py --settings=mysite.settings.serversettings runserver

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Customizing the settings configuration

2007-07-24 Thread Shawn Allen

One solution is to add an extra import at the bottom of your  
settings.py:

try:
 from localsettings import *
except ImportError:
 pass

Then put localsettings.py in your svn:ignore, and override whatever  
settings you need to on a per-installation basis.

On Jul 24, 2007, at 8:41 AM, gorans wrote:
> I develop Django sites on my mac and then publish them to another web
> server. In between, they live in a happy SVN repository on my
> development server.
>
> Each time I make a change to the project's settings.py I have to then
> go over and modify the live file version (in respect to the database
> type / name, media directory etc.)
>
> I though that there could be a way to trick Django into reading
> special development settings for me, something like having a settings
> 'package' import separate settings files:
>
> e.g.
>
> myproject/
>
> manage.py
> ...
> settings/
> __init__.py
> coresettings.py
> localsettings.py
>
> so that we use the variable from coresettings first, and then try:
> import localsettings and if successful use those subsequent values.
>
> That way, I can have an un-versioned localsettings.py living on my
> mac, whilst keeping the live settings intact. Additionally, other
> developers on the project can do the same!
>
> Is this possible? (I'm sure it is but my Python just isn't good enough
> to know how to import all the variables from each module)
>
> Can anyone please give me directions / pointers as to how to do this?
> Or alternatively, how you deal with this task.
>
> Your help is very very much appreciated
>
> cheers
>
> Goran
>
>
> >


--~--~-~--~~~---~--~~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---