Multiple sites

3 views
Skip to first unread message

LRP

unread,
Jan 27, 2008, 11:37:52 PM1/27/08
to Django users
Hello,

I'm speculating on how to replicate a site (same structure and
functionality, different url and content).

Am I correct that it would go as follows?

1) Create a new database

2) Assuming that the first site is in .../django/firstsite; make
directory .../django/secondsite

3) Copy content of .../django/firstsite into .../django/secondsite
recursively (copying all subdirectories)

4) Update settings.py with the new database name and, perhaps,
username and password

Am I on the right track? Missing anything?

Many thanks,

Lloyd



James Bennett

unread,
Jan 27, 2008, 11:45:56 PM1/27/08
to django...@googlegroups.com
A better solution:

1. Completely forget that you ever learned from any source that it
might be a good idea to have a project folder with the apps inside it;
the tutorial does that because it's simpler and easier for purposes of
introducing Django, but in real-world situations it's generally a
terrible idea. Refactor the applications so that they can happily
exist on their own as top-level modules directly on your Python path,
and change your import statements to reflect this.

2. Read the documentation on the sites framework and add relations
from your models to the Site model, and have your views retrieve only
those objects related to the Site object currently being served:
http://www.djangoproject.com/documentation/sites/

3. Set up a second settings file, and optionally a second URLConf if
you want a different URL structure, and optionally set up the
ADMIN_FOR setting so you can share a single instance of the Django
admin between sites.

4. Enjoy.


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

LRP

unread,
Jan 28, 2008, 11:52:06 AM1/28/08
to Django users
Hello,

On Jan 27, 11:45 pm, "James Bennett" <ubernost...@gmail.com> wrote:
> A better solution:

Many thanks. I will explore this approach.

Lloyd
Reply all
Reply to author
Forward
0 new messages