Reputation: 46208
I am creating a small commercial web project running Apache/WSGI/Django/MySQL.
I have a development and a production environment and use git and fabric to push/pull modifications.
Now I'd like to be able to test new versions with similar conditions to the production server before making them live.
Upvotes: 1
Views: 201
Reputation: 7701
I am working on a similar setup to the one you describe with no major problems. Multiple databases are easily managed in the settings file, I change them based on the root dir name:
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
if ROOTDIR.startswith("dev_"):
# -------- Developing settings ---------
DOMAIN_NAME = 'dev.foo.com'
DATABASES = {
'default':{
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'development_db',
'USER': 'xxxx',
'PASSWORD': 'xxxxx',
'HOST': 'localhost',
'PORT': '',
'OPTIONS': {'autocommit': True,}
}
}
elif ROOTDIR.startswith("production_"):
# --------- Production settings --------
DEBUG = False
DOMAIN_NAME = 'production.foo.com'
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default':{
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'production_db',
'USER': 'xxx',
'PASSWORD': 'xxx',
'HOST': 'localhost',
'PORT': '',
'OPTIONS': {'autocommit': True,}
}
}
else:
# ....
Upvotes: 2
Reputation: 70
What you could do is set up the server so each site runs in its own virtualenv http://pypi.python.org/pypi/virtualenv this can work together with apache and wsgi.
See here for example http://www.foxhop.net/django-virtualenv-apache-mod_wsgi (this is with mod_wsgi however)
this way you have full controll of packages installed in each virtualenv
Upvotes: 1