> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
It doesn't (yet) cover the best ways of integrating dev/production
servers. I'm only really getting started myself, so would welcome any
further suggestions for improvement.
Phil
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
my method (I am not a professional programmer):
1. set up my code and create a mercurial repository. Test each change on
my local machine - I use nginx+runserver.
2. once the code is working - push the changes to a repository on the
internet (I use bitbucket)
3. from the repository pull the code to the staging server for the
client to test with real data (usually this data would be taken from the
production server)
4. once the client is happy - pull the code to the production server -
usually apache+wsgi or nginx+fcgi or tornado.
5. for changes in the database tables: run manage.py sqlall and save it
as before.sql. make the changes, again run sqlall and save it as
after.sql. Create a diff between the two and massage that into a script.
Test the script on the development machine and then on the staging
server, finally do it on the production server.
5. Note: settings.py is not put under version control as this holds
sensitive information and paths differ according to the server it is on.
I create a default.settings.py which has the sensitive information
removed. That is kept under version control.
--
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS at AU-KBC
this is a better approach - much more professional (I *did* say I am an
amateur;-))
A technique I use, having picked it up from Jacob Kaplan Moss, IIRC, is
to keep settings.py under source control but have it include as its last
statement
from local_settings import *
The local_settings.py file is then maintained outside source control on
each target platform. This works very nicely, and allows you to maintain
common settings without having to edit a file that's under code control
to vary settings between platforms.
regards
Steve
--
DjangoCon US 2010 September 7-9 http://djangocon.us/
The advantage of this is that you don't need to do clever tricks in
your settings.py to update things like INSTALLED_APPS,
MIDDLEWARE_CLASSES etc.
Having said that, I still import from setting_local in all my projects.
Cheers
Tom
* This is such a misnomer - *all* your source and configuration files
should be under version control, especially local settings (I keep
mine in a separate repository, which is then externall'ed into place
in the instance's deployment repo). How else can you effectively
control change management?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
'cant encourage'? or 'can encourage'?
Others are 'cooler'. I'm not sufficiently versed in git or mercurial
to comment on whether they can handle the structures I'll describe
below..
>
> - +1 on using "settings.py" and "local_settings.py". The problem with
> keeping local settings files in the VCS is when you have multiple
> servers with different settings. You could store each file as
> local_settings_test_server.py and so on. Then you could have
> something like "settings_server_name.py" that's not in VCS, and it
> only has:
>
> SERVER_NAME = 'prod'
>
> And in your settings.py:
>
> import * from settings_server_name
>
> if SERVER_NAME == 'prod':
> import * from settings_prod_server
> elif SERVER_NAME == 'test':
> ...
> etc
>
Bit clunky isn't it? Every time you add/remove an instance of the
project, you have to update settings.py.
This is how I structure my projects in the svn repository (hope you
can all see unicode line segments!):
sample_project
├── configurations
│ ├── development-requirements.pip
│ ├── production-requirements.pip
│ ├── settings_local-app01.py
│ ├── settings_local-app02.py
│ ├── settings_local-dev-app01.py
│ └── settings_local-dev-app02.py
├── deployments
│ ├── app01
│ │ ├── logs
│ │ └── scripts
│ ├── app02
│ │ ├── logs
│ │ └── scripts
│ ├── dev-app01
│ │ ├── logs
│ │ └── scripts
│ └── dev-app02
│ ├── logs
│ └── scripts
├── scripts
│ ├── bootstrap
│ └── project
└── src
├── releases
│ ├── 1.0
│ │ └── htdocs
│ ├── 1.1
│ │ └── htdocs
│ └── 1.2
│ └── htdocs
└── trunk
└── htdocs
Each deployed instance of the project gets a folder in
sample_project/deployments. The deployment then uses svn externals to
include the parts of the project it requires:
src/<some branch> is externalled into dep/sample_project
configurations/settings_local-<instance>.py is file externalled into
dep/sample_project/settings_local.py
configurations/<one of the pip files> is file externalled into
dep/scripts/requirements.pip
scripts/{bootstrap,project} are file externalled into dep/scripts/
You end up with a structure like this:
instance
├── environ
│ ├── bin
│ ├── include
│ └── lib
├── htdocs
├── logs
├── run
├── sample_project
│ ├── __init__.py
│ ├── settings.py
│ ├── settings_local.py
│ └── urls.py
└── scripts
├── bootstrap
├── project
└── requirements.pip
The 'bootstrap' script is a simple script that sets up the virtualenv
and installs/upgrades all packages to the specification specified in
requirements.pip, using pip.
The 'project' script is a rc script for plugging into the OS's rc
infrastructure.
Every single file is tracked by VCS, every change in the project
structure is versioned and controlled for change management processes.
Changes to a production environment can be reliably tested, checked
and repeated.
New instances simply require a new settings_local-<instance>.py
created in the configuration repo, new packages can be tried in
development and it is simple and repeatable to deploy to production.
There are a number of other tools that I use to do change management
(Fabric and south mainly), but it would take too long to go into those
as well!
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> - +1 on using "settings.py" and "local_settings.py". The problem with
> keeping local settings files in the VCS is when you have multiple
> servers with different settings. You could store each file as
> local_settings_test_server.py and so on.
We use a proj.settings along the lines of:
from proj.common_settings import *
import imp
imp.load_source('proj_local_settings', '/etc/proj/settings.py')
from proj_local_settings import *
to keep our host-specific settings outside VCS on each host. A range of
more complex schemes are possible, of course.
Hi
> I understand there are many different ways and products to use to
> setup a great workflow for developing in django, but would like to
> hear how you or your startup team (or corporate dev group) does it.
> Specifics would be amazing, as I need a little hand holding, i.e.
> please cover anything and everything that I should know in order to
> develop efficiently, robustly, and eventually collaboratively.
There are common ideas like +1 South, local_settings.py, vcs and
helper scripts like fabric
> Basically, please explain it in a way that a layman can follow the
> steps and setup a workflow without pulling his hair out. =P
ok, my system
Every project has its own virtual enviroment
-virtualenv
--bin
--include
--lib
--requirements.txt
--myproject
---apps
...
---static
---templates
*All the structure and contents goes into git or vcs of choice
*pip freeze > requirements.txt and pip install -r requirements.txt
to handle the external soft installed
*in .gitignore I override bin, include, lib, src directories
Just using git and virtualenv im able to create the same enviroment
quickly in several machines (dev, testing, production)
Still working on the database exports
--
Celso Gonz�lez (PerroVerd)
http://mitago.net