| 1 | = Taiwan Settings = |
| 2 | |
| 3 | Here are example configuration and settings for Taiwan development and deployment. |
| 4 | |
| 5 | == Basic Settings == |
| 6 | |
| 7 | After bzr checking out the codes, edit eden/models/000_config.py first. Remember to set *FINISHED_EDITING_CONFIG_FILE = True*. Here are some recommended settings: |
| 8 | |
| 9 | {{{ |
| 10 | deployment_settings.L10n.countries = ["TW"] |
| 11 | deployment_settings.L10n.utc_offset = "UTC +0800" |
| 12 | deployment_settings.gis.edit_L0 = False |
| 13 | deployment_settings.gis.edit_L1 = False |
| 14 | deployment_settings.gis.edit_L2 = False |
| 15 | deployment_settings.gis.edit_L3 = False |
| 16 | deployment_settings.gis.locations_hierarchy = { |
| 17 | "L0":T("Country"), |
| 18 | "L1":T("Province"), |
| 19 | "L2":T("District"), |
| 20 | "L3":T("Town"), |
| 21 | # "L4":T("Village"), |
| 22 | "L5":T("Location"), # Street Address |
| 23 | "XX":T("Imported") |
| 24 | } |
| 25 | }}} |
| 26 | |
| 27 | == To Import Admin Names for Taiwan == |
| 28 | |
| 29 | Usually this is the initial and one-time work. Enter the CLI environment to run commands: |
| 30 | |
| 31 | {{{ |
| 32 | $ python web2py.py -S eden -M |
| 33 | }}} |
| 34 | |
| 35 | Make sure modules/s3gis.py containing utf8_csv_reader(), which is included since rev1413. Place L1.csv, L2.csv, L3.csv in the top level of web2py directory. |
| 36 | |
| 37 | {{{ |
| 38 | >>> tablename = "gis_location" |
| 39 | >>> table = db[tablename] |
| 40 | # Example to look for a record's id |
| 41 | >>> db(table.name == "Taiwan").select().first().id |
| 42 | 215 |
| 43 | # L0 |
| 44 | >>> db(table.name != "Taiwan").delete() |
| 45 | # Here will show the number of deletion |
| 46 | >>> db.commit() |
| 47 | # L1 |
| 48 | >>> gis.import_csv("L1.csv", check_duplicates=False) |
| 49 | >>> db.commit() |
| 50 | # L2 |
| 51 | >>> gis.import_csv("L2.csv", check_duplicates=False) |
| 52 | >>> db.commit() |
| 53 | # L3 |
| 54 | >>> gis.import_csv("L3.csv", check_duplicates=False) |
| 55 | >>> db.commit() |
| 56 | }}} |