Very elegant solution, nginx is a great tool here and this solution should 
work just fine.  However, this is entirely achievable in django using 
django's middleware to look up an account ID and attach the account object 
to the view.  Here is a detailed article explaining how to do this. 
<https://wellfire.co/learn/multi-tennancy-in-django-using-subdomains/>

Personally I'm now going to be using the nginx solution you've linked, its 
much more robust and is likely more performant.

On Sunday, March 13, 2016 at 10:41:33 AM UTC-5, Ryne Everett wrote:
>
> I think you need to do some url rewriting outside of django. I haven't 
> looked at this solution very closely but maybe it will give you some ideas: 
> http://stackoverflow.com/questions/29938338/django-multi-tenancy.
>
> On Sun, Mar 13, 2016 at 5:06 AM, wh4n <mar...@vione.se <javascript:>> 
> wrote:
>
>> Hello guys,
>>
>> I have a problem I don't know how to solve. Mezzanine takes cares of the 
>> multi tenancy. But how can I display other content based on subdomain? For 
>> example:
>>
>> I have a site called *thomas.example.com <http://thomas.example.com>* 
>> and another site called *andrea.example.com <http://andrea.example.com>*
>>
>> I want a solution to grab with sort of a dynamic/wildcard url to display 
>> the content based on the user (the same as the domain). To demonstrate:
>>
>> url(r'(?!www)\w+', 'main.blog_urls', name='wildcard'),
>>
>> The view:
>>
>> def wildcard(request, wildcard):
>>     subcontent = Blogpost.objects.filter(user=wildcard)
>>     return render(request, 'index.html', {'subcontent': subcontent})
>>
>> I have no clue what so ever how to go further with this. 
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to mezzanine-use...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to