Closed krystian566 closed 9 years ago
from jinja2 import Environment, PackageLoader
env = Environment(loader=PackageLoader('portfolio','./views'))
template = env.get_template('new.html')
version = 'progress version v{0}'.format(__version__)
y = template.render(the = version)
My progress right now.
I think is not good place for this problem
Hey Krystian,
I'm not entirely sure what you're trying to do here, but if you wanted to return a different template you would do something along the lines of the following:
from watson.framework import __version__
class MyClass(controllers.Action):
@view(template='edit') # change this to the template you want to render if you want something different than the defaults
def create_action(self):
return {'version': __version__}
Have you had a look at the "Your First Application" in the docs? http://watson-framework.readthedocs.org/en/latest/getting-started/your-first-application.html
Good day Simon. yes i get some issue when i change those code line. @view(template='edit') default @view(template='get') or @view(template='controler_name/get') i try to @view(template='menu') // 'views/menu.html' What to do. Copy part of html code from view and return in template by adding some variables. General save time to prove something :)
Thank.
I forget import views I get those message:
'module' object is not callable
or by type watson.jinja2 or watson.framework.jinja2 import
http://jinja.pocoo.org/docs/dev/api/#basics