platten schrieb:
> Hello,
>
> I am working on a production deployment of turbogears which does not
> have the .egg-info directory
You mean, you have not deployed you application as an egg[1]? Why?
> and was wondering if there is a quick way
> of creating the initial sqlite database without the tg-admin sql
> create command? I heard it can be done someway with sqlobject-admin,
> but I have not figured out how to use it with my prod.cfg file.
>
> Any ideas?
Look at my recent answer to the thread "Re: Getting error while running
"tg-admin shell" script". The solution there can be adapted to SQLObject
as well. The important thing in your situation is to give the config
file as a command line argument to the start script.
Here's the function that finds the configuration file (the code is
already in commands.py, but I wrapped it into a function):
def find_config(args):
"""Return environment-specific configuration.
First look on the command line for a desired config file,
if it's not on the command line, then look for 'setup.py'
in the current directory. If there, load configuration
from a file called 'dev.cfg'. If it's not there, the project
is probably installed and we'll look first for a file called
'prod.cfg' in the current directory and then for a default
config file called 'default.cfg' packaged in the egg.
If all fails, raise ConfigurationError.
"""
setupdir = dirname(dirname(__file__))
curdir = getcwd()
if args:
configfile = args[0]
elif exists(join(setupdir, "setup.py")):
configfile = join(setupdir, "dev.cfg")
elif exists(join(curdir, "prod.cfg")):
configfile = join(curdir, "prod.cfg")
else:
try:
configfile = pkg_resources.resource_filename(
pkg_resources.Requirement.parse("EggBasket"),
"config/default.cfg")
except pkg_resources.DistributionNotFound:
raise ConfigurationError("Could not find default
configuration.")
log.info("Using configuration file %s", configfile)
return configfile
[1] http://docs.turbogears.org/1.0/DeployWithAnEgg
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---