Best approach for multiple sites in a single deployment?

42 views
Skip to first unread message

Bernardo

unread,
Apr 10, 2012, 7:53:46 AM4/10/12
to django...@googlegroups.com
I would like to create a subdomain based authentication system, like the one on 37signals, freshbooks, codebase, etc. The objective is to do something like smaller but in far smaller scale (I suppose a maximum of 100-1000 blogs). All other models (blog posts, comments, etc) already have a foreign key to Site. 

1. How can I allow different users to have the same username in different sites? How can I make so that when a user logs in, he logged in to a specific site (logging on blog A does not log you to blog B).

For allowing the same username in different sites I guess I'd have to write my own authentication backend and a new model for User, as I don't see how the default User model would fit. Is this a good approach? 

2. Is there anyway to make the sites framework fetch the current site based on the subdomain instead of the settings? Or am I seeing this the wrong way?

My plan was to use a single deployment for everything and use the sites framework, but as far as I've understood, the sites framework relies on the settings.SITE_ID parameter, which would be the same for a single deployment. What would be a good approach here? Creating a new settings file for each new blog?

Many thanks in advance!

Mario Gudelj

unread,
Apr 10, 2012, 10:42:10 AM4/10/12
to django...@googlegroups.com
Hey man,


Cheers,

-m


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/zQimMoWFGNUJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Juan Pablo Martínez

unread,
Apr 10, 2012, 11:14:31 AM4/10/12
to django...@googlegroups.com
Apache VirtualHost do that.

Listen 39986
NameVirtualHost *:39986
ServerLimit 2


<VirtualHost *:39986>
ServerName domain1.com
ServerAlias www.domain1.com
WSGIProcessGroup django_group1
WSGIDaemonProcess django_group1 processes=2 threads=12 python-path=/home/user/djangosite:/home/user/path/python2.7 display-name=%{GROUP}
WSGIScriptAlias / /home/user/path/domain1.wsgi
</VirtualHost>


<VirtualHost *:39986>
ServerName domain2.com
ServerAlias www.domain2.com
WSGIProcessGroup django_group2
WSGIDaemonProcess django_group2 processes=2 threads=12 python-path=/home/user/djangosite:/home/user/path/python2.7 display-name=%{GROUP}
WSGIScriptAlias / /home/user/path/domain2.wsgi
</VirtualHost>


<VirtualHost *:39986>
WSGIProcessGroup django_group3
WSGIDaemonProcess django_group3 processes=2 threads=12 python-path=/home/user/djangosite:/home/user/path/python2.7 display-name=%{GROUP}
WSGIScriptAlias / home/user/path/domain3.wsgi
</VirtualHost>
--
juanpex

Derek

unread,
Apr 11, 2012, 5:10:55 AM4/11/12
to Django users
That domain and page do not exist...

On Apr 10, 4:42 pm, Mario Gudelj <mario.gud...@gmail.com> wrote:
> Hey man,
>
> See if this helpshttp://tidbids.posterous.com/saas-with-django-and-postgresql-schemas
>
> Cheers,
>
> -m
Reply all
Reply to author
Forward
0 new messages