Changeset 35
- Timestamp:
- 08/23/06 11:42:02 (2 years ago)
- Files:
-
- trunk/INSTALL (modified) (2 diffs)
- trunk/etc/domainmodel.conf.new (modified) (8 diffs)
- trunk/src/dm/dictionary.py (modified) (5 diffs)
- trunk/src/dm/environment.py (modified) (1 diff)
- trunk/src/dm/environmenttest.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/INSTALL
r3 r35 5 5 mailto:kforge-dev@lists.okfn.org 6 6 7 ## Full Installation Instructions ## 7 8 8 Full installation instructions are below as ``Full Installation Instructions''. 9 10 11 Quickstart 12 ++++++++++ 13 14 1. Check all dependencies (see below). 15 16 17 2. Install package: 18 19 $ python setup.py install 20 21 22 Full Installation Instructions 23 ++++++++++++++++++++++++++++++ 24 25 DomainModel Package Dependencies 26 ******************************** 9 ### 1. Check all dependencies (see below) ### 27 10 28 11 The system depends on these packages. Please make sure you have them … … 43 26 python setup.py install 44 27 45 Install DomainModel 46 ******************* 28 ### 2. Install package ### 47 29 48 30 $ python setup.py install 49 31 50 Testing the Installation 51 ************************ 32 ### 3. (optional) Test ### 33 34 1. First copy the etc/domainmodel.conf.new and edit the file to be appropriate 35 to your installation. 36 37 2. Set environment variable DOMAINMODEL_SETTINGS to point to this new 38 configuration file. 39 40 3. Create a database and database user corresponding to the settings entered in 41 the configuration file in step 1 42 43 4. Run the tests 52 44 53 45 $ ./bin/domainmodel-test 54 46 55 47 56 Installing DomainModel Applications 57 +++++++++++++++++++++++++++++++++++ 48 ## Installing DomainModel Applications ## 58 49 59 50 Once you have installed the DomainModel package, you can also install trunk/etc/domainmodel.conf.new
r29 r35 6 6 # system_mode: 7 7 # * whether e.g. in production or development mode 8 # * valid values: production (default)| development8 # * valid values: production | development 9 9 system_mode = development 10 10 … … 15 15 #system_name = domainmodel 16 16 17 # system_service_dir:18 # * path to service home directory19 # * defined by program environment variable20 # * NB: included for illustrative purposes only21 #system_service_dir = /path/to/service/files22 23 # etcdir:24 # * path to service configuration directory25 # * defined by program to be %(system_service_dir)s/etc26 # * NB: included for illustrative purposes only27 #etcdir = %(system_service_path)s/etc28 29 # vardir:30 # * path to service's variable data directory31 # * defined by program to be %(system_service_dir)s/var32 # * NB: included for illustrative purposes only33 #vardir = %(system_service_path)s/var34 35 17 # plugin_data_dir: 36 18 # * path to service's plugins' variable data directory 37 plugin_data_dir = %(vardir)s/plugin_data 38 39 # project_data_dir: 40 # * path to service's projects' variable data directory 41 project_data_dir = %(vardir)s/project_data 42 43 # ip_address: 44 # * IP address used by Apache virtual-hosts to listen on 45 # * may be set to '*' 46 ip_address = * 47 48 # port_http: 49 # * port number for normal HTTP 50 port_http = 9080 51 52 # port_https: 53 # * port number for secure HTTP 54 port_https = 9443 19 plugin_data_dir = /tmp/domainmodel_testing/plugin_data 55 20 56 21 # domain_name: … … 58 23 domain_name = modeldomain.your.domain.name 59 24 25 60 26 [logging] 61 # default_directory:62 # * the directory to which logging is directed63 default_directory = %(vardir)s/log64 65 27 # log_file: 66 28 # * service log file 67 log_file = %( default_directory)s/%(system_name)s.log29 log_file = %(system_name)s.log 68 30 69 31 # level: 70 32 # * level of logging information 71 33 # * values (increasing verbosity): CRITICAL, ERROR, WARNING, INFO, DEBUG 72 level = DE VELOPMENT34 level = DEBUG 73 35 74 36 … … 99 61 100 62 [www] 63 # ip_address: 64 # * IP address used by Apache virtual-hosts to listen on 65 # * may be set to '*' 66 ip_address = * 101 67 102 # apache_config_file:103 # * file path for auto-generated apache configuration104 apache_config_file = %(etcdir)s/httpd.conf 68 # port_http: 69 # * port number for normal HTTP 70 port_http = 9080 105 71 106 # ssl_certificate_file: 107 # * path to SSL certificate 108 ssl_certificate_file = /etc/apache2/ssl/apache.pem 109 110 # ssl_certificate_key_file: 111 # * path to SSL certificate keys 112 ssl_certificate_key_file = /etc/apache2/ssl/apache.pem 113 114 # document_root: 115 # * path to directory of web files 116 document_root = %(vardir)s/www/ 72 # port_https: 73 # * port number for secure HTTP 74 port_https = 9443 117 75 118 76 # media_host: … … 126 84 # media_root: 127 85 # * path to directory of media files 128 media_root = %(document_root)s/media86 media_root = ./www/media 129 87 130 88 # reload_apache: … … 136 94 no_reload_apache = true 137 95 96 138 97 [django] 139 98 # templates_dir: 140 99 # * Django templates to use for web interface 141 templates_dir = %(vardir)s/django/templates/kui 100 # NB: for tests to work this must be set to point to the kforge templates 101 templates_dir = /path/to/kforge/templates/kui 142 102 143 103 # secret_key: … … 145 105 # * NB: make sure your service's secret_key is different from the default 146 106 # * type one random character (no spaces) for each '#' character in the line: 147 #148 #ecret_key = #################################################149 150 107 secret_key = (*Y£F@{£FHW$Rli(EFH(*SEHF(&9S(P&SYGDF(&G9Ged9f7gs 151 108 … … 159 116 # font_path: 160 117 # * path to font definition used for captchas 161 font_path = %(etcdir)s/FreeMono.ttf118 # font_path = /path/to/captcha/FreeMono.ttf 162 119 163 120 # font_size: 164 121 # * point size of font used for captchas 165 font_size = 48 166 167 168 ## ******************************************************************** 169 ## Plugins 170 ## ******************************************************************** 171 172 [moin] 173 # system_path: 174 # * path to directory where MoinMoin system data is installed (htdocs etc) 175 system_path = /usr/share/moin 176 177 [trac] 178 # templates_path: 179 # * path to directory containing Trac templates 180 templates_path = /usr/share/trac/templates 181 182 # htdocs_path: 183 # * path to htdocs files 184 htdocs_path = /usr/share/trac/htdocs 185 122 # font_size = 48 trunk/src/dm/dictionary.py
r23 r35 13 13 self.environment = SystemEnvironment(self.getSystemName()) 14 14 self.assertSystemEnvironment() 15 self.readSystemServicePathFromEnvironment()16 self.makeEtcPath()17 15 self.setDefaultWords() 18 16 self.makeConfigFilePath() … … 30 28 self.environment.assertDjangoSettingsModule() 31 29 32 def readSystemServicePathFromEnvironment(self):33 "Reads system service path from environment."34 self[SYSTEM_SERVICE_PATH] = self.environment.getSystemServicePath()35 36 def makeEtcPath(self):37 self[ETC_DIR_PATH] = os.path.join(self[SYSTEM_SERVICE_PATH], 'etc')38 39 30 def setDefaultWords(self): 40 varDirPath = os.path.join(self[SYSTEM_SERVICE_PATH], 'var')41 self[VAR_DIR_PATH] = varDirPath42 31 self[PYTHONPATH] = os.environ.get('PYTHONPATH', '') 43 32 self[SYSTEM_NAME] = self.getSystemName() … … 47 36 self[VISITOR_ROLE] = 'Visitor' 48 37 self[INITIAL_PERSON_ROLE] = 'Visitor' 49 self[PLUGIN_VAR_DIR_PATH] = os.path.join(varDirPath,'plugin_data')50 38 self[PLUGIN_PACKAGE_NAME] = 'dm.plugin' 51 39 self[CAPTCHA_IS_ENABLED] = '' # False (ConfigParser only supports str) … … 54 42 55 43 def makeConfigFilePath(self): 56 configFileName = '%s.conf' % self.getSystemName() 57 self.configFilePath = os.path.join(self[ETC_DIR_PATH], configFileName) 44 self.configFilePath = self.environment.getConfigFilePath() 58 45 59 46 def assertConfigFileExists(self): … … 65 52 66 53 def initConfigFileReader(self): 67 systemName = self[SYSTEM_NAME] 68 systemServicePath = self[SYSTEM_SERVICE_PATH] 69 self.configFileReader['system_service_path'] = systemServicePath 70 self.configFileReader['system_root'] = systemServicePath # depr 71 self.configFileReader['system_name'] = systemName 72 self.configFileReader['etcdir'] = self[ETC_DIR_PATH] 73 self.configFileReader['vardir'] = self[VAR_DIR_PATH] 54 for key in self.keys(): 55 self.configFileReader[key] = self[key] 74 56 75 57 def readConfigFile(self): trunk/src/dm/environment.py
r23 r35 30 30 raise "%(name)s value in environment not valid: '%(value)'" 31 31 32 def getSystemServicePath(self): 33 "Reads system service path from SYSTEMNAMEHOME environment variable." 34 name = self.systemName.upper() + 'HOME' 32 def getConfigFilePathEnvironmentVariableName(self): 33 """Get the name of the environment variable which holds the path to the 34 configuration file 35 """ 36 name = self.systemName.upper() + '_SETTINGS' 37 return name 38 39 def getConfigFilePath(self): 40 """Read system configuration path from environment variable 41 """ 42 name = self.getConfigFilePathEnvironmentVariableName() 35 43 if name in os.environ: 36 value= os.environ[name]44 path = os.environ[name] 37 45 else: 38 46 message = "Environment variable '%s' not set." % name 39 47 raise EnvironmentError, message 40 if os.path.isdir(value): 41 path = value 42 else: 43 message = 'System service files not found at: %s' % value 44 raise EnvironmentError, message 48 # if not os.path.isfile(path): 49 # message = 'System service files not found at: %s' % path 50 # raise EnvironmentError, message 45 51 return path 46 52 trunk/src/dm/environmenttest.py
r22 r35 19 19 self.environment.assertDjangoSettingsModule() 20 20 21 def test_getConfigFilePathEnvironmentVariableName(self): 22 exp = 'DOMAINMODEL_SETTINGS' 23 out = self.environment.getConfigFilePathEnvironmentVariableName() 24 self.failUnlessEqual(exp, out) 25
