简体   繁体   English

特定的本地 Django 部署。 织物?

[英]Particular local Django deployment. Fabric?

I had developed a classic Python Django web application on my local enviroment.我在本地环境中开发了一个经典的 Python Django Web 应用程序。 Then, I used Cython to compile some my app's modules as dynamic library (*.so files) to "protect" the source code.然后,我使用 Cython 将我的一些应用程序模块编译为动态库(*.so 文件)以“保护”源代码。 Now, I need to distribute my Django app to one customer (for testing purpose) and I want to provide you all my Django app (with its files) but without some specific files and folders (ex: .git folder, *.pyc, *.py, javascript unobfuscated sources, etc...).现在,我需要将我的 Django 应用程序分发给一位客户(用于测试目的),我想向您提供我所有的 Django 应用程序(及其文件),但没有一些特定的文件和文件夹(例如:.git 文件夹、*.pyc、 *.py、javascript 未混淆源等...)。

I would like to have some bash command (ex: python setup.py local_deploy) to automatic copy entire app's folder to another folder (ex: build) and remove a specific list of folders or file patterns.我想要一些 bash 命令(例如:python setup.py local_deploy)来自动将整个应用程序的文件夹复制到另一个文件夹(例如:build)并删除特定的文件夹列表或文件模式。

Do you have any suggestion to do that?你有什么建议可以这样做吗?

I recommend you package your application for deployment, as you said, by running python setup.py sdist or another setuptools script command .正如您所说,我建议您通过运行python setup.py sdist其他 setuptools 脚本命令来打包您的应用程序以进行部署。

You can specify which package/modules/data to include and/or use a MANIFEST.in file to include/exclude files/directories matching specified patterns.您可以指定要包含的包/模块/数据和/或使用MANIFEST.in文件来包含/排除与指定模式匹配的文件/目录。

NB if you need to perform additional steps (besides selecting the correct files and packaging them), you may also add a custom command to setup.py .注意,如果您需要执行其他步骤(除了选择正确的文件并打包),您还可以向setup.py添加自定义命令 Though personally, I'd use a bash script / fabric to perform those, outside of packaging..虽然就个人而言,我会使用 bash 脚本/结构来执行这些,而不是打包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM