16 Feb
2023
16 Feb
'23
6:18 a.m.
On 2/15/23 18:35, Mark Sapiro wrote:
$ django_admin shell
from django.contrib.sites.models import Site new_site = Site(id=5, domain='5.example.com', name='display_name') new_site.save()
Of course the values are up to you and you can omit the id= to have Django assign the first available..
Also note that the above is a django_admin shell interaction. You can also do this in python, but you need to precede the above with
>>> import os
>>> import sys
>>> sys.path.insert(0, '/path/to/directory/containing/settings.py')
>>> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>>> import django
>>> django.setup()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan