start pupulate script

parent 1ff4c785
No preview for this file type
...@@ -4,4 +4,24 @@ from django.core.management.base import BaseCommand, CommandError ...@@ -4,4 +4,24 @@ from django.core.management.base import BaseCommand, CommandError
from catalog.models import State, City from catalog.models import State, City
import json, unicodedata import json, unicodedata
# code here class Command(BaseCommand):
\ No newline at end of file
def handle(self, *args, **options):
#base path
base_path = '/home/emmanuelhp/Documentos/geojson/'
# loads files
for index in range(1,33):
with open(base_path + str(index)+'.geojson') as f:
data = json.load(f)
print "Estado: ", data['name']
# print ("============= "+ data['name'] + " ===================")
# for feature in data['features']:
# print ("NOMGEO: ", feature['properties']['NOMGEO'])
# print ("CVE_ENT: ", feature['properties']['CVE_ENT'])
# print ("CVE_MUN: ", feature['properties']['CVE_MUN'])
# print ("CVEGEO: ", feature['properties']['CVEGEO'])
# print ("coordinates: ", feature['geometry']['coordinates'])
# print ("_____________________________________________")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment