[英]In python, how do I expose some command from my distutils package?
After installing django: 安装django后:
pip install django
I can immediately write: 我可以马上写:
django-admin.py startproject project
And django-admin.py
is somehow known to my system. 并且django-admin.py
以某种方式为我的系统所知。
I'm developing small webserver and distribute is using PIP - what should I put in my setup.py
to expose my runserver.py
file system-wide in the same manner as Django does? 我正在开发小型web服务器并使用PIP进行分发 - 我应该在setup.py
放置什么来以与Django相同的方式在系统范围内公开我的runserver.py
文件?
Use the scripts keyword to setup. 使用scripts关键字进行设置。 For example: 例如:
setup(...,
scripts=['django_admin.py']
)
The script is required to be executable. 该脚本必须是可执行的。
In some cases, an alternative is to specify a function in a module that should be an entry_point 在某些情况下,另一种方法是在模块中指定一个应该是entry_point的函数
setup(...,
entry_points={
'console_scripts':
['myscript = my.package.scripts:main'],
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.