I don't know what web server you intend to use, but could you not handle the problem at this level by using URL rewriting? It shouldn't be hard to write a rule[1] to map http://myuser.mydomain.com/* to http://www.mydomain.com/user/myuser/*. Once you've done this, you can use standard a Django URLConf and not worry about what the actual domain name is :)
HTH,
-Andy
[1]: There's an example of what is essentially this rule for Apache here: http://muffinresearch.co.uk/archives/2006/08/20/redirecting-subdomains-to-directories-in-apache/
Tim Sawyer
29 December 2010 17:58
I did this with one settings.py per subdomain, using the sites framework. So each settings.py had a different SITE_ID.
Here's how to limit admin to a given user's records:
http://drumcoder.co.uk/blog/2010/oct/02/user-specific-data-admin/
This helps with droplists in admin:
http://drumcoder.co.uk/blog/2010/oct/02/limiting-records-django-admin/
The above posts also show how to use a manager to limit the records, so you can do
Blog.objects.all() to get all records across all sites, and
Blog.on_site.all() to get the records only for the current site.
Hope that helps,
Tim.
Parra
23 December 2010 04:29
Hello,
I'm new to Django and thinking of using it for a project.
In this project, there will be accounts and each account will have a
subdomain.
Based on the subdomain/account, the user will just see the records
that belongs to them.
The tables will be unique for all accounts, so there should be a field
to identify the account/records....
I think this is maybe a common task and that there is a "right" way to
do this...
Can someone give me some tips on where to get started with this ??
Thanks,
Marcello
No comments:
Post a Comment