Jinja Template Engine Three Ps Primer Tutorial

Jinja Template Engine Three Ps Primer Tutorial

Jinja Template Engine Three Ps Primer Tutorial

Today we are taking a look at Python’s Template Engine called Jinja.

Many programmers today make use of templating techniques with languages like Python and PHP to …

  • achieve things faster by placing programming logic into templates
  • web pages generally run faster with templating techniques
  • templating techniques aid with beautiful looking code (where looping statements stand out more)

So, today, with our Mac OS X local (MAMP) web server system, we show you a Python (2.7.10, for us) package manager pip install of Jinja (where we needed to have “sudo -H python -m ” prefix to command, but you may not) …


sudo -H python -m pip install markupsafe
sudo -H python -m pip install jinja2

… (ie. version 2 of Jinja).

Today, we are just introducing you to Jinja, so we started by looking up Wikipedia about it, and based some Python code around what was found there, but it ended up adding quite a bit of extra functionality parts to the top one of the list below …

  • wrote the Python skeletal logic for creation of HTML showing a comma separated list of 6 items via a Template render() method … and then over the course of today we (also) …
  • allowed for those 6 items to be defined from a command line call of this same Python code … and then thought …
  • this is a “Three P’s Ride Again” scenario (if ever I saw a “Three P’s Ride Again” scenario) so let’s set up a “Three P’s Ride Again” scenario post haste, centring on some PHP which …
    1. can be called in our favourite 3 modes of use, namely Web Browsing, and at command line and via curl to …
    2. look for $_GET[] and/or $_POST[] calls (of itself) (representing the HTML form (method=POST action=callYourself) which it creates for itself at the end of its HTML (regardless)) and if existant arrange for the Python command line call (with argument list) be executed using the PHP exec method … and for …
    3. command line and curl modes of use, call on Perl (using its system() method) to call on (this same) Python to perform the (templating) work

So here are the Three Ps and their source code for this Jinja (Python) Template engine web application …

If this was interesting you may be interested in this too.

This entry was posted in eLearning, Tutorials and tagged , , , , , , , , , , . Bookmark the permalink.

11 Responses to Jinja Template Engine Three Ps Primer Tutorial

  1. content says:

    Appreciating the time and energy you put into your website and detailed information you provide. It’s awesome to come across a blog every once in a while that isn’t the same out of date rehashed material. Excellent read! I’ve bookmarked your site and I’m adding your RSS feeds to my Google account.|

  2. Soon after study numerous the websites with your website now, and that i genuinely appreciate your method of blogging. I bookmarked it to my bookmark internet site list and are checking back soon. Pls have a appear at my web page likewise and let me know if you agree.

  3. *very nice post, i undoubtedly enjoy this web site, maintain on it

  4. Vernia Mudra says:

    Of course, there is one drawback (that’s always the case, isn’t it?) If you’re an overseas viewer, you won’t be able to watch these shows online directly at the broadcast websites due to the way proxies are set up, but there are some alternatives for you as well.

  5. Excellent day! This really is kind of off topic but I want some support from an established blog. Is it very difficult to set up your personal blog? IÒ€ℒm not quite techincal but I can figure points out pretty fast. IÒ€ℒm thinking about setting up my own but IÒ€ℒm not confident exactly where to start. Do you have any guidelines or suggestions? Appreciate it

  6. lampy says:

    I went over this web site and I believe you’ve got a great deal of fantastic information, saved to favorites (:.

  7. Wow, fantastic weblog layout! How long have you been blogging for? you make blogging appear easy. The overall look of your internet site is fantastic, let alone the content!

  8. I want to show my thanks to you just for rescuing me from such a predicament. Because of searching throughout the world wide web and coming across thoughts that were not valuable, I thought my entire life was well over. Living without the approaches towards the issues you’ve solved as a result of your main guide is really a crucial case, as properly as the kind which might have adversely damaged my career if I had not noticed your internet page. Your actual skills and kindness in dealing with all the stuff was crucial. I don’t know what I would’ve done if I had not come upon such a step like this. I can at this time look ahead to my future. Thanks so significantly for the impressive and effective help. I will not be reluctant to recommend your web internet sites to any individual who really should receive guidelines on this issue.

  9. HIFU says:

    After I initially commented I seem to have clicked on the -Notify me when new comments are added- checkbox and now whenever a comment is added I receive 4 emails with the same comment. There has to be a way you can remove me from that service? Thank you!

  10. I wish to show thanks to the writer for bailing me out of this type of trouble. Just after surfing around throughout the search engines and seeing advice which are not beneficial, I thought my entire life was over. Living without the strategies to the issues you have sorted out by way of your good write-up is a critical case, and the kind that could have in a negative way affected my career if I hadn’t encountered your web blog. Your competence and kindness in controlling all areas was crucial. I am not sure what I would’ve done if I had not come across such a step like this. I can also at this moment look forward to my future. Thanks so much for this specialized and results-oriented guide. I will not be reluctant to suggest your site to any individual who requires direction about this issue.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>