Closed MahamdiAmine closed 6 years ago
from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid.view import view_config
@view_config(route_name='hello_world', renderer='hello.jinja2') def hello(request): return dict(name='World')
if name == 'main': config = Configurator() config.include('pyramid_jinja2') config.add_route('hello_world', '/') config.scan() app = config.make_wsgi_app() server = make_server('0.0.0.0', 6543, app) print ('Serving at http://127.0.0.1:6543') server.serve_forever()
You must install pyramid_jinja2 via e.g.
pip install pyramid_jinja2
from wsgiref.simple_server import make_server from pyramid.config import Configurator from pyramid.view import view_config
@view_config(route_name='hello_world', renderer='hello.jinja2') def hello(request): return dict(name='World')
if name == 'main': config = Configurator() config.include('pyramid_jinja2') config.add_route('hello_world', '/') config.scan() app = config.make_wsgi_app() server = make_server('0.0.0.0', 6543, app) print ('Serving at http://127.0.0.1:6543') server.serve_forever()