how to get SITE_ID in django....shell 1

how to get SITE_ID in django….shell

[ ... banner ... ]
>>>
>>> from django.contrib.sites.models import Site
>>>
>>> sorted([(site.id,site.name) for site in Site.objects.all()])
[(1, u'www.lvh.me'), (2, u'example.com'), (3, u'www.example.com'),...]
>>>
>>> quit()
user$

Here is what the above code is Doing:
1. It imports the django.contrib.sites.models.Site model.
2. It creates a list of tuples containing the id and name of each site.
3. It prints the list of tuples.

Similar Posts