On Monday, March 07, 2011 01:20:47 pm Cal Leeming [Simplicity Media Ltd] 
wrote:
> I wouldn't recommend using this method, I did this previously for several
> months, and quickly switched to an alternative (which I mentioned in my
> previous post).
> 
> Generally speaking, keeping anything outside of the version control is just
> not a good idea, unless it's a tmpfs, a sock dir, or autonomously managed
> data store.
> 

+1 local_settings.py

 I do advocate a `local_setting.py.tmpl` that is in vc, it contains the 
settings that are expected to change per deployment. These are empty/blank 
defaults of the settings and allow the dev to choose their own poisons, from 
db, dbinfo to paths to installed apps. (settings.py has the mandatory, cross 
install stuff that is required). But no data that shouldn't be there, isn't 
(like db info, it being the #1 item to pick on because it has (a) 
password(s)).

Currently I'm not sure where to put logging in this case, I'm using it in 
local_settings, but I'm pretty sure I'll end up with it back in settings.py 
when all is said and done.

> As for never having to type --settings, with the solution I mentioned
> before, you'd just have to prepend commands with DJANGO_ENVIRONMENT=dev or
> prod.  (e.g. DJANGO_ENVIRONMENT=dev ./manage.py shell). You can shorten the
> name if you are really lazy (DE=dev or w/e).
> 


The real kicker in using a local_settings,py is how you import it with the 
settings.py

`from local_settings import *` as your first line in settings.py, you don't 
need to worry about either env or --settings, it's just `./manage.py shell` 

K.I.S.S. is my prefered way of handling things, introducing new env vars moves 
away from simplicity and does not add much in this case. 

ftr. aliases can shorten all key strokes and has bash completion to save even 
more keystrokes in either situation.

> I really would not recommend trying to do any sort of automatic environment
> detection, this can lead to many many tears being shed. 

Agreed, except with dynamic paths, such as those based on:
        `PROJECT_PATH=os.path.abspath(os.path.dirname(__file__))` 

> The command line is
> brutal and heartless, no matter if your a newbie or a seasoned pro.
> 

Disagree, It's just doesn't try to anticipate anything and expects you to know 
what you want to do and does exactly what you tell it to do (rm/mv -i not 
withstanding). This isn't heartless or brutal, this is what should be 
expected. First lesson taught to me in programming classes.. "A computer does 
exactly what the programmer tells it to, nothing less, nothing more." 


Really, as I write this, I begining to think these issues are more opinion 
based vs any real reason (read technical reason) and what fits the developer 
and situation. 

Mike

-- 
Lightning strikes.

-- 
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 
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