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
-
@jennyjenjen :) what is your score / level ?RT @SEOHolicc: Biking directions on Google. This is awesome! http://googleblog.blogspot.com/2010/03/biking-directions-added-to-google-maps.htmlGràvès — Since that little thing over the vowels is called a "grave" I think thats how I should spell my last name now.@gmcerveny I'm up for #NSCoderNight Denver, but can't be there till after 6:30. Common Grounds?I just got the Mac Heist bundle. 7 fantastic Mac apps worth $260+ for only $20 and got 3 cool bonus apps free! http://bit.ly/heist-it
