Skip to content

Instantly share code, notes, and snippets.

@conniec
Created February 3, 2012 23:05
Show Gist options
  • Save conniec/1733551 to your computer and use it in GitHub Desktop.
Save conniec/1733551 to your computer and use it in GitHub Desktop.
add sites to a custom domain
from lfcore.domain.api import DomainAPI
#Change the subdomain name and filename of sites
#Filename of sites should be list of sites, one on each line
subdomain = 'fisher-1'
sitefile = open("/tmp/list.txt", 'r')
d = Domain.objects.get(name='rooms.%s.fyre.co' % subdomain)
print "Domain: "+str(d)
print "Subdomain: "+subdomain+'\n'
url = sitefile.readline().rstrip('\n')
i = 0
while url:
print 'Adding site... '+url
url = sitefile.readline().rstrip('\n')
s = DomainAPI.create_site(Site(url = url, domain = d, owner = d.owner))
print "\nCreated site, URL: %s\n site id: %s\n site key: %s\n" % (s.url, s.id, s.api_secret)
i += 1
print "\n Total sites: "+str(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment