Version 10 (modified by 14 years ago) ( diff ) | ,
---|
Taiwan Settings
Remember to see ConfigurationGuidelines first. And here are example configuration and settings for Taiwan development and deployment.
Basic Settings
After bzr checking out the codes, first time running with python web2py.py -S eden -M
should fail, but generating eden/models/000_config.py
file. Edit eden/models/000_config.py
and remember to set FINISHED_EDITING_CONFIG_FILE = True
. Here are some recommended settings:
deployment_settings.L10n.countries = ["TW"] deployment_settings.L10n.utc_offset = "UTC +0800" deployment_settings.gis.edit_L0 = False deployment_settings.gis.edit_L1 = False deployment_settings.gis.edit_L2 = False deployment_settings.gis.edit_L3 = False deployment_settings.gis.locations_hierarchy = { "L0":T("Country"), "L1":T("Province"), "L2":T("District"), "L3":T("Town"), # "L4":T("Village"), "L5":T("Location"), # Street Address "XX":T("Imported") }
To Import Admin Names for Taiwan
Usually this is the initial and one-time work. Enter the CLI environment to run commands:
$ python web2py.py -S eden -M
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.
>>> tablename = "gis_location" >>> table = db[tablename] # Example to look for a record's id >>> db(table.name == "Taiwan").select().first().id 215 # L0 >>> db(table.name != "Taiwan").delete() # Here will show the number of deletion >>> db.commit() # L1 >>> gis.import_csv("L1.csv") >>> db.commit() # L2 >>> gis.import_csv("L2.csv") >>> db.commit() # L3 >>> gis.import_csv("L3.csv") >>> db.commit() # Example to look for records matching a name >>> db.executesql("SELECT * FROM gis_location WHERE name = '光復里' and level = 'L3'") # Here will show a list of 13 tuples. Use SELECT count(*) in the above statement to verify.
To Enable OpenID Auth
Make sure the settings in eden/models/000_config.py
is ready:
deployment_settings.auth.openid = True
Use the file at http://www.iis.sinica.edu.tw/~marr/tmp/openid_auth.py instead of original one, placed in web2py/gluon/contrib/login_methods/openid_auth.py
.
To Enable SMS Service
- Administration -> Messaging -> Global Messaging Settings -> Default Country Code: 886
- Edit Gateway Setting.
- Patch
eden/modules/s3msg.py
. - Edit
eden/cron/crontab
.
To Include Microblogging Service
Modify eden/views/rssviewer.html
:
title: 'Twitter', url: 'http://twitter.com/statuses/user_timeline/123442822.rss' title: 'Plurk', url: 'http://www.plurk.com/sahanatw.xml'
To Run with WSGI
Modify web2py/wsgihandler.py
:
import sys import os sys.stdout = sys.stderr
Attachments (4)
- L1.csv (445 bytes ) - added by 14 years ago.
- L2.csv (7.2 KB ) - added by 14 years ago.
- L3.csv (228.0 KB ) - added by 14 years ago.
- openid_auth.py (26.5 KB ) - added by 14 years ago.
Download all attachments as: .zip