Getting ready

Diesel uses a non-blocking technique with co-routines to write networking severs efficiently. As stated on the website, Diesel's core is a tight event loop that uses epoll to deliver nearly flat performance out to 10,000 connections and beyond. Here, we introduce Diesel with a simple echo server. You also need Diesel library 3.0 or any later version. You can do that with pip command:

 $ pip install diesel

If you encounter some issues in installing, make sure you have the dependencies installed. The following command should fix most of these errors:

$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev
  

You may need to run as a super-user depending on your operating systems configurations, since diesel installs some critical dependencies such as the cryptography module that requires admin privileges to install.

Diesel has some dependency issues in Python 3. Installing and getting it to work is easier with Python 2.

You may install diesel as follows:

$ sudo su
# pip install diesel
  

This will display the logs as follows while installing diesel:

Collecting diesel
Requirement already satisfied: http-parser>=0.7.12 in /usr/local/lib/python3.5/dist-packages (from diesel)
Requirement already satisfied: flask in /usr/local/lib/python3.5/dist-packages (from diesel)
Requirement already satisfied: greenlet in /usr/local/lib/python3.5/dist-packages (from diesel)
Requirement already satisfied: twiggy in /usr/local/lib/python3.5/dist-packages (from diesel)
Requirement already satisfied: dnspython in /usr/local/lib/python3.5/dist-packages (from diesel)
Collecting pyopenssl (from diesel)
Using cached pyOpenSSL-17.0.0-py2.py3-none-any.whl
Requirement already satisfied: Werkzeug>=0.7 in /usr/local/lib/python3.5/dist-packages (from flask->diesel)
Requirement already satisfied: Jinja2>=2.4 in /usr/lib/python3/dist-packages (from flask->diesel)
Requirement already satisfied: itsdangerous>=0.21 in /usr/local/lib/python3.5/dist-packages (from flask->diesel)
Requirement already satisfied: click>=2.0 in /usr/local/lib/python3.5/dist-packages (from flask->diesel)
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages (from pyopenssl->diesel)
Collecting cryptography>=1.7 (from pyopenssl->diesel)
Using cached cryptography-1.9.tar.gz
Requirement already satisfied: MarkupSafe in /usr/lib/python3/dist-packages (from Jinja2>=2.4->flask->diesel)
Requirement already satisfied: idna>=2.1 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.7->pyopenssl->diesel)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.7->pyopenssl->diesel)
Requirement already satisfied: cffi>=1.7 in /usr/local/lib/python3.5/dist-packages (from cryptography>=1.7->pyopenssl->diesel)
Requirement already satisfied: pycparser in /usr/local/lib/python3.5/dist-packages (from cffi>=1.7->cryptography>=1.7->pyopenssl->diesel)
Building wheels for collected packages: cryptography
Running setup.py bdist_wheel for cryptography ... done
Stored in directory: /root/.cache/pip/wheels/ff/a5/ef/186bb4f6a89ef0bb8373bf53e5c9884b96722f0857bd3111b8
Successfully built cryptography
Installing collected packages: cryptography, pyopenssl, diesel
Found existing installation: cryptography 1.2.3
Uninstalling cryptography-1.2.3:
Successfully uninstalled cryptography-1.2.3
Successfully installed cryptography-1.9 diesel-3.0.24 pyopenssl-17.0.0
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.208.97