Hi list,
my need was simple, setting up my tg app with some data to run the
functionnal tests, and another setup profile to deploy in production
with little or no data (just an admin user)
here is what I've done
in the .ini file (development / test / preprod / production) I added a
key
profile = minimal
in project/websetup/__init__
from schema import setup_schema
from bootstrap import bootstrap
from migrate.versioning.api import version_control, version, upgrade
from migrate.exceptions import DatabaseAlreadyControlledError
def setup_app(command, conf, vars):
"""Place any commands to setup tgtest here"""
load_environment(conf.global_conf, conf.local_conf)
setup_schema(command, conf, vars)
bootstrap_profile = conf.get('profile', None)
if bootstrap_profile is not None:
if bootstrap_profile=='medium':
from medium_bootstrap import bootstrap
elif bootstrap_profile=='minimal':
from minimal_bootstrap import bootstrap
bootstrap(command, conf, vars)
# setup migrate versioning table if not present
# here we use "migration" because we setup migration with
# migrate create migration "My Project"
try:
latest_version = version("migration")
version_control(config.get('sqlalchemy.url'), "migration",
version=latest_version, echo=False)
except DatabaseAlreadyControlledError:
log.info("migrate table already present")
HTH
NIL
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.