Reputation: 4383
I have a Django project where the company will have a main site like www.ourcompany.org and a bunch of sub-domains like project.ourcompany.org. Content appearing in the sub-domains like case studies should also appear in the main site. I've decided to use multiple instances of Django BUT one database for each sub-domain so that I can have some flexibility and take advantage of the Sites framework. What I'm not sure of is how to access the models across the multiple instances. If I have a model:
class CaseStudy(models.Model):
title=models.CharField(max_length=100)
site=models.ManyToMany(Site)
Do I need to create this model in every instance so that I can have access to the object?
Upvotes: 1
Views: 1522
Reputation: 42717
I'll just assume you have good reasons for having separate django instances rather than doing smart URL parsing in a single django project, since that seems easier to me. But I can see reasons to do it the hard way too.
Please don't copy the model code into each of your projects -- that way leads to madness. Instead, put the models that you want to share into a common directory and make sure it's included your PYTHONPATH environment variable so each instance can find it.
Upvotes: 1