Embedding a PythonAnywhere console in any web page / blog post

written on Friday, May 11, 2012

Once you've built a web based Python console then you can pretty much stick it any where you want.

Anonymous PythonAnywhere consoles can now be embedded in a blog post like this:

The code for doing this is very simple.

<iframe
    style="width: 640px; height: 480px; border: none;"
    name="embedded_python_anywhere"
    src="https://www.pythonanywhere.com/embedded/">
</iframe>

Each console session actually follows the user around based on their a session-id cookie. So if you want to start afresh you'll have to clear that cookie. Otherwise it's actually an interesting feature because all your objects and imports still exist.

Now, wouldn't it be cool if you could also specify a block of code for it to run as well...

This entry was tagged IPython, Python and web development