|
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: |
|
|
28 |
data_path = os.path.abspath(os.path.join(os.path.basename(__file__),'../../../../data')) |
|
|
29 |
else: |
|
|
30 |
data_path = args[0] |
|
|
31 |
|
|
|
32 |
call_command('migrate') |
|
|
33 |
if options.get('categories', False): |
|
|
34 |
call_command('query_wikipedia_category') |
|
|
35 |
|
|
|
36 |
call_command('query_dbpedia') |
|
|
37 |
call_command('fill_tag_years') |
|
152
|
38 |
call_command('query_geo_inclusion') |
|
135
|
39 |
call_command('import_insee_csv', os.path.join(data_path,'villes.csv')) |
|
|
40 |
call_command('import_insee_csv', os.path.join(data_path,'additional_cities.csv')) |
|
152
|
41 |
call_command('import_hda_insee_csv', os.path.join(data_path,'HDA_Insee.csv')) |
|
135
|
42 |
|
|
|
43 |
|