Category archives: Python

Notices about Python programming language.

RSS feed of Python

Last update on .

###Install redis server

sudo apt-get install redis-server

Install tornado-redis package. Add this line to the requirements.txt file.


Run installer

pip install -r requirements.txt

Import tornadoredis and json package in the script.

import tornadoredis
import json

Connect to the redis server. Define the function.

class ChatConnection(SockJSConnection):
    def ...

Last update on .

Making video chat Django AngularJs Tornado SockJS.

Install Django

virtualenv vc_ve
cd vc_ve
source ./bin/activate

Create requirements.txt

echo 'Django' > requirements.txt

Install django

pip install -r requirements.txt

Create project startproject chat
cd chat

Install nodejs npm and bower

apt-get install nodejs
apt-get install npm
npm install -g bower

Create ...

Last update on .

Subscribing to the chat room.

Insert input box and button in our template

                <button id="subscribe" class="but">Subscribe</button>
                <input type="text" id="room"  /> room name

Bind this button to new function.

                sock.send_message({ action: 'connect', user_id: $("#room").val(), source: 'chat_side' })

Create new function 'send_message' inside websocket object.

            $("#connect").click ...

Last update on .

Install nodejs

sudo apt-get install nodejs

Make a simlink to binary file for old version of nodejs

ln -s /usr/bin/nodejs /usr/bin/node

Install npm

sudo apt-get install npm

Install bower

sudo npm install bower

Create new directory

mkdir chat

cd chat

Create installation package file bower.json

  "name": "chat",
  "version ...