Cython for a Django app: would it work?

Yes, we have done it. But it point of consistent pain.

We make a commercial product which is installed on the customer premise to manage their Genesys power contact center. The core of the application is written in Django and we wanted to protect (limit) the code from inspection.

There is a speed improvement from running in native python but it is not a considerable difference. The improvement depends on the type of task, sometimes up to 30% sometimes minimal.

We run into issues from time to time where something works in Python but then it does not in Cython. I would not recommend this path unless you have a really good motivation.

Currently version runs on Python 3.5 with Django 1.11

I know It is too late to answer. Even though It might help. I have created a file in the project home directory.

from distutils.core import setup
from Cython.Build import cythonize
fileSet = set()

Scan your app directories and add files to the fileSet whatever you want to compile., and are just examples only.

Finally, just run the file as below

python build_ext --inplace 

Then Cython stats compiling each file and makes it .so file. Example: app1/ app2/ app3/

These files are shared object files and you cannot interpret manually. Delete all .py and .pyc files. And then run your project as

python runserver

or you can host these binaries in your production server. I tried on NGINX, uWSGI.

Good Luck.