maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Maposmatic-dev] [PATCH maposmatic 1/4] Rework conf iguration templates


From: Maxime Petazzoni
Subject: [Maposmatic-dev] [PATCH maposmatic 1/4] Rework conf iguration templates
Date: Mon, 7 May 2012 19:13:25 -0700

Use the more traditional '.dist' extension for configuration templates
that are part of the MapOSMatic distribution. Update the installation
instructions accordingly.

Includes some style fixes in the INSTALL and template files, as well as
a fix to the wrapper script to correctly allow for an undefined log
location (defaults to stderr).

Signed-off-by: Maxime Petazzoni <address@hidden>
---
 INSTALL                        |   25 +++++----
 scripts/config.py-template     |   27 ----------
 scripts/config.py.dist         |   25 +++++++++
 scripts/wrapper.py             |    2 +-
 www/maposmatic.wsgi-template   |   34 -------------
 www/maposmatic.wsgi.dist       |   34 +++++++++++++
 www/settings_local.py-template |   96 -----------------------------------
 www/settings_local.py.dist     |  109 ++++++++++++++++++++++++++++++++++++++++
 8 files changed, 183 insertions(+), 169 deletions(-)
 delete mode 100755 scripts/config.py-template
 create mode 100755 scripts/config.py.dist
 delete mode 100644 www/maposmatic.wsgi-template
 create mode 100644 www/maposmatic.wsgi.dist
 delete mode 100644 www/settings_local.py-template
 create mode 100644 www/settings_local.py.dist

diff --git a/INSTALL b/INSTALL
index b1bafc9..a1759a0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,16 +6,20 @@ Dependencies
 
 MapOSMatic depends on :
 
- * Python, the programming language
+ * Python, the programming language.
 
  * Django, the Web framework used to develop the Web front-end, but
    also used for the maposmaticd daemon to conveniently access the
-   database through Django's ORM
+   database through Django's ORM.
 
- * python-psycopg2, to let Django access the PostgreSQL database
+ * OCitySMap, the rendering pipeline for MapOSMatic. See OCitySMap's
+   install file for installation instructions and OCitySMap's
+   dependencies.
+
+ * python-psycopg2, to let Django access the PostgreSQL database.
 
  * python-feedparser, to parse the MapOSMatic blog feed and display
-   the latest entries on the main MapOSMatic website
+   the latest entries on the main MapOSMatic website.
 
  * python-imaging, to render PNG maps.
 
@@ -23,13 +27,12 @@ MapOSMatic depends on :
 
  * JSON (any python-*json package should work).
 
- * ImageMagick, for rendering the thumbnails of multi-page maps
+ * ImageMagick, for rendering the thumbnails of multi-page maps.
 
 On an debian/ubuntu installation, the following should be enough:
 
   sudo aptitude install python-django python-psycopg2 \
-          python-feedparser python-imaging gettext \
-          imagemagick
+          python-feedparser python-imaging gettext imagemagick
 
 You will also most likely need a working PostGIS installation for the
 entire pipeline to run. See the INSTALL documentation of OcitySMap for
@@ -39,11 +42,11 @@ Setup
 -----
 
 The www/ directory contains the Django web application. The file
-www/settings_local.py-template must be copied to www/settings_local.py
-and modified to match your installation configuration.
+www/settings_local.py.dist must be copied to www/settings_local.py and
+modified to match your installation configuration.
 
-Likewise for www/maposmatic.wsgi-template and
-scripts/config.py-template.
+Likewise for www/maposmatic.wsgi.dist and scripts/config.py.dist,
+respectively as www/maposmatic.wsgi and scripts/config.py.
 
 The database must then be initialized with the tables needed for MapOSMatic,
 using :
diff --git a/scripts/config.py-template b/scripts/config.py-template
deleted file mode 100755
index 23a51f9..0000000
--- a/scripts/config.py-template
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/env python
-# coding: utf-8
-
-# Copy this file as 'config.py' and edit the following lines to match your
-# installation.
-
-# Path to your OCitySMap installation
-OCITYSMAP_PATH = '/path/to/ocitysmap'
-
-# Log file for MapOSMatic. Leave empty for stderr.
-MAPOSMATIC_LOG = '/tmp/maposmaticd.log'
-
-# Log level (lower is more verbose)
-# 50: critical
-# 40: error
-# 30: warning
-# 20: info
-# 10: debug
-#  0: not set (discouraged)
-MAPOSMATIC_LVL = 20
-
-###
-## Optional: if you need to extend the python search path, then write
-## something like the following:
-# import os
-# os.environ['PYTHONPATH'] = '%s:%s' % ('/path/to/lib/python/site-packages',
-#                                      os.environ.get('PYTHONPATH', ''))
diff --git a/scripts/config.py.dist b/scripts/config.py.dist
new file mode 100755
index 0000000..f175245
--- /dev/null
+++ b/scripts/config.py.dist
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+import os
+
+# Optional: if you need to extend the Python search path, then write
+# something like the following:
+# os.environ['PYTHONPATH'] = ('%s:%s' %
+#     ('/path/to/lib/python/site-packages',
+#      os.environ.get('PYTHONPATH', '')))
+
+# Path to your OCitySMap installation
+OCITYSMAP_PATH = '/path/to/ocitysmap'
+
+# Log file for MapOSMatic. Leave empty for stderr.
+MAPOSMATIC_LOG = None
+
+# Log level (lower is more verbose)
+# 50: critical
+# 40: error
+# 30: warning
+# 20: info
+# 10: debug
+#  0: not set (discouraged)
+MAPOSMATIC_LVL = 20
diff --git a/scripts/wrapper.py b/scripts/wrapper.py
index 7fc1680..a027edc 100755
--- a/scripts/wrapper.py
+++ b/scripts/wrapper.py
@@ -34,7 +34,7 @@ if __name__ == '__main__':
     os.environ['PYTHONPATH'] = '%s:%s:%s' % (OCITYSMAP_PATH, root,
                                              os.environ.get('PYTHONPATH', ''))
     os.environ['DJANGO_SETTINGS_MODULE'] = 'www.settings'
-    os.environ['MAPOSMATIC_LOG_FILE'] = MAPOSMATIC_LOG
+    os.environ['MAPOSMATIC_LOG_FILE'] = MAPOSMATIC_LOG or ''
     os.environ['MAPOSMATIC_LOG_LEVEL'] = str(MAPOSMATIC_LVL)
 
     os.execv(os.path.join(root, sys.argv[1]), sys.argv[1:])
diff --git a/www/maposmatic.wsgi-template b/www/maposmatic.wsgi-template
deleted file mode 100644
index 20838e9..0000000
--- a/www/maposmatic.wsgi-template
+++ /dev/null
@@ -1,34 +0,0 @@
-# coding: utf-8
-
-# maposmatic, the web front-end of the MapOSMatic city map generation system
-# Copyright (C) 2009  David Decotigny
-# Copyright (C) 2009  Frédéric Lehobey
-# Copyright (C) 2009  David Mentré
-# Copyright (C) 2009  Maxime Petazzoni
-# Copyright (C) 2009  Thomas Petazzoni
-# Copyright (C) 2009  Gaël Utard
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-import os, sys
-
-sys.path.append("/path/to/our/parent/directory")
-sys.path.append("/path/to/our/ocitysmap/top/directory")
-
-os.environ["DJANGO_SETTINGS_MODULE"] = 'www.settings'
-os.environ["MAPOSMATIC_LOG_FILE"] = "/tmp/maposmatic-www.log"
-
-import django.core.handlers.wsgi
-
-application = django.core.handlers.wsgi.WSGIHandler()
diff --git a/www/maposmatic.wsgi.dist b/www/maposmatic.wsgi.dist
new file mode 100644
index 0000000..20838e9
--- /dev/null
+++ b/www/maposmatic.wsgi.dist
@@ -0,0 +1,34 @@
+# coding: utf-8
+
+# maposmatic, the web front-end of the MapOSMatic city map generation system
+# Copyright (C) 2009  David Decotigny
+# Copyright (C) 2009  Frédéric Lehobey
+# Copyright (C) 2009  David Mentré
+# Copyright (C) 2009  Maxime Petazzoni
+# Copyright (C) 2009  Thomas Petazzoni
+# Copyright (C) 2009  Gaël Utard
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import os, sys
+
+sys.path.append("/path/to/our/parent/directory")
+sys.path.append("/path/to/our/ocitysmap/top/directory")
+
+os.environ["DJANGO_SETTINGS_MODULE"] = 'www.settings'
+os.environ["MAPOSMATIC_LOG_FILE"] = "/tmp/maposmatic-www.log"
+
+import django.core.handlers.wsgi
+
+application = django.core.handlers.wsgi.WSGIHandler()
diff --git a/www/settings_local.py-template b/www/settings_local.py-template
deleted file mode 100644
index 306831f..0000000
--- a/www/settings_local.py-template
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-# coding: utf-8
-
-# maposmatic, the web front-end of the MapOSMatic city map generation system
-# Copyright (C) 2009  David Decotigny
-# Copyright (C) 2009  Frédéric Lehobey
-# Copyright (C) 2009  David Mentré
-# Copyright (C) 2009  Maxime Petazzoni
-# Copyright (C) 2009  Thomas Petazzoni
-# Copyright (C) 2009  Gaël Utard
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Affero General Public License for more details.
-
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-import logging
-
-DEBUG = True
-
-ADMINS = (
-    ('MapOSMatic admin', 'address@hidden'),
-)
-
-DATABASES = {
-    'default': {
-        'ENGINE': 'django.db.backends.postgresql_psycopg2',
-        'NAME': 'maposmatic',
-        'USER': 'maposmatic',
-        'PASSWORD': 'ereiamjh',
-        'HOST': 'localhost',
-        'PORT': ''
-        }
-    }
-
-# Path to ocitysmap's config file to use, or None for the default in ~/
-OCITYSMAP_CFG_PATH = None
-
-# Path to the file containing the datetime of the state of the GIS
-# database. It should be of the form YYYY-MM-DD HH:MM:SS.
-GIS_DATABASE_LAG_FILE = '/path/to/gis/database/lag/file'
-
-RENDERING_RESULT_PATH = '/path/to/rendering/results/'
-RENDERING_RESULT_URL = '/results/' # Either a relative URL or an absolute URL
-RENDERING_RESULT_FORMATS = ['png', 'svgz', 'pdf', 'csv']
-RENDERING_RESULT_MAX_SIZE_GB = 10
-
-# Default output log file when the env variable MAPOSMATIC_LOG_FILE is not set
-DEFAULT_MAPOSMATIC_LOG_FILE = '/path/to/maposmatic/logs/maposmatic.log'
-
-# Default log level when the env variable DEFAULT_MAPOSMATIC_LOG_LEVEL
-# is not set
-DEFAULT_MAPOSMATIC_LOG_LEVEL = logging.INFO
-DEFAULT_MAPOSMATIC_LOG_FORMAT = "%(asctime)s - %(name)address@hidden(process)d 
- %(levelname)s - %(message)s"
-
-# Base bounding box
-BASE_BOUNDING_BOX = (51.956, -7.838, 41.458, 11.937)
-
-# Maximum length of the bounding box to be rendered. This length is
-# checked in both directions (longitude and latitude).
-# Note: if you change this you should probably change
-# BBOX_MAXIMUM_LENGTH_IN_KM in osm_map.js too.
-BBOX_MAXIMUM_LENGTH_IN_METERS = 20000
-
-# Number of items displayed per page in the jobs and maps pages
-ITEMS_PER_PAGE = 25
-
-# PID file location for the rendering daemon associated with this
-# instance; normally managed by the /etc/init.d scripts such as
-# start-stop-daemon(8) in debian systems:
-MAPOSMATIC_PID_FILE = '/var/run/maposmaticd.pid'
-
-# Settings for exception emails: the from email address, and the list of
-# receipient email addresses. No emails are sent if the receipients list is
-# empty.
-DAEMON_ERRORS_SMTP_HOST = 'localhost'
-DAEMON_ERRORS_SMTP_PORT = 25
-DAEMON_ERRORS_EMAIL_FROM = 'address@hidden'
-DAEMON_ERRORS_EMAIL_REPLY_TO = 'address@hidden'
-DAEMON_ERRORS_JOB_URL = 'http://domain.com/jobs/%d'
-
-###
-## Optional: if you need to extend the python search path, then write
-## something like the following:
-# import sys
-# sys.path.append('/path/to/ocitysmap')
-# sys.path.append('/path/to/lib/python/site-packages')
diff --git a/www/settings_local.py.dist b/www/settings_local.py.dist
new file mode 100644
index 0000000..c9cf047
--- /dev/null
+++ b/www/settings_local.py.dist
@@ -0,0 +1,109 @@
+#!/usr/bin/env python
+# coding: utf-8
+
+# maposmatic, the web front-end of the MapOSMatic city map generation system
+# Copyright (C) 2009  David Decotigny
+# Copyright (C) 2009  Frédéric Lehobey
+# Copyright (C) 2009  David Mentré
+# Copyright (C) 2009  Maxime Petazzoni
+# Copyright (C) 2009  Thomas Petazzoni
+# Copyright (C) 2009  Gaël Utard
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+import os
+import sys
+
+# Optional: if you need to extend the Python search path, for example to
+# include your OCitySMap installation, then write something like the following:
+# sys.path.append('/path/to/ocitysmap')
+# sys.path.append('/path/to/lib/python/site-packages')
+
+DEBUG = True
+
+ADMINS = (
+    ('MapOSMatic admin', 'address@hidden'),
+)
+
+DATABASES = {
+    # For SQLite:
+    'default': {
+        'ENGINE': 'django.db.backends.sqlite3',
+        'NAME': os.path.join(os.path.dirname(__file__),
+                    'datastore.sqlite3'),
+        'USER': '',
+        'PASSWORD': '',
+        'HOST': '',
+        'PORT': ''
+        },
+
+    # For PostgreSQL:
+    #'default': {
+    #    'ENGINE': 'django.db.backends.postgresql_psycopg2',
+    #    'NAME': 'maposmatic',
+    #    'USER': 'maposmatic',
+    #    'PASSWORD': 'secret',
+    #    'HOST': 'localhost',
+    #    'PORT': '5432'
+    #    },
+
+}
+
+# Path to ocitysmap's config file to use, or None for the default
+# (~/.ocitysmap.conf)
+OCITYSMAP_CFG_PATH = None
+
+# Path to the file containing the datetime of the state of the GIS
+# database. It should be of the form YYYY-MM-DD HH:MM:SS.
+GIS_DATABASE_LAG_FILE = '/path/to/gis/database/lag/file'
+
+RENDERING_RESULT_PATH = '/path/to/rendering/results/'
+RENDERING_RESULT_URL = '/results/' # Either a relative URL or an absolute URL
+RENDERING_RESULT_FORMATS = ['png', 'svgz', 'pdf', 'csv']
+RENDERING_RESULT_MAX_SIZE_GB = 10
+
+# Default output log file when the env variable MAPOSMATIC_LOG_FILE is not set
+DEFAULT_MAPOSMATIC_LOG_FILE = '/path/to/maposmatic/logs/maposmatic.log'
+
+# Default log level when the env variable DEFAULT_MAPOSMATIC_LOG_LEVEL
+# is not set
+DEFAULT_MAPOSMATIC_LOG_LEVEL = logging.INFO
+DEFAULT_MAPOSMATIC_LOG_FORMAT = "%(asctime)s - %(name)address@hidden(process)d 
- %(levelname)s - %(message)s"
+
+# Base bounding box
+BASE_BOUNDING_BOX = (51.956, -7.838, 41.458, 11.937)
+
+# Maximum length of the bounding box to be rendered. This length is
+# checked in both directions (longitude and latitude).
+# Note: if you change this you should probably change
+# BBOX_MAXIMUM_LENGTH_IN_KM in osm_map.js too.
+BBOX_MAXIMUM_LENGTH_IN_METERS = 20000
+
+# Number of items displayed per page in the jobs and maps pages
+ITEMS_PER_PAGE = 25
+
+# PID file location for the rendering daemon associated with this
+# instance; normally managed by the /etc/init.d scripts such as
+# start-stop-daemon(8) in debian systems:
+MAPOSMATIC_PID_FILE = '/var/run/maposmaticd.pid'
+
+# Settings for exception emails: the from email address, and the list of
+# receipient email addresses. No emails are sent if the SMTP host is not
+# defined.
+DAEMON_ERRORS_SMTP_HOST = None
+DAEMON_ERRORS_SMTP_PORT = 25
+DAEMON_ERRORS_EMAIL_FROM = 'address@hidden'
+DAEMON_ERRORS_EMAIL_REPLY_TO = 'address@hidden'
+DAEMON_ERRORS_JOB_URL = 'http://domain.com/jobs/%d'
-- 
1.7.10




reply via email to

[Prev in Thread] Current Thread [Next in Thread]