- more setuptools magic
- move configuration to config files - default configuration in defaults.cfg - site configuration in gva.cfg git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@221 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
bd306389f0
commit
3f099c72ff
5 changed files with 37 additions and 39 deletions
|
@ -19,16 +19,16 @@
|
|||
#
|
||||
# Version: $Id$
|
||||
|
||||
"""Distributed default settings for significant GnuviechAdmin config
|
||||
variables."""
|
||||
|
||||
# Distributed default settings for significant GnuviechAdmin config
|
||||
# variables.
|
||||
#
|
||||
# NEVER make site configuration changes to this file. ALWAYS make
|
||||
# them in gva_cfg.py instead, in the designated area. See the
|
||||
# comments in that file for details.
|
||||
# them in gva.cfg instead, in the designated area. See the comments
|
||||
# in that file for details.
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
[database]
|
||||
# The database connection string in a format usable for
|
||||
# sqlalchemy. The default is an sqlite in memory database which is not
|
||||
# very usable for a real installation.
|
||||
#
|
||||
GVA_DBE = 'sqlite:///:memory:'
|
||||
uri = sqlite:///:memory:
|
|
@ -19,30 +19,9 @@
|
|||
#
|
||||
# Version: $Id$
|
||||
|
||||
"""This is the module which takes your site-specific settings.
|
||||
|
||||
From a raw distribution it should be copied to gva_cfg.py. If you
|
||||
already have a gva_cfg.py, be careful to add in only the new settings
|
||||
you want. The complete set of distributed defaults, with annotation,
|
||||
are in ./Defaults. In mm_cfg, override only those you want to change,
|
||||
after the
|
||||
|
||||
from Defaults import *
|
||||
|
||||
line (see below)."""
|
||||
|
||||
###############################################################
|
||||
# Here's where we get the distributed defaults. #
|
||||
|
||||
from Defaults import *
|
||||
|
||||
###############################################################
|
||||
# Put YOUR site-specific configuration below, in gva_cfg.py . #
|
||||
# See Defaults.py for explanations of the values. #
|
||||
|
||||
#--------------------------------------------------------------
|
||||
[database]
|
||||
# The database connection string in a format usable for
|
||||
# sqlalchemy. For examples see
|
||||
# http://www.sqlalchemy.org/docs/dbengine.myt
|
||||
#
|
||||
GVA_DBE = 'sqlite:///database.txt'
|
||||
uri = sqlite:///database.txt
|
|
@ -20,9 +20,19 @@
|
|||
# Version: $Id$
|
||||
|
||||
from sqlalchemy import *
|
||||
from gnuviechadmin import gva_cfg
|
||||
from pkg_resources import Requirement, resource_filename
|
||||
import ConfigParser, os
|
||||
|
||||
meta = BoundMetaData(gva_cfg.GVA_DBE)
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.readfp(
|
||||
open(resource_filename(Requirement.parse('gnuviechadmin'),
|
||||
'gnuviechadmin/defaults.cfg')))
|
||||
config.read([
|
||||
resource_filename(Requirement.parse('gnuviechadmin'),
|
||||
'gnuviechadmin/gva.cfg'),
|
||||
os.path.expanduser('~/.gva.cfg')])
|
||||
|
||||
meta = BoundMetaData(config.get('database', 'uri'))
|
||||
client_table = Table(
|
||||
'client', meta,
|
||||
Column('clientid', Integer, primary_key=True),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue