python - Template render on HTML AND CSS using Google App Engine -
i'm working on website hosted on gae. has not been update since while, now, i'm trying made refresh of :d
to trick, try use mvc model using python , wsgi, webapp2 , render.template.
everything goes right, except css part.
indeed, can't render part of css using gae (django) method. python controller calling html file , replace variables dict() values correctly.
but now, , able have restricted amount of css file, i'm trying same thing.
unfortunatly don't know how i'm suppose call css file.
i'm calling css on html usual:
<link rel="stylesheet" media="screen" type="text/css" href="/assets/css/struct/index.css"> and trying dynamically render part of file:
header#navigation{ height:auto; min-height:480px; width:100%; min-width:100%; background-image:url('/assets/img/content/{{content_cat_name}}/cat_img.jpg'); background-repeat:no-repeat; background-position: left top; background-size:contain; background-color:#efefef; } and call python code this:
class urihandler(webapp2.requesthandler): def get(self, subdomain, page): name = subdomain pattern = os.path.join(os.path.dirname(__file__), '../views' ,'index.html') template_values = { 'content_cat_name':name, 'cat_menu_title':name, 'cat_menu_text':name, } self.response.out.write(template.render(pattern, template_values)) so, if me correctly call css , replace variables using python script, i'll happy :d in advance.
template.render can replace tokens in file specify in path parameter (the first parameter). you're serving .css file out of static directory, no token replacement happens, because file's not getting passed through code.
you inline parts of css contain tokens in index.html file.
Comments
Post a Comment