Version 2 (modified by martin maney, 10 years ago) (diff)

you forgot pg_dump(1)

If you have Django up and running on one system, you can easily clone it to another host if necessary. Here is an outline of a brute force procedure:

1) Set up Django on the new host with the same type of database, i.e., PostgreSQL. Get it working at least to the point where you get the initial default Django screen.

2) Stop the database server on the original host and tar the "data" subdirectory where the PostgreSQL data lives. (After you are done tarring, you can restart the original host databse.)

3) Tar up the your project area(s) (i.e., myproject), but exclude the file.

4) Tar up your template directory.

5) Tar up your media area(s) where css, images and the like reside.

6) Move these files to the new host.

7) Stop the PostgreSQL server on the new host.

8) Extract all the files from the tar files in the correct places. (Hopefully you won't get bitten by permissions problems.)

9) Edit your project file as necessary to match the set of apps and such on the cloned system.

10) Restart the PostgreSQL server on the new host and voila!

With a little script magic and/or an assist from a code management system like svn, this process can be streamlined substantially. If you need to clone a highly available system, then you need to look into commercial grade database replication software that can copy the original host database elsewhere without shutting it down.

As an alternative to throwing money at a commercial databse vendor (which one is supported by Django, anyway?), you might want to look at the man page for pg_dump(1). That would still leave a minimal bootstrap setuip of the clone database so that you had privileges to restore the dump over there. -- mjm

Back to Top