[Grok-dev] Accessing the static directory from 1.3
Sebastian Ware
sebastian at urbantalk.se
Wed Feb 2 04:43:25 EST 2011
Seems that the url needs to be constructed in a new way to be accessed from the browser:
http://localhost:8080/fanstatic/protoncms/workflow.css
it looks easy enough.
Mvh Sebastian
2 feb 2011 kl. 10.28 skrev Sebastian Ware:
> I managed to get the css-file included by adding the following
>
> resource.py
> workflow_style = Resource(library, 'workflow.css')
>
>
> and in my view
>
> from resource import workflow_style
> class Workflow(grok.View):
> grok.context(IWorkflowContainer)
>
> def update(self):
> workflow_style.need()
>
>
> However, I still don't understand how to include all the content in a directory so I can easily access static images etc?
>
> Mvh Sebastian
>
>
> 2 feb 2011 kl. 09.46 skrev Sebastian Ware:
>
>> the traceback...
>>
>> URL: http://localhost:8080/test/%40%40/protoncms/workflow.css
>> Module paste.evalexception.middleware:306 in respond <plus.jpg>
>>>> app_iter = self.application(environ, detect_start_response)
>> Module webob.dec:147 in __call__ <plus.jpg>
>>>> resp = self.call_func(req, *args, **self.kwargs)
>> Module webob.dec:208 in call_func <plus.jpg>
>>>> return self.func(req, *args, **kwargs)
>> Module fanstatic.publisher:134 in __call__ <plus.jpg>
>>>> return request.get_response(self.app)
>> Module webob.request:937 in get_response <plus.jpg>
>>>> application, catch_exc_info=False)
>> Module webob.request:906 in call_application <plus.jpg>
>>>> app_iter = application(self.environ, start_response)
>> Module webob.dec:147 in __call__ <plus.jpg>
>>>> resp = self.call_func(req, *args, **self.kwargs)
>> Module webob.dec:208 in call_func <plus.jpg>
>>>> return self.func(req, *args, **kwargs)
>> Module fanstatic.injector:47 in __call__ <plus.jpg>
>>>> response = request.get_response(self.app)
>> Module webob.request:937 in get_response <plus.jpg>
>>>> application, catch_exc_info=False)
>> Module webob.request:906 in call_application <plus.jpg>
>>>> app_iter = application(self.environ, start_response)
>> Module zope.app.wsgi:59 in __call__ <plus.jpg>
>>>> request = publish(request, handle_errors=handle_errors)
>> Module zope.publisher.publish:129 in publish <plus.jpg>
>>>> obj = request.traverse(obj)
>> Module zope.publisher.browser:540 in traverse <plus.jpg>
>>>> ob = super(BrowserRequest, self).traverse(obj)
>> Module zope.publisher.http:457 in traverse <plus.jpg>
>>>> ob = super(HTTPRequest, self).traverse(obj)
>> Module zope.publisher.base:260 in traverse <plus.jpg>
>>>> obj = publication.traverseName(self, obj, entry_name)
>> Module grokcore.view.publication:42 in traverseName <plus.jpg>
>>>> request, ob, name)
>> Module zope.app.publication.zopepublication:200 in traverseName <plus.jpg>
>>>> ob2 = adapter.publishTraverse(request, nm)
>> Module zope.app.publication.traversers:46 in publishTraverse <plus.jpg>
>>>> raise NotFound(ob, name)
>> NotFound: Object: <zope.fanstatic.zopesupport.ZopeFanstaticResource object at 0x10147c0d0>, name: u'workflow.css'
>>
>> Mvh Sebastian
>>
>>
>> 1 feb 2011 kl. 21.20 skrev Sebastian Ware:
>>
>>> I have tried to follow the upgrade instructions to publish my static directory, but I can't access any files. It does however only complain about the actual file, so I am assuming it finds the directory but not the content. I have configured like this:
>>>
>>> resource.py
>>> from fanstatic import Library, Resource
>>> library = Library('protoncms', 'static')
>>>
>>> setup.py
>>> setup(name='ProtonCMS',
>>> [snip]
>>> entry_points={'fanstatic.libraries': ['protoncms = protoncms.resource:library']},
>>> [snip]
>>>
>>> configure.zcml
>>> <include package="zope.fanstatic" />
>>>
>>>
>>> then when I try
>>>
>>> tal:attributes="href static/mystyling.css"
>>>
>>> it won't find it the file, and I can't access from the browser using
>>>
>>> localhost:8080/test/@@/protoncms/mystyling.css
>>>
>>> either.
>>>
>>> Am I doing anything obviously wrong?
>>>
>>> Mvh Sebastian
>>> _______________________________________________
>>> Grok-dev mailing list
>>> Grok-dev at zope.org
>>> https://mail.zope.org/mailman/listinfo/grok-dev
>>
>
More information about the Grok-dev
mailing list