Skip to content

Instantly share code, notes, and snippets.

@akmamun
Created March 27, 2019 09:51
Show Gist options
  • Save akmamun/52d8d3b5c34691e070bd5b2d62f1380d to your computer and use it in GitHub Desktop.
Save akmamun/52d8d3b5c34691e070bd5b2d62f1380d to your computer and use it in GitHub Desktop.
Protecting Python and Flask App Sources With Cython
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
from Cython.Build import cythonize
ext_modules = [
Extension("test", ["test.py"]),
]
setup(
name='Test Compile',
cmdclass={'build_ext': build_ext},
ext_modules=cythonize(ext_modules,
compiler_directives={'always_allow_keywords': True}, # 'always_allow_keywords' for avoid flask error
)
)
# than call
# add a main.py where flask app is call and run main.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment