On 14 Mar, 21:42, Rex <rex.eastbou...@gmail.com> wrote:
> I'd like to use a revision control system to keep up to 3 versions of
> my Django project:
...
> So far I have been planning to use Bazaar for version control.

Good choice.

> - How can I simultaneously run two versions of the same project on the
> same machine? I am primarily concerned about PYTHONPATH conflicts,
> since both projects would have the same name (unless there's an easy
> workaround).

I do it by:
- running several virtual hosts in apache
<http://httpd.apache.org/docs/2.0/vhosts/>
- they have different server names. e.g. www.mydomain.com and
staging.mydomain.com, test.mydomain.com
- and each runs the project's code from a different folder - in Bazaar
this is easy to arrange by using checkouts of various branches of your
code
<http://bazaar-vcs.org/CheckoutTutorial>

As far as I am aware [assuming you're using modpython with Apache] in
each virtual host when you tell apache:

<location "/mysite/">
    ...
    SetEnv DJANGO_SETTINGS_MODULE mysite.settings
    PythonPath "['/path/to/project'] + sys.path"
    ...
</location>

... that only adds your project to the pythonpath for that virtual
host when it runs the code in /path/to/project. So it wouldn't also be
in the pythonpath of another virtual host, or available at the command
line.

As long as the same module name isn't already on PythonPath, there
should be no problems or mysterious errors due to this.

> - Is copying a Django project to another machine/directory simply a
> matter of transferring the project's directory to the desired
> location, or does some other work have to be done first too?

Django projects, unless you do some dark magic, are simply a set of
files.

Assuming you know how Bazaar keeps track of files and changes
<http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html>
you'd only need to worry about:
- the database supporting the application
- and your settings.py file

Presumably your settings file will want to be different for the
various versions and sites of your project so version controlling that
file and updating it at each site will become a chore you won't like,
and you'll possibly forget to turn DEBUG = False on the production
site.

What I do is:
- create settings.py with all settings that won't change over all
sites, and sensible defaults for all the ones that will
- at each site, put all site-specific settings in local_settings.py
[to sit alongside settings.py], where you can override the values from
settings.py
- at the end of settings.py, tell settings.py to import local_settings
- then tell Bazaar to ignore the local_settings.py file in that
repository [bzr ignore local_settings.py]: as people will probably
make changes and commit them at several locations, you don't want
their local settings to spill into your repository

Hope that helps.

Ferg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to