Here is what I am using:
--- START ---
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#---Defaults
package_name = 'pbs'
#---Set up
import pkg_resources
pkg_resources.require('TurboGears')
import sys
from os.path import *
import turbogears
print 'Loading configuration...'
turbogears.update_config(configfile=package_name+'/config/app.cfg',
modulename=package_name+'.config')
# This bit based on start-<project>.py created by tg-admin quickstart.
#
# 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 this directory. If it's not there, this script
is
# probably installed
if len(sys.argv) > 1:
turbogears.update_config(configfile=sys.argv[1],
modulename=package_name + '.config')
elif exists(join(dirname(__file__), 'setup.py')):
turbogears.update_config(configfile='dev.cfg',
modulename=package_name + '.config')
else:
turbogears.update_config(configfile='prod.cfg',
modulename=package_name + '.config')
print 'Done.'
print 'Initializing database...'
from pbs.model import *
hub.begin()
try:
#---Users
admin = User(user_name='admin', display_name=u'Administrator',
email_address='[EMAIL PROTECTED]', password=u'password')
#---Finish
except:
hub.rollback()
print 'ERROR: Could not initialize database! No data committed. '
\
'Traceback follows.'
raise
hub.commit()
print 'Done.'
--- END ---
Hope it helps.
Krys
Kevin Horn wrote:
> I actually don't think that script exists anymore, but you should be able to
> find what you're looking for here:
> http://trac.turbogears.org/turbogears/wiki/UsingModelsOutsideTurboGears
>
> Kevin H.
>
> On 8/26/06, Bruce <[EMAIL PROTECTED]> wrote:
> >
> >
> > There was a thread here about how to populate a database script style,
> > and one was pointed to
> > http://www.turbogears.org/svn/docudo/trunk/Docudo/install.identity.py.
> > But this place is password proteced so I cannot get to it. Is there
> > some way I can still get a copy of this script?
> >
> >
> > >
> >
>
> ------=_Part_230353_22212881.1156629164764
> Content-Type: text/html; charset=ISO-8859-1
> X-Google-AttachSize: 1010
>
> I actually don't think that script exists anymore, but you should be able to
> find what you're looking for here:<br><a
> href="http://trac.turbogears.org/turbogears/wiki/UsingModelsOutsideTurboGears">http://trac.turbogears.org/turbogears/wiki/UsingModelsOutsideTurboGears
> </a><br><br>Kevin H.<br><br><div><span class="gmail_quote">On 8/26/06, <b
> class="gmail_sendername">Bruce</b> <<a href="mailto:[EMAIL
> PROTECTED]">[EMAIL PROTECTED]</a>> wrote:</span><blockquote
> class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin:
> 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> <br>There was a thread here about how to populate a database script
> style,<br>and one was pointed to<br><a
> href="http://www.turbogears.org/svn/docudo/trunk/Docudo/install.identity.py">http://www.turbogears.org/svn/docudo/trunk/Docudo/install.identity.py
> </a>.<br>But this place is password proteced so I cannot get to it. Is
> there<br>some way I can still get a copy of this
> script?<br><br><br><br><br></blockquote></div><br>
>
> ------=_Part_230353_22212881.1156629164764--
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---