| author | cavaliet |
| Thu, 26 Jun 2014 10:44:05 +0200 | |
| changeset 284 | f01235a1dcc2 |
| parent 272 | 1c774f7a0341 |
| child 443 | 27f71b0a772d |
| permissions | -rw-r--r-- |
| 135 | 1 |
# -*- coding: utf-8 -*- |
2 |
''' |
|
3 |
Created on Feb 28, 2012 |
|
4 |
||
5 |
@author: ymh |
|
6 |
''' |
|
7 |
from django.core.management.base import BaseCommand |
|
8 |
from django.core.management import call_command |
|
9 |
from optparse import make_option |
|
10 |
import os.path |
|
11 |
||
12 |
||
13 |
class Command(BaseCommand): |
|
14 |
||
15 |
args = "[<path to the data folder>]" |
|
16 |
option_list = BaseCommand.option_list + ( |
|
17 |
make_option('-c', '--categories', |
|
18 |
action='store_true', |
|
19 |
dest='categories', |
|
20 |
default=False, |
|
21 |
help='load categories in db'), |
|
22 |
) |
|
23 |
||
24 |
||
25 |
def handle(self, *args, **options): |
|
26 |
||
27 |
if len(args) == 0: |
|
| 284 | 28 |
data_path = os.path.abspath(os.path.join(os.path.abspath(__file__),'../../../../../data')) |
| 135 | 29 |
else: |
30 |
data_path = args[0] |
|
31 |
||
| 228 | 32 |
print("=========== MIGRATE ===========") |
| 230 | 33 |
call_command('syncdb', migrate=True) |
| 135 | 34 |
if options.get('categories', False): |
| 228 | 35 |
print("=========== QUERY WIKIPEDIA CATEGORY ===========") |
| 230 | 36 |
call_command('query_wikipedia_category', interactive=False, force=True) |
| 228 | 37 |
|
38 |
print("=========== QUERY DBPEDIA ===========") |
|
| 230 | 39 |
call_command('query_dbpedia', interactive=False, force=True) |
| 228 | 40 |
print("=========== FILL TAG YEAR ===========") |
| 135 | 41 |
call_command('fill_tag_years') |
| 228 | 42 |
print("=========== GEOJSON TRANSFORM ===========") |
|
227
b0cd3e6e31c7
Update readmin on hdabo -> hdalab migration and update import_hdabo_db management commend
ymh <ymh.work@gmail.com>
parents:
152
diff
changeset
|
43 |
call_command('geojson_transform', os.path.join(data_path,'countries.geo.json')) |
| 228 | 44 |
print("=========== QUERY GEO INCLUSION ===========") |
| 152 | 45 |
call_command('query_geo_inclusion') |
| 228 | 46 |
print("=========== IMPORT INSEE CSV PASS 1 ===========") |
| 135 | 47 |
call_command('import_insee_csv', os.path.join(data_path,'villes.csv')) |
| 228 | 48 |
print("=========== IMPORT INSEE CSV PASS 2 ===========") |
| 135 | 49 |
call_command('import_insee_csv', os.path.join(data_path,'additional_cities.csv')) |
| 228 | 50 |
print("=========== IMPORT HDA INSEE CSV ===========") |
| 152 | 51 |
call_command('import_hda_insee_csv', os.path.join(data_path,'HDA_Insee.csv')) |
| 228 | 52 |
print("=========== QUERY CATEGORY INCLUSION ===========") |
| 230 | 53 |
call_command('query_category_inclusion', all=True, force=True, interactive=False) |
| 135 | 54 |
|
55 |