Is this fixed....? confirmed?

Lucas

On Fri, Dec 5, 2008 at 2:37 PM, Bill5107 <[EMAIL PROTECTED]> wrote:
>
> Oops... This seems to have fixed the problems I was having:
> diff -u -r tgdev_original/devtools/templates/turbogears/+package+/
> websetup.py_tmpl tgdev_new/devtools/templates/turbogears/+package+
> /websetup.py_tmpl
> --- tgdev_original/devtools/templates/turbogears/+package+/
> websetup.py_tmpl     2008-12-04 15:20:15.000000000 -0500
> +++ tgdev_new/devtools/templates/turbogears/+package+/
> websetup.py_tmpl  2008-12-05 15:36:40.161577400 -0500
> @@ -11,7 +11,10 @@
>
>  def setup_config(command, filename, section, vars):
>     """Place any commands to setup {{package}} here"""
> -    conf = appconfig('config:' + filename)
> +
> +    section_name=section.split(':')[-1]
> +    conf = appconfig('config:%s#%s' % (filename,section_name))
> +
>     load_environment(conf.global_conf, conf.local_conf)
>     {{if sqlalchemy}}
>     # Load the models
>
> On Dec 5, 2:17 pm, Bill5107 <[EMAIL PROTECTED]> wrote:
>> I'm trying to host two WSGI apps under one paster-served app. In the
>> past I thought I simply used something like this to setup the app:
>> paster setup-app -name=MyApp development.ini
>>
>> But this fails due to missing sqlalchemy settings. (I think related to
>> pylons not getting the right section under the hood, but I got lost
>> tracking down the init process)
>>
>> To simplify what I think the problem is, I create what I think is a
>> dirt simple change from a default quickstarted app:
>>
>> paster quickstart blah
>> <...just hit enter to create default app>
>>
>> Edit development.ini to replace "[app:main]" with "[app:main2]".
>>
>> Now I expect I have to tell setup-app and serve which application to
>> setup and serve, but it fails:
>>
>> $ cmd /c paster setup-app --name=main2 development.ini
>> Running setup_config() from blah.websetup
>> Traceback (most recent call last):
>>   File "c:\sw5\PyEnv\Scripts\paster-script.py", line 8, in <module>
>>     load_entry_point('pastescript==1.7.3', 'console_scripts', 'paster')
>> ()
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\command.py", line 84, in run
>>     invoke(command, command_name, options, args[1:])
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\command.py", line 123, in invoke
>>     exit_code = runner.run(args)
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\appinstall.py", line 68, in run
>>     return super(AbstractInstallCommand, self).run(new_args)
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\command.py", line 218, in run
>>     result = self.command()
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\appinstall.py", line 456, in command
>>     self, config_file, section, self.sysconfig_install_vars
>> (installer))
>>   File "C:\sw5\PyEnv\lib\site-packages\pastescript-1.7.3-py2.5.egg
>> \paste\script\appinstall.py", line 600, in setup_config
>>
>>     mod.setup_config(command, filename, section, vars)
>>   File "c:\sw5\icg_process\src\temp\ProTractics\temp\blah\blah
>> \websetup.py", line 14, in setup_config
>>     conf = appconfig('config:' + filename)
>>   File "c:\rivet\virtualenvironments\createpyenvpackage
>> \pwpyenv_00.03\lib\site-packages\pastedeploy-1.3.2-py2.5.egg\paste
>> \deploy\loa
>> dwsgi.py", line 215, in appconfig
>>   File "c:\rivet\virtualenvironments\createpyenvpackage
>> \pwpyenv_00.03\lib\site-packages\pastedeploy-1.3.2-py2.5.egg\paste
>> \deploy\loa
>> dwsgi.py", line 248, in loadcontext
>>   File "c:\rivet\virtualenvironments\createpyenvpackage
>> \pwpyenv_00.03\lib\site-packages\pastedeploy-1.3.2-py2.5.egg\paste
>> \deploy\loa
>> dwsgi.py", line 278, in _loadconfig
>>   File "c:\rivet\virtualenvironments\createpyenvpackage
>> \pwpyenv_00.03\lib\site-packages\pastedeploy-1.3.2-py2.5.egg\paste
>> \deploy\loa
>> dwsgi.py", line 363, in get_context
>>   File "c:\rivet\virtualenvironments\createpyenvpackage
>> \pwpyenv_00.03\lib\site-packages\pastedeploy-1.3.2-py2.5.egg\paste
>> \deploy\loa
>> dwsgi.py", line 528, in find_config_section
>> LookupError: No section 'main' (prefixed by 'app' or 'application' or
>> 'composite' or 'composit' or 'pipeline' or 'filter-app') found
>>  in config c:/Rivet/sw5/icg_process/src/temp/ProTractics/temp/blah/
>> development.ini
>>
>> So I work-around by changing main2 back to main and re-run (with
>> either --name=main or omit --name this time) and it works.
>>
>> Now that I'm setup I restore the main2 name I want and continue:
>>
>> $ cmd /c paster serve --app-name=main2 development.ini
>> Starting server in PID 1724.
>> serving onhttp://127.0.0.1:8080
>>
>> Note that this works fine.
>>
>> So my question is, shouldn't  "setup-app --name=main2" work? In my
>> real scenario, I have a composite app and I need to initialize my
>> tg2app as I deploy my composite app. I think using "setup-app --
>> name=MyTgapp" is the "right" approach, no?
>>
>> Thanks in advance!
> >
>



-- 
How to create python package?
http://lucasmanual.com/mywiki/PythonPaste
Bazaar and Launchpad
http://lucasmanual.com/mywiki/Bazaar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to