Last active
          June 24, 2017 08:15 
        
      - 
      
- 
        Save vladimirmyshkovski/0ea968a46d1fac2637b77038dd03f2fd to your computer and use it in GitHub Desktop. 
    create city subdomains with django-cities-light and inda (punycode)
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 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