So I am trying out Glashammer with Google App Engine and it seems to
be working great. Though I am having one issue with
app.add_shared(...) method.
My project folder structure is:
project/
wekzeug/
glashammer/
jinja2/
...
main.py
static
shared/css/style.css
In my app setup, I am doing:
app.add_shared('static', 'static')
and in my template, I do:
{{ h.link('stylesheet', url_for('shared/static', filename='css/bauer.css')) }}
which gives me
<link href="/_shared/static/css/bauer.css" rel="stylesheet" />
and it does not work. Changing it to:
<link href="//static/css/bauer.css" rel="stylesheet" />
correctly references my stylesheet.
Looking deeper, I see in application.py/add_shared(...) method:
url = sep.join(['/_shared', name])
ep = sep.join(['shared', name])
Why is this being added?
Running the app as standalone app using gh-admin works correct.
The only part of code that seemed relevant was:
# now add the middleware for static file serving
self.add_shared('glashammer', sibpath(__file__, 'shared'))
self.add_middleware(SharedDataMiddleware, self._shared_exports)
What am I doing wrong?
--
Ritesh
http://www.riteshn.com
Thus, a command like:
app.add_shared('static', 'http://static.beamto.us')
{{ url_for('shared/static', filename='c.css') }}
becomes: /_shared/static/c.css
Can this be easily solved? Then it will be much easier to move your
static files to different storage services with one change. In
application.py/add_shared, the shared link is generated in an
hardcoded manner.
>> --~--~---------~--~----~------------~-------~--~----~
>> You received this message because you are subscribed to the Google Groups "glashammer" group.
>> To post to this group, send email to glash...@googlegroups.com
>> To unsubscribe from this group, send email to glashammer+...@googlegroups.com
>> For more options, visit this group at http://groups.google.com/group/glashammer?hl=en
>> -~----------~----~----~----~------~----~------~--~---
>>
>>
>
>
>
> --
> Ritesh
Ali
> --
> You received this message because you are subscribed to the Google Groups "glashammer" group.
> To post to this group, send email to glash...@googlegroups.com.
> To unsubscribe from this group, send email to glashammer+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/glashammer?hl=en.
>
>
Maybe an API to do such thing would be nice? I can help you write up a
patch for the same.
--
Ritesh
http://www.riteshn.com
add_shared() e.g. add_static() would be better.
or we can extend add_shared to have additional conditional parameters.
First of all, the download page: http://glashammer.org/downloads.html
seems to be really outdated. Its showing 0.1 while I have 0.2 and the
trunk is 0.3.
Anyway, before I start working on add_shared_ext(), I have a patch
that checks out WTForms currently when using gh-admin. Let me know if
that works for you.
I will start working on the other patch soon.
http://bitbucket.org/beamtous/glashammer-main-wtforms/
--
Ritesh
http://www.riteshn.com