Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vladimirmyshkovski/0ea968a46d1fac2637b77038dd03f2fd to your computer and use it in GitHub Desktop.
Save vladimirmyshkovski/0ea968a46d1fac2637b77038dd03f2fd to your computer and use it in GitHub Desktop.
create city subdomains with django-cities-light and inda (punycode)
from cities_light.models import City
import idna
file = open('/tmp/domains.txt', 'w')
cities = City.objects.all()
for city in cities:
file.write(str(idna.encode((city.alternate_names).lower().replace(' ','-') + str('.домен.рф')))+str('\n'))
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment