用于 Django 应用程序的 Cython:它会起作用吗? [英] Cython for a Django app: would it work?

查看:47
本文介绍了用于 Django 应用程序的 Cython:它会起作用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 cython 进行编译是否可以与 python 3.4 Django 应用程序一起使用,或者可以在不付出大量努力的情况下使其工作?

Would compiling with cython work with a python 3.4 Django app, or could it be made to work without a huge amount of effort?

这个答案 - https://stackoverflow.com/a/7347168/805141 - 关于保护 python 的问题代码提示我问这个问题.

This answer - https://stackoverflow.com/a/7347168/805141 - to a question about protecting python code prompted me to ask this question.

之前已经问过一个类似的问题,但关于提高性能:在 Django 中使用 Cython.有意义吗?

A similar question has been asked previously but with regards to improving performance: Using Cython with Django. Does it make sense?

推荐答案

是的,我们已经做到了.但它指向持续的痛苦.

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

我们制作了一款安装在客户场所的商业产品,用于管理他们的 Genesys 电力联络中心.应用程序的核心是用 Django 编写的,我们希望保护(限制)代码不被检查.

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.

在原生 python 中运行速度有所提高,但差别不大.改进取决于任务的类型,有时高达 30%,有时极小.

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.

我们不时会遇到一些问题,某些东西在 Python 中可以运行,但在 Cython 中却不起作用.除非你有很好的动机,否则我不会推荐这条路.

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.

当前版本在 Python 3.5 和 Django 1.11 上运行

Currently version runs on Python 3.5 with Django 1.11

这篇关于用于 Django 应用程序的 Cython:它会起作用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆