Multisite strategy

68 visualitzacions
Ves al primer missatge no llegit

Carlo Ascani

no llegida,
22 de maig 2018, 2:31:3622/5/18
a Django users
Hi all,

I'd like to implement something like this:

One Django project to serve 3 sites:
1. `domain.com` which is the "master" site, containing just a landing page
2. `de.domain.com` which is the "German" site
3. `en.domain.com` which is the "UK" site

`de` and `en` refers the location, not the language (e.g. `de.domain.com/en/` is the German site in English)

If you go to `domain.com` you can choose the language and the country, and you are just redirected to the right place.

Is `contrib.site` suitable for that scenario?
I was thinking at 3 different sites.
If so, how can I use them locally while in development?

Any other suggestions?

Best,
Carlo


Daniel Germano Travieso

no llegida,
23 de maig 2018, 11:02:3423/5/18
a django...@googlegroups.com
Hello!
The Sites Framework is exactly what you need (and the proper internationalization/localization for the languages).
Just set up your 3 sites the Django way (creating the propper settings.py for each site)
Then you can run each site using `manage.py runserver <port> --settings <specific_settings>.py`

You can access each different site in development by going to localhost:<port>

As a suggestion, to avoid overhead in the creation of a site that is only responsible for the choice of the site and language, I would assing one of the two sites to be the default one, but the first action the user takes when accessing the site is to choose location and language, but it is a personal thing and your way can and will work fine!

Hope it helps!

[]'s
Daniel Germano Travieso
Engenharia da Computação Turma: 013
Unicamp

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b068855-78e7-4742-890d-1fc8a545b4f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Anthony Petrillo

no llegida,
24 de maig 2018, 10:39:3424/5/18
a Django users
I'm new at this Django stuff, so this is more of a question than a suggestion. I keep seeing a references to translating. I found in the manual the following: 

3.15 Internationalization and localization
3.15.1 Translation
Overview
In order to make a Django project translatable, you have to add a minimal number of hooks to your Python code and
templates. These hooks are called translation strings. They tell Django: “This text should be translated into the end
user’s language, if a translation for this text is available in that language.” It’s your responsibility to mark translatable
strings; the system can only translate strings it knows about.

So I was thinking that was an option so that I could build one site and then have translations into other languages so when the user picked a language everything will switch to that language. Is this a naive assumption?

Melvyn Sopacua

no llegida,
24 de maig 2018, 13:19:3824/5/18
a django...@googlegroups.com

On donderdag 24 mei 2018 16:39:34 CEST Anthony Petrillo wrote:

 

> So I was thinking that was an option so that I could build one site and

> then have translations into other languages so when the user picked a

> language everything will switch to that language. Is this a naive

> assumption?

 

A bit. Everything that is in the code can be translated using the gettext functionality outlined in the documention. Everything that is in the database, cannot.

 

You will need separate app for that. Which is the best fit for you, depends on a number of factors, but here are some to choose from:

 

From the Django Packages Internationalizion grid:

 

- Django Model Translation

- .... Parler

- .... Linguist

- .... Model Trans

 

> On Tuesday, May 22, 2018 at 2:31:36 AM UTC-4, Carlo Ascani wrote:

> > Hi all,

> >

> > I'd like to implement something like this:

> >

> > One Django project to serve 3 sites:

> > 1. `domain.com` which is the "master" site, containing just a landing page

> > 2. `de.domain.com` which is the "German" site

> > 3. `en.domain.com` which is the "UK" site

> >

> > `de` and `en` refers the location, not the language (e.g. `

> > de.domain.com/en/` <http://de.domain.com/en/> is the German site in

> > English)

> >

> > If you go to `domain.com` you can choose the language and the country,

> > and you are just redirected to the right place.

> >

> > Is `contrib.site` suitable for that scenario?

> > I was thinking at 3 different sites.

> > If so, how can I use them locally while in development?

> >

> > Any other suggestions?

> >

> > Best,

> > Carlo

 

 

--

Melvyn Sopacua

Anthony Petrillo

no llegida,
24 de maig 2018, 21:33:5524/5/18
a django...@googlegroups.com
Thanks Melvyn. That helps a lot.
Anthony

--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ys6oZtF1Dxg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.



--

Anthony




Carlo Ascani

no llegida,
31 de maig 2018, 4:13:4631/5/18
a django...@googlegroups.com
Il giorno mer 23 mag 2018 alle ore 17:02 Daniel Germano Travieso
<danielg...@gmail.com> ha scritto:
>
> Hello!
> The Sites Framework is exactly what you need (and the proper internationalization/localization for the languages).
> Just set up your 3 sites the Django way (creating the propper settings.py for each site)
> Then you can run each site using `manage.py runserver <port> --settings <specific_settings>.py`
>
> You can access each different site in development by going to localhost:<port>
>
> As a suggestion, to avoid overhead in the creation of a site that is only responsible for the choice of the site and language, I would assing one of the two sites to be the default one, but the first action the user takes when accessing the site is to choose location and language, but it is a personal thing and your way can and will work fine!
>
> Hope it helps!


Thank you!

Is it possible to change the current site at runtime?


>
> []'s
> Daniel Germano Travieso
> Engenharia da Computação Turma: 013
> Unicamp
>
> On Tue, May 22, 2018 at 3:31 AM, Carlo Ascani <carlo...@gmail.com> wrote:
>>
>> Hi all,
>>
>> I'd like to implement something like this:
>>
>> One Django project to serve 3 sites:
>> 1. `domain.com` which is the "master" site, containing just a landing page
>> 2. `de.domain.com` which is the "German" site
>> 3. `en.domain.com` which is the "UK" site
>>
>> `de` and `en` refers the location, not the language (e.g. `de.domain.com/en/` is the German site in English)
>>
>> If you go to `domain.com` you can choose the language and the country, and you are just redirected to the right place.
>>
>> Is `contrib.site` suitable for that scenario?
>> I was thinking at 3 different sites.
>> If so, how can I use them locally while in development?
>>
>> Any other suggestions?
>>
>> Best,
>> Carlo
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b068855-78e7-4742-890d-1fc8a545b4f4%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABF8kZM%2BD-4Cou6s0bHJC15MeXLjeEaVrLBLdDTHd5%3DG1%3DupPA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Carlo Ascani aka carloratm

http://carlo.ratm.gitlab.io
carloratm@freenode

Daniel Germano Travieso

no llegida,
4 de juny 2018, 14:13:354/6/18
a django...@googlegroups.com
Hello Carlo,

I don't see what you mean by change the current site at runtime?

If you mean change the site the user is accessing, just forward the user via the URL to the proper site you mean to reach.

Hope it helps!

[]'s
Daniel Germano Travieso
Engenharia da Computação Turma: 013
Unicamp

>> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

>> To post to this group, send email to django...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b068855-78e7-4742-890d-1fc8a545b4f4%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABF8kZM%2BD-4Cou6s0bHJC15MeXLjeEaVrLBLdDTHd5%3DG1%3DupPA%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.



--
Carlo Ascani aka carloratm

http://carlo.ratm.gitlab.io
carloratm@freenode
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Respon a tots
Respon a l'autor
Reenvia
0 missatges nous