Put inside your app_cfg.py something like:

def set_proper_tw2_scriptname():
    base_config.custom_tw2_config = {'script_name':
tg.config['deployed_scriptname']}

from tg.configuration import milestones
milestones.config_ready.register(set_proper_tw2_scriptname)

Have not tested it at all so there might be typos or wrong variables but I
hope it gets the idea.

Alessandro

On Fri, Mar 27, 2015 at 9:26 AM, Luca Verardi <[email protected]>
wrote:

> Ok i don't understand how its work config_ready.
> Can you make me an example please?
>
> Thanks
>
> Il giorno giovedì 26 marzo 2015 00:38:42 UTC+1, Alessandro Molina ha
> scritto:
>>
>> Sadly that is one of the shortcomings of the current configuration
>> process, there are some options you can specify in .ini files and some that
>> are only available from AppConfig. That dichotomy will be improved a bit by
>> 2.3.5 and resolved by 2.4 which will make no difference between options
>> loaded from config files and specified in app_cfg.
>>
>> In the meanwhile, as custom_tw2_config is one of those options, you can
>> work-around that by binding to the config_ready milestone (which signals
>> that the .ini config has been read and merged into tg.config) and switch
>> base_config.custom_tw2_config.script_name to the value you see in
>> tg.config. That way the middleware will be properly configured with the
>> value specified in .ini as you got it from tg.config after it contains the
>> .ini values.
>>
>>
>>
>> On Wed, Mar 25, 2015 at 12:07 PM, Luca Verardi <[email protected]>
>> wrote:
>>
>>> Hello,
>>>
>>> if I hardcode the address in app_cfg it works, although I really don't
>>> want to do that, as it could vary between servers. The problem is, by
>>> this point, the params from development.ini are not available yet. They
>>> become available AFTER make_base_app has been called, but by then all
>>> resources have already been bound to the default address. I've read the
>>> docs at
>>> http://turbogears.readthedocs.org/en/latest/turbogears/
>>> configuration/appconfig.html
>>> , but after countless failed attempts, I'm still stumped as to what to
>>> do.
>>>
>>> Thanks
>>>
>>> Il giorno martedì 24 marzo 2015 13:11:52 UTC+1, Alessandro Molina ha
>>> scritto:
>>>>
>>>> custom_tw2_config.res_prefix is the option to tell TW2 where to serve
>>>> its resources,
>>>> but I suppose that you are mounting the whole project in a subpath, in
>>>> such case it should be handled by SCRIPT_NAME but I didn't check it is
>>>> properly managed by TW2.
>>>>
>>>> On Mon, Mar 23, 2015 at 9:11 AM, Luca Verardi <[email protected]>
>>>> wrote:
>>>>
>>>>> Hello everybody,
>>>>> I have a question concerning how TurboGears2 handles resources.
>>>>> This is my server's address:
>>>>>
>>>>> http://root.myproject.com/myproject
>>>>>
>>>>> External resources are instead given this address:
>>>>>
>>>>> http://root.myproject.com/tw2/resources/myproject/public/jav
>>>>> ascript/jquery-1.11.1.min.js
>>>>>
>>>>> How do I tell TG2 to go look in
>>>>> "http://root.myproject.com/myproject/tw2/[...]"; instead of
>>>>> "http://root.myproject.com/tw2/[...]";?
>>>>>
>>>>> Thanks
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "TurboGears" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/turbogears.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "TurboGears" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/turbogears.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to