Hi,

2010/3/19 dalore <dalo...@gmail.com>

> Because of this thread I decided to release a little app we have been
> using internally. It's a straightforward way to modify the default
> site object.
>
> More details: http://oppian.com/labs/django-defaultsite/
>
> Any comments/suggestions welcome.
>

I've just got to this thread and I'm using a little bit different approach
(attached) - update when needed, not only when the Site model gets created.
I also have a little app (called "common") to handle this task.

Regards,
Oldrich.


>
> Sincerely
> Matthew Jacobi
> Oppian Systems Ltd
>
> On Mar 12, 9:39 pm, aditya <bluemangrou...@gmail.com> wrote:
> > Description
> > =========
> > This page of the Django documentation shows how to use the 'Sites'
> > framework to get the domain of the current site:
> >
> > http://docs.djangoproject.com/en/dev/ref/contrib/sites/
> >
> > I've noticed that 'domain = Site.objects.get_current().domain' is
> > becoming a common idiom in Django. Most recently I've seen it being
> > used in django-disqus as a way to get the url of the current site
> > (Disqus tracks comments by associating each comment with a specific
> > url). I'm also seeing it being used for RSS feeds and for mailers.
> >
> > The trouble is, there is no straightforward way to configure the name
> > and domain of a site.
> > Currently, Django uses "example.com" for both the domain and the
> > name.  The only way to change that is to wade into the actual
> > database. I'd like to propose adding two optional variables to
> > settings.py:
> >
> > SITE_DOMAIN and
> > SITE_NAME.
> >
> > If either of these are defined, they will override "example.com" when
> > the new site is created.
> >
> > Implementation
> > ============
> >
> > This is quite easy to implement. In the create_default_site function,
> > add these 5 lines:
> >
> >         from django.conf import settings
> >         try: def_domain = settings.SITE_DOMAIN
> >         except: def_domain = "example.com"
> >         try: def_name = settings.SITE_NAME
> >         except: def_name = "example.com"
> >
> > and then create the new site using:
> >         s = Site(domain=def_domain, name=def_name)
> >
> > I hope this is the correct place to post this! I wanted to hear what
> > other people thought of this proposal.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers" group.
> To post to this group, send email to django-develop...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-developers+unsubscr...@googlegroups.com<django-developers%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-developers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Attachment: management.py
Description: Binary data

Reply via email to