Using Django with a small team
Published Mon Jan 09th 2006 in DjangoUp until recently I have been working on Django based projects all by myself. In last few weeks I have been working with with a designer who does the templates and graphics while I handle the modeling, python and other admin stuff (svn, mysql).
At first things were a little tricky because of our different environments and our constantly having to change the settings.py and urls.py according to each individual machine. You can imagine that this didn't work well with svn because changing the DATABASE_USER param was not really a change that needed to be commited, yet a change to the INSTALLED_APPS does need to be commited. Because the urls and settings files are just python files I can create individual files for each machine that imports all the settings from the 'global' file. For example if Tom has his database names 'coolProject' and Harry has his database set as Cool_Project then we create 2 new files: settingsTom.pyfrom settings import *
DATABASE_NAME = 'coolProject'
DATABASE_USER = 'Tom'
DATABASE_PASSWORD = 'password'
DATABASE_HOST = ''
DATABASE_PORT = ''
ROOT_URLCONF = 'myproject.urlsTom'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
"/Users/tom/python/myproject/templates",
)
MEDIA_ROOT = '/Users/tom/python/myproject/site_media/'
MEDIA_URL = 'http://127.0.0.1:8000/site_media/'
from settings import *
DATABASE_NAME = 'cool_project'
DATABASE_USER = 'Harry'
DATABASE_PASSWORD = 'password'
DATABASE_HOST = ''
DATABASE_PORT = ''
ROOT_URLCONF = 'myproject.urlsHarry'
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates".
"/Users/harry/workspace/myproject/templates",
)
MEDIA_ROOT = '/Users/harry/python/myproject/site_media/'
MEDIA_URL = 'http://192.168.0.1:8000/site_media/'
from django.conf.urls.defaults import *
from impactsports.urls import *
oldpatterns = urlpatterns
urlpatterns = patterns('',
(r'^impact_media/(?P.*)$', 'django.views.static.serve',
{'document_root': '/home/tom/python/myproject/site_media', 'show_indexes': True}),
)
for pattern in oldpatterns:
urlpatterns.append(pattern)
Latest
Xbox Live Gamercard
-
Develop Denver @dvlpdnvr looks cool. http://t.co/hX3GVEUkSnow covered skylights give the @doubleencore office a weird glow this morning. (at @doubleencore) [pic] — http://t.co/YaUzBsOkToday @doubleencore I.. Shipped an app Setup our 5th build server Played a game Played with TV & Airplay Now hiring http://t.co/I9UPTNu3Terminal has an icon with white text on a dark bkgrnd. The default Terminal window is black text on a white bkgrnd Why? http://t.co/AyJDZZK7What ever happened to Burnout Crash for iOS. http://t.co/OjKCdJ8r Wasn't that supposed to be out last year?I spent some time today sitting at my desk playing video games. Because it's my job :)DESCENDENTS (at Fillmore Auditorium) — http://t.co/CMoFYGQ4I just earned the 'I Believe in IPA! (Level 2)' badge on @untappd from Hoptopia! http://t.co/2Xzkbhx2 #ibelieveinIPASuck it Carl! (with Nick at Yazoo BBQ Company) [pic] — http://t.co/Dk7qV8i9
