Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Friday, October 25, 2013

Variable placeholder conflict between AngularJs and Jinja2 template

It's quite common that in web page templates (diango or jinja2 templates) brackets "{{}}" are used as placeholders for template variables. When people want to use angularjs in those template files, angularjs might not work properly because it also uses "{{}}" to bind data model. A workaround for this is to redefine the templates; an example for Jinja2 template is as follows:
JINJA_ENVIRONMENT=jinja2.Environment( loader=jinja2.FileSystemLoader(os.path.dirname(__file__)), extensions=['jinja2.ext.autoescape'], variable_start_string='((', variable_end_string='))', autoescape=True)
After this step is done, in the template files, "(())" refers to template variables, and "{{}}" refers to AngularJs data model.

Thursday, May 09, 2013

Configure Apache 2.4 with Django (Python3.3) on windows

Installing/configuring Apache2.4 with Django on Linux is easy, while doing the same thing on windows can be tricky due to incompatible vc libs, win sdk libs, python libs and so on. I've tried to compile the mod_wsgi several times, but faced some strange errors (I'm sure make file is updated properly). I found a good site where you can get compiled wsgi module: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi .