added atlas csvs; script to get atlas.json
This commit is contained in:
parent
1afff0df5d
commit
e6e14014ac
0
chaloBEST/imports/__init__.py
Normal file
0
chaloBEST/imports/__init__.py
Normal file
21
chaloBEST/imports/import_atlas.py
Normal file
21
chaloBEST/imports/import_atlas.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from settings import PROJECT_ROOT
|
||||
from os.path import join
|
||||
import json
|
||||
import csv
|
||||
|
||||
def csvToJSON():
|
||||
atlasCSV = csv.reader(open(join(PROJECT_ROOT, "../db_csv_files/Atlas.csv"), "r"), delimiter="\t")
|
||||
atlasDict = {}
|
||||
previousRoute = None
|
||||
for a in atlasCSV:
|
||||
routeNo = a[1].strip()
|
||||
# print a
|
||||
if routeNo != '':
|
||||
atlasDict[routeNo] = [a]
|
||||
previousRoute = routeNo
|
||||
else:
|
||||
atlasDict[previousRoute].append(a)
|
||||
# print atlasDict
|
||||
jsonFile = open(join(PROJECT_ROOT, "../db_csv_files/Atlas.json"), "w")
|
||||
jsonFile.write(json.dumps(atlasDict, indent=2))
|
||||
jsonFile.close()
|
|
@ -65,7 +65,23 @@ MEDIA_URL = ''
|
|||
ADMIN_MEDIA_PREFIX = '/media/'
|
||||
|
||||
# Make this unique, and don't share it with anybody.
|
||||
SECRET_KEY = 'nx7&&v8l)%6y#$#(%g3^lo2-zt0*jk49154n_7$$%h68%32cag'
|
||||
try:
|
||||
SECRET_KEY
|
||||
except NameError:
|
||||
SECRET_FILE = os.path.join(PROJECT_ROOT, 'secret.txt')
|
||||
try:
|
||||
SECRET_KEY = open(SECRET_FILE).read().strip()
|
||||
except IOError:
|
||||
try:
|
||||
from random import choice
|
||||
SECRET_KEY = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)') for i in range(50)])
|
||||
secret = file(SECRET_FILE, 'w')
|
||||
secret.write(SECRET_KEY)
|
||||
secret.close()
|
||||
except IOError:
|
||||
Exception('Please create a %s file with random characters to generate your secret key!' % SECRET_FILE)
|
||||
|
||||
|
||||
|
||||
# List of callables that know how to import templates from various sources.
|
||||
TEMPLATE_LOADERS = (
|
||||
|
|
1768
db_csv_files/Atlas.csv
Normal file
1768
db_csv_files/Atlas.csv
Normal file
File diff suppressed because it is too large
Load Diff
57000
db_csv_files/Atlas.json
Normal file
57000
db_csv_files/Atlas.json
Normal file
File diff suppressed because it is too large
Load Diff
1614
db_csv_files/AtlasRaw.csv
Normal file
1614
db_csv_files/AtlasRaw.csv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user