When developing a web application of non-trivial size it can be challenging to find the relevant source file or class that is responsible for something you see on a web page.

PyCharm (currently my main development environment for python) provides a pycharm:// protocol handler, which makes it possible to link to a desired line of source code, e.g. from a link on your webpage, running in some kind of dev or debug mode.

For example, let's take this minimal Flask app

import inspect
from flask import Flask

app = Flask(__name__)

class Foo(object):
    def link(self):
        return 'pycharm://open?file={f}&line={n}'.format(

def hello_world():
    f = Foo()
    return '''
        Hello World!
        Where is class <a href="{url}">Foo</a>?

We have this silly class Foo, which only provides a method to generate a link to itself in the format pycharm://open?file=/absolute/path/to/file&line=123. When you put this in a web page, and click it, PyCharm helpfully opens the file and puts the cursor on the first line of the class:

PyCharm protocol handler in action