2014-01-13 2 views

답변

0

request.registry.settings 무엇을 찾고 계십니까? 여기

자세한 내용 :

Pyramid and .ini configuration

아니면 방법에 대해 얘기했다. 요청마다 메소드에 액세스하고 싶습니까?

def some_method(): 
    return 'stuff you want' 

# in your main function 
config.add_request_method(some_method, 'stuff', reify=True) 

# in a view 
foo = request.stuff 
+0

실제로 Configurator.absolute_asset_spec를 호출 할 : [링크] (http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/api/config.html#pyramid .config.Configurator.absolute_asset_spec) – Matty

0

포인터 주셔서 감사합니다. 대답은 :

@view_config(route_name='home', renderer='templates/home.pt') 
def home_view(request): 
    config = Configurator(registry=request.registry) 
    path = config.absolute_asset_spec('__init__.py') 
    : 
    : 
관련 문제