By continuing to navigate on this website, you accept the use of cookies to serve you more relevant services & content.
For more information and to change the setting of cookies on your computer, please read our Cookie Policy.

Running Django with PyPy to boost performance

PyPy:

PyPy is an alternative python interpreter which focuses on speed and memory. PyPy uses JIT compiler. PyPy is a replacement for CPython. It is built using the RPython language that was co-developed with it. The main reason to use it instead of CPython is speed.

PyPy Installation:

   Ubuntu 12.04 - 14.04: Download https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2

   Now you can uncompress them either somewhere in your home directory or, say, in /opt, and if you want, put a symlink from somewhere like /usr/local/bin/pypy to /path/to/pypy-5.1.1/bin/pypy. Do not move or copy the executable pypy outside the tree – put a symlink to it, otherwise it will not find its libraries.

   ArchLinux:

              pacman -Sy pypy # for python2
              pacman -Sy pypy3 # for python3

 

Let's Create and run pypy_django app:

1. Create pypy virtualenv:

     Run the following command to create pypy based virtualenv:

virtualenv -p /usr/local/bin/pypy env  # if you used different path for pypy installation change the path as required

2. Install django:

     First activate the env and then run the follwing command to install django

pip install django

3. Create a django project and run using pypy interpreter.

    To create a django project run the cmd:

django-admin startproject pypy_django

    To run the django project with pypy simply do

./manage.py runserver

Since our virtualenv links to pypy interpreter, the project now runs with pypy virtualenv

Now you can see a welcome page of Django at http://localhost:8000/

    Posted On
  • 24 August 2014
  • By
  • Micropyramid

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
Querying with Django Q objects

Querying with Django Q objects: Q object encapsulates a SQL expression in a Python object that can be used in database-related operations. Using Q objects ...

Continue Reading...
What's great about Django girls to inspire women into programming

Django girls is a non-profit organization, that helps women to learn Django programming language and to inspire them into programming. They are organizing workshops all ...

Continue Reading...
Set Up Travis CI For Django project

Travis CI is a continuous integration service used to build and test applications hosted at GitHub. Here are simple steps to add CI to you ...

Continue Reading...
open source packages

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties