How to use autobahn.ws with django?
Question: Need for websockets in my project. Found out crossplatform solution
[autobahn.ws](http://autobahn.ws) but only tutorial for pure python is
available. How to use autobahn as chat server in django project?


Answer: Simply add the following bit of code to the python script where you setup your
websocket.

    
    
    if __name__ == '__main__': #pragma nocover
        # Setup environ
        sys.path.append(os.getcwd())
        os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
        import django
        django.setup()
    

Now your code that creates a web socket can make use of django models and
other features just as if it was a view.

