On Jun 10, 2007, at 12:31 PM, Daniel Fetchinson wrote:
>
>> Just starting with TG. I've checked out the latest svn version and
>> try
>> to follow the 20 minute wiki but tg-admin sql create fails. The first
>> step of starting the server goes all right, I've added the basic
>> model
>> suggested in the tutorial to model.py, edited dev.cfg so it has a
>> line:
>>
>> sqlobject.dburi="sqlite:///path_to_a_db_file"
>>
>> but then tg-admin sql create fails with:
>>
>> ------------------------------------------- traceback
>> --------------------------------------------------------
>>
>> Database URI not specified in the config file (None).
>> Please be sure it's on the command line.
>> Traceback (most recent call last):
>> File "/usr/local/bin/tg-admin", line 8, in <module>
>> load_entry_point('TurboGears==1.1a0', 'console_scripts', 'tg-
>> admin')()
>> File
>> "/usr/local/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/
>> turbogears/command/base.py",
>> line 108, in main
>> command.run()
>> File
>> "/usr/local/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/
>> turbogears/command/sql.py",
>> line 105, in run
>> command.the_runner.run(sys.argv)
>> File
>> "/usr/local/lib/python2.5/site-packages/SQLObject-0.10dev_r2716-
>> py2.5.egg/sqlobject/manager/command.py",
>> line 101, in run
>> runner.run()
>> File
>> "/usr/local/lib/python2.5/site-packages/SQLObject-0.10dev_r2716-
>> py2.5.egg/sqlobject/manager/command.py",
>> line 307, in run
>> self.command()
>> File
>> "/usr/local/lib/python2.5/site-packages/SQLObject-0.10dev_r2716-
>> py2.5.egg/sqlobject/manager/command.py",
>> line 628, in command
>> for soClass in self.classes(require_some=True):
>> File
>> "/usr/local/lib/python2.5/site-packages/SQLObject-0.10dev_r2716-
>> py2.5.egg/sqlobject/manager/command.py",
>> line 337, in classes
>> if not soClass._connection:
>> File
>> "/usr/local/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/
>> turbogears/database.py",
>> line 223, in __get__
>> self.set_hub()
>> File
>> "/usr/local/lib/python2.5/site-packages/TurboGears-1.1a0-py2.5.egg/
>> turbogears/database.py",
>> line 241, in set_hub
>> raise KeyError, "No database configuration found!"
>> KeyError: 'No database configuration found!'
>>
>> -------------------------------------------- end of traceback
>> ----------------------------------------------------
>>
>> I've used all components before (sqlite itself, pysqlite that comes
>> with python 2.5, sqlobject) they are all installed correctly. I
>> followed the tutorial as closely as possible, what could possibly go
>> wrong?
>>
>> Some version info:
>>
>> python 2.5
>> SQLObject-0.10dev_r2716-py2.5.egg
>> turbogears trunk
>>
>> Thanks,
>> Daniel
>
>
> Okay, I looked a bit into how configuration works in TG and it seems
> the problem is in the get method of tgconfig.TGConfig. If I check what
> dict is used to look up keys (such as "sqlobject.dburi" in my case)
> while tg-admin sql create is doing its thing, well, it's always empty,
> no wonder it can not find a "Database URI".
>
> In a shell however:
> [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import turbogears
>>>> turbogears.util.load_project_config('dev.cfg')
>>>> print turbogears.config['global']['sqlobject.dburi']
> sqlite:///path_to_a_db_file
>
> So it seems the configuration is okay, the uri is there, only tg-admin
> sql create can not find it.
>
> This is quite frustrating actually, because my main motivation for
> migrating to TG from my home grown mod_python-based "web framework" is
> that with TG things are claimed to be just working and I can
> concentrate on the application logic and presentation only, without
> worrying about the rest. It seems this is not the case, although I
> might be doing something totally stupid, although I did nothing else
> then follow the 20 minute wiki tutorial.
Try out the 1.0 branch from svn or a stable release. The trunk is
terribly broken at the moment since we're in the process of migrating
it to CherryPy 3 and it's not the best place to start learning TG.
Alberto
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---