設定ファイル(000_config.py)解説
Sahanaの設定は、インストール先の modelsディレクトリ配下に存在する「000_config.py」を編集することで行います。
以下は、その設定ファイルの日本語訳です。
# -*- coding: utf-8 -*-
"""
デプロイ設定
デプロイ時に一般的に編集する設定はすべてここで行います。
通常は他のファイルを編集する必要はありません。
開発者向けの注釈:
/models/000_config.py は、BZR レポジトリにはありません。このファイルがデプロイ時に変更されるからです。
変更を trunk にコミットするには、次のファイルを編集してくだださい。
deployment-templates/models/000_config.py
"""
# このファイルを編集するように管理者に通知する
FINISHED_EDITING_CONFIG_FILE = False # このファイル編集完了後に True に変更する
if not FINISHED_EDITING_CONFIG_FILE:
raise HTTP(501, body="Please edit models/000_config.py first")
from gluon.storage import Storage
from gluon.contrib.simplejson.ordered_dict import OrderedDict
deployment_settings = s3base.S3Config(T)
# データベース設定
deployment_settings.database.db_type = "sqlite"
deployment_settings.database.host = "localhost"
deployment_settings.database.port = None # デフォルトを使用
deployment_settings.database.database = "sahana"
deployment_settings.database.username = "sahana"
deployment_settings.database.password = "password"
deployment_settings.database.pool_size = 30
# 認証設定
# この設定は、最初のユーザーを登録する「前」に行ってください。
deployment_settings.auth.hmac_key = "akeytochange"
# これらの設定は、最初のユーザー (admin) を登録した後に変更してください。
# セキュリティを高めるためです。
deployment_settings.auth.registration_requires_verification = False
deployment_settings.auth.registration_requires_approval = False
deployment_settings.auth.registration_requests_mobile_phone = True
# 今のところウィジェットはありませんが、それ以外は問題ありません。
#deployment_settings.auth.registration_requests_organisation = False
deployment_settings.auth.openid = False
# 基本設定
# インスタンスの公開 URL を設定してください。
deployment_settings.base.public_url = "http://127.0.0.1:8000"
# この値を True にすると、デバッグモードになります。
# デバッグモードでは、圧縮されていない CSS/JS ファイルが読み込まれます。
# コンソールで JS デバッグメッセージが利用できます。
# デバッグモードでは、URL に次の文字列を付与することで、個別ページを読み込みできます。
# ?debug=1
deployment_settings.base.debug = False
# パフォーマンス向上のため、プロダクションモードでは "False" にしてください。
# (テーブル定義が変更されたとき、"True" に再設定してください。)
deployment_settings.base.migrate = True
# データベースの pre-population を有効/無効にします。
# データベースの pre-populate には、最初の実行時に True にしてください。
# 手動でデータベース移行を行う場合は除きます。
# プロダクションモードでは False に設定してください。(各ページで 1x DAL ヒット節約します to save 1x DAL hit every page)
# 注: データベースが空の間は、ウェブ UI にアクセスできません。
# 代わりに、次のコマンドを実行してください。
# python web2py.py -N -S eden -M
# データベース構造を作成するには、終了した後、データを再インポートします。
deployment_settings.base.prepopulate = True
# コンテンツデリバリネットワークを使用してインターネットで公開されているサイトを高速化するには、この値を True に設定してください。
deployment_settings.base.cdn = False
# 電子メール設定
# 送信サーバOutbound server
deployment_settings.mail.server = "127.0.0.1:25"
# Windows ラップトップで有用:
#deployment_settings.mail.server = "smtp.gmail.com:587"
#deployment_settings.mail.login = "username:password"
# 送信元アドレス
deployment_settings.mail.sender = "'Sahana' "
# デフォルトのメールアドレス。新規ユーザーアカウントの承認リクエストが送信されます。
# auth_domain テーブルで特定のドメイン/組織に上書きできます。
deployment_settings.mail.approver = "useradmin@your.org"
# フロントページ設定
# RSS フィード
deployment_settings.frontpage.rss = [
{"title": "Sahana Japan Team",
# RSS Feed
"url": "https://sites.google.com/site/sahanajapanteam/activity.xml"
},
{"title": "Twitter",
# @SahanaJP
"url": "http://twitter.com/statuses/user_timeline/264612123.rss"
# Hashtag
#url: "http://twitter.com/#!/search/%23sahanajp"
}
]
# sahana について
deployment_settings.frontpage.about = [
{"text": T("For more details on the Sahana Eden system, see the")},
{"text": T("Sahana Eden Website"),
"href": "http://eden.sahanafoundation.org"},
{"text": T("For live help from the Sahana community on using this application, go to")},
{"text": T("Sahana Community Chat"),
"href": "http://eden.sahanafoundation.org/wiki/Chat"}
]
# フロントページ地図の kml
deployment_settings.frontpage.kml = [
# {"name": "shelter",
# "url": "uri/to/shelter.kml"},
# {"name": "hospital",
# "url": "uri/to/hospital.kml"}
]
# Twitter 設定
# http://twitter.com/apps で登録する
# (アプリケーションタイプは Client を選択する)
# consumer_key と consumer_secret を Twitter から受け取る
# Twitter 統合が不要なら空白のままで良い
deployment_settings.twitter.oauth_consumer_key = ""
deployment_settings.twitter.oauth_consumer_secret = ""
# ローカライズ設定
#deployment_settings.L10n.default_country_code = 1
# デプロイで使用する言語 (言語ツールバーと GIS ロケーションで使用する)
# http://www.loc.gov/standards/iso639-2/php/code_list.php
deployment_settings.L10n.languages = {
"en":T("English"),
#"el":T("Greek"),
"es":T("Spanish"),
#"fr":T("French"),
#"pa":T("Punjabi"),
#"ps":T("Pashto"),
#"sd":T("Sindhi"),
"ja":T("Japanese"),
#"ur":T("Urdu"),
"zh-tw":T("Chinese (Taiwan)"),
}
# 言語ツールバーでのデフォルト言語 (将来的には GIS ロケーションでも使用予定)
deployment_settings.L10n.default_language = "ja"
# 言語ツールバーを表示するか
deployment_settings.L10n.display_toolbar = True
# ユーザーのデフォルトタイムゾーン
deployment_settings.L10n.utc_offset = "UTC +0900"
# 人物情報の登録で使用する宗教
# @ToDo: find a better code
# http://eden.sahanafoundation.org/ticket/594
deployment_settings.L10n.religions = {
"none":T("none"),
"christian":T("Christian"),
"muslim":T("Muslim"),
"jew":T("Jew"),
"buddhist":T("Buddhist"),
"hindu":T("Hindu"),
"bahai":T("Bahai"),
"other":T("other")
}
# GIS (地図) 設定
# 数カ国でデプロイする場合はコメントを外す
# (GIS ロケーションセレクタで使用する)
deployment_settings.gis.countries = ["JP"]
# location_id を含む全てのフォームで、地図からロケーション選択するツールを提供する
deployment_settings.gis.map_selector = True
# Admin-Level ロケーションに記録されたリソースを地図に表示する Display Resources recorded to Admin-Level Locations on the map
# @ToDo: Move into gis_config?
deployment_settings.gis.display_L0 = False
# 今のところ未使用
#deployment_settings.gis.display_L1 = True
# MapAdmins 以外にも Admin ロケーション編集を許可する?
# (未設定の場合、デフォルトは True。ロケーショングループ編集権限はデフォルトは False)
deployment_settings.gis.edit_L0 = False
deployment_settings.gis.edit_L1 = True
#deployment_settings.gis.edit_L2 = True
# ロケールに関連する地図設定、例えばロケーション階層の数や名前は、gis_config にある。
# サイト全体の gis_config はここの設定が populated
deployment_settings.gis.location_hierarchy = OrderedDict([
("L0", T("Country")),
("L1", T("Province")),
("L2", T("District")),
("L3", T("Town")),
("L4", T("Village")),
#("L5", T("Neighbourhood")), # Currently not supported by testSuite
])
# 地図設定で許可する階層の最大レベル。
deployment_settings.gis.max_allowed_hierarchy_level = "L3"
# サイトのデフォルト階層が、デフォルトの最大レベルを超える場合は、
# 他の地図設定でもそのレベルを許可する。
deployment_settings.gis.max_allowed_hierarchy_level = \
max(deployment_settings.gis.max_allowed_hierarchy_level,
deployment_settings.gis.location_hierarchy.keys()
[len(deployment_settings.gis.location_hierarchy)-1])
deployment_settings.gis.default_symbology = "US"
# @ToDo: The id numbers of the projection and marker don't convey
# which they are to whoever's setting up the site. Web setup should
# deal with this.
# サイトの地図設定のデフォルト値。
deployment_settings.gis.default_config_values = Storage(
name = "Site Map Configuration",
# 地図の中央の座標
lat = "38.5",
lon = "140.6",
# ズームの初期値。大きいほど近寄る。
zoom = 8,
zoom_levels = 22,
bbox_min_size = 0.01,
bbox_inset = 0.007,
# 接近しているロケーションを一つのマーカーに重ねて表示するか?
cluster_distance = 5,
cluster_threshold = 2,
projection_id = 1,
marker_id = 1,
map_height = 600,
map_width = 1000,
# 地図全体の協会。明らかにおかしな緯度経度の値 (マイナス符号漏れ等) をフィルタリングするために使用する。
min_lon = -180,
min_lat = -90,
max_lon = 180,
max_lat = 90,
wmsbrowser_name = "Web Map Service",
wmsbrowser_url = "http://geo.eden.sahanafoundation.org/geoserver/wms?service=WMS&request=GetCapabilities",
# 階層ロケーションにリンクするロケーションは最も深い階層にリンクが必要か?
# (False は親階層等任意のレベルを許可\)
strict_hierarchy = False,
# 特定のロケーション (アドレス、ウェイポイント等) がロケーション階層にリンクされている必要がありますか?
location_parent_required = False,
region_location_id = None,
show_region_in_menu = False,
)
# マーカーの最大サイズ
# (表示時のみ有効)
deployment_settings.gis.marker_max_height = 35
deployment_settings.gis.marker_max_width = 30
# 重複機能、日付変更線を超えて表示する?Duplicate Features so that they show wrapped across the Date Line?
# 今のところはポイントのみ。Points only for now
# lon<0 have a duplicate at lon+360
# lon>0 have a duplicate at lon-360
deployment_settings.gis.duplicate_features = False
# マウスカーソルの位置: 'normal', 'mgrs' or 'off'
deployment_settings.gis.mouse_position = "normal"
# 印刷サービス URL: http://eden.sahanafoundation.org/wiki/BluePrintGISPrinting
#deployment_settings.gis.print_service = "/geoserver/pdf/"
# 空間データベースが利用可能か? (現在未使用。PostGIS と Spatialite をサポート予定)
deployment_settings.gis.spatialdb = False
# GeoServer (現在は GeoExplorer で使用。GeoServer の REST コントロールを許可予定)
# クライアント JS からクエリできるように公開 URL が必要
#deployment_settings.gis.geoserver_url = "http://localhost/geoserver"
#deployment_settings.gis.geoserver_username = "admin"
#deployment_settings.gis.geoserver_password = "password"
# OpenStreetMap 設定
# www.openstreetmap.org にログインし、'oauth settings' を選択して登録する
deployment_settings.osm.oauth_consumer_key = ""
deployment_settings.osm.oauth_consumer_secret = ""
# セキュリティポリシー設定
# 地図編集へのロックダウンアクセスLock-down access to Map Editing
#deployment_settings.security.map = True
# セキュリティポリシー (でフォルトは 1 = Simple)
# http://eden.sahanafoundation.org/wiki/S3AAA#System-widePolicy
deployment_settings.security.policy = 4 # Function-ACLs
# ユーザーは自分自身を登録できる?
deployment_settings.security.self_registration = True
# 'soft' 削除を使用する
deployment_settings.security.archive_not_delete = True
# AAA 設定
acl = deployment_settings.aaa.acl
deployment_settings.aaa.default_acl = acl.READ # ログインしていない場合
deployment_settings.aaa.default_uacl = acl.READ # ログイン中
deployment_settings.aaa.default_oacl = acl.CREATE | acl.READ | acl.UPDATE # オーナーでログイン中
deployment_settings.aaa.has_staff_permissions = True
deployment_settings.aaa.staff_acl = acl.CREATE | acl.READ | acl.UPDATE
deployment_settings.aaa.supervisor_acl = acl.ALL
# Audit settings
# We Audit if either the Global or Module asks us to
# (ignore gracefully if module author hasn't implemented this)
# NB Auditing (especially Reads) slows system down & consumes diskspace
#deployment_settings.security.audit_write = False
#deployment_settings.security.audit_read = False
# UI/Workflow options
# Should user be prompted to save before navigating away?
#deployment_settings.ui.navigate_away_confirm = False
# Should potentially large dropdowns be turned into autocompletes?
# (unused currently)
#deployment_settings.ui.autocomplete = True
# 支援要請Request
#支援要請Requestのステータスを、コミットや配送から自動設定するのではなく、手動設定できるようにする。
deployment_settings.req.status_writable = True
# 内部支援要請Support Requestsを使用する?
#deployment_settings.options.support_requests = True
# Comment/uncomment modules here to disable/enable them
# Modules menu is defined in 01_menu.py で定義されている
deployment_settings.modules = OrderedDict([
("default", Storage(
name_nice = T("Home"),
restricted = False, # このモジュールのアクセスコントロールに ACL を使用する
access = None, # (匿名を含む) すべてのユーザーがデフォルトメニューでこのモジュールを閲覧でき、コントローラにアクセスできる
module_type = 0 # このアイテムが常にメニューの一番目にある
)),
("admin", Storage(
name_nice = T("Administration"),
description = T("Site Administration"),
restricted = True,
access = "|1|", # 管理者のみがデフォルトメニューでこのモジュールを閲覧でき、コントローラにアクセスできる
module_type = 0 # このアイテムがメニューで分離されている
)),
("gis", Storage(
name_nice = T("Map"),
description = T("Situation Awareness & Geospatial Analysis"),
restricted = False,
module_type = 1, # メニューの一番目にある
resources = Storage(
gis_location = {"importer" : True}
)
)),
("doc", Storage(
name_nice = T("Documents and Photos"),
description = T("A library of digital resources, such as photos, documents and reports"),
restricted = False,
module_type = 10,
)),
("msg", Storage(
name_nice = T("Messaging"),
description = T("Sends & Receives Alerts via Email & SMS"),
restricted = False,
module_type = 10,
)),
("pr", Storage(
name_nice = T("Person Registry"),
description = T("Central point to record details on People"),
restricted = False,
access = "|1|", # 管理者のみがデフォルトメニューでこのモジュールを閲覧できる (皆がコントローラにアクセスできる)
module_type = 10,
resources = Storage(
pr_address = {"importer" : True},
pr_contact = {"importer" : True},
pr_presence = {"importer" : True},
pr_identity = {"importer" : True},
pr_person = {"importer" : True},
pr_group = {"importer" : True},
pr_group_membership = {"importer" : True},
)
)),
("pf", Storage(
name_nice = T("Person Finder"),
description = T("Helps to report and search for Missing Persons"),
restricted = False,
module_type = 10,
)),
("dvi", Storage(
name_nice = T("Disaster Victim Identification"),
description = T("Disaster Victim Identification"),
restricted = True,
module_type = 10,
#access = "|DVI|", # Only users with the DVI role can see this module in the default menu & access the controller
#audit_read = True, # Can enable Audit for just an individual module here
#audit_write = True,
resources = Storage(
dvi_recreq = {"importer" : True},
)
)),
#("dvr", Storage(
# name_nice = T("Disaster Victim Registry"),
# description = T("Traces internally displaced people (IDPs) and their needs"),
# module_type = 10
# )),
("org", Storage(
name_nice = T("Organization Registry"),
description = T('Lists "who is doing what & where". Allows relief agencies to coordinate their activities'),
restricted = False,
module_type = 10,
resources = Storage(
org_organisation = {"importer" : True},
org_office = {"importer" : True},
org_staff = {"importer" : True}
)
)),
# 注 プロジェクトモジュールは、アセスメントモジュールに依存する
("project", Storage(
name_nice = T("Project Tracking"),
description = T("Tracking of Projects, Activities and Tasks"),
restricted = False,
module_type = 10
)),
# NB Budget module depends on Project Tracking Module
#("budget", Storage(
# name_nice = T("Budgeting Module"),
# description = T("Allows a Budget to be drawn up"),
# restricted = False,
# module_type = 10,
# resources = Storage(
# budget_item = {"importer" : True},
# budget_kit = {"importer" : True},
# budget_bundle = {"importer" : True},
# )
# )),
("inv", Storage(
name_nice = T("Inventory Management"),
description = T("Receiving and Sending Items"),
restricted = False,
module_type = 4
)),
("asset", Storage(
name_nice = T("Asset Management"),
description = T("Recording and Assigning Assets"),
restricted = False,
module_type = 10,
)),
("vol", Storage(
name_nice = T("Volunteers"),
description = T("Manage volunteers by capturing their skills, availability and allocation"),
restricted = False,
module_type = 3,
)),
#("hrm", Storage(
#name_nice = T("Human Resources"),
#description = T("Human Resource Management"),
#restricted = False,
#module_type = 10,
#)),
("req", Storage(
name_nice = T("Requests"),
description = T("Manage requests for supplies, assets, staff or other resources. Matches against Inventories where supplies are requested."),
restricted = False,
module_type = 10,
)),
("cr", Storage(
name_nice = T("Shelter Registry"),
description = T("Tracks the location, distibution, capacity and breakdown of victims in Shelters"),
restricted = False,
module_type = 10,
resources = Storage(
cr_shelter = {"importer" : True }
)
)),
("hms", Storage(
name_nice = T("Hospitals"),
description = T("Helps to monitor status of hospitals"),
restricted = True,
module_type = 10,
resources = Storage(
hms_hospital = {"importer" : True}
)
)),
("irs", Storage(
name_nice = T("Incident Reporting"),
description = T("Incident Reporting System"),
restricted = False,
module_type = 10
)),
# アセスメントは、現時点では CR と IRS に依存
("assess", Storage(
name_nice = T("Assessments"),
description = T("Rapid Assessments & Flexible Impact Assessments"),
restricted = False,
module_type = 2,
)),
#("building", Storage(
# name_nice = T("Building Assessments"),
# description = T("Building Safety Assessments"),
# restricted = False,
# module_type = 10,
# )),
#("delphi", Storage(
# name_nice = T("Delphi Decision Maker"),
# description = T("Supports the decision making of large groups of Crisis Management Experts by helping the groups create ranked list."),
# restricted = False,
# module_type = 10,
# )),
#("survey", Storage(
# name_nice = T("Survey Module"),
# description = T("Create, enter, and manage surveys."),
# restricted = False,
# module_type = 10,
# )),
#("importer", Storage(
# name_nice = T("Spreadsheet Importer"),
# description = T("Used to import data from spreadsheets into the database"),
# restricted = False,
# module_type = 10,
# )),
#("flood", Storage(
# name_nice = T("Flood Alerts"),
# description = T("Flood Alerts show water levels in various parts of the country"),
# restricted = False,
# module_type = 10
# )),
#("ticket", Storage(
# name_nice = T("Ticketing Module"),
# description = T("Master Message Log to process incoming reports & requests"),
# restricted = False,
# module_type = 10,
# )),
#("lms", Storage(
# name_nice = T("Logistics Management System"),
# description = T("An intake system, a warehouse management system, commodity tracking, supply chain management, procurement and other asset and resource management capabilities."),
# restricted = False,
# module_type = 10
# )),
])