Decrease code redundancy without breaking references

bmalinova at bmalinova at
Sun Oct 12 04:28:15 CEST 2008

My settings file
from global_settings import *

SITE_FOLDER   = 'mypipe'
SITE_DOMAIN   = 'localhost'
SITE_NAME     = 'My Pipe'
SITE_ID       = 1

TEMPLATE_DIRS = ("/clients/"+SITE_FOLDER+"/templates", "/packages/apps/
MEDIA_FILES_PREFIX = 'http://'+SITE_DOMAIN+'/media/'
VIDEO_FILES_URL = 'http://'+SITE_DOMAIN+'/video/'
VIDEO_FILES_ROOT = '/clients/'+SITE_FOLDER+'/video'

The  first 4 settings are unique to every setting file.

The last 4 lines (TEMPLATE_DIRS - MEDIA_ROOT) are always based on the
SITE_FOLDER  and SITE_DOMAIN and are the same in all my config files.

How can I separate the last 4 lines repetitive lines (I need to DRY
the code)?


More information about the Python-list mailing list