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
-
It's Alive! http://yfrog.com/0l99834563j
Add to your Queue!
Fear and Loathing in Las Vegas
Add to your Queue!
Best in Show
I got my 4th of July Rockies hat today. I still have to bend it. I'm not a flat brim kind of guy. http://hangr.me/wbzlq/
Add to your Queue!
Operation Valkyrie: The Stauffenberg Plot to Kill Hitler
@casciato I am in love with http://www.inevitablezombieapocalypse.com/ In the past week I have watched Zombie Wars and American Zombie.
