Python应用程序目录结构(Linux)
将python应用程序作为rpm/deb包安装到系统中时,构造python应用程序的最佳实践是什么? 应用程序代码大部分是用Python编写的,还有一些shell脚本、配置文件和日志文件 我正在考虑如下的结构Python应用程序目录结构(Linux),python,installation,package,dir,Python,Installation,Package,Dir,将python应用程序作为rpm/deb包安装到系统中时,构造python应用程序的最佳实践是什么? 应用程序代码大部分是用Python编写的,还有一些shell脚本、配置文件和日志文件 我正在考虑如下的结构 Python包放在哪里 我需要有应用程序的配置文件,但是Python包会使用它。将配置文件放在哪里 /opt/../app_name-1.0.0/ bin/ /*Here would be few shel
- Python包放在哪里
- 我需要有应用程序的配置文件,但是Python包会使用它。将配置文件放在哪里
bin/
/*Here would be few shell scripts I need*/
shell_script_1.sh
shell_script_2.sh
var/
log/
/* Log files */
app_name.log
notifications/
/* notifications, generated by app,
temporarily kept */
alert_1.tmp
alert_2.tmp
etc/
/*python package configuration*/
/*is it better to put this in package dir?*/
app_name.config
app_name/
/*Python package, the main content*/
__init__.py
app_name.py
a.py
b.py
config_file_reader.py
subpackage_1/
__init__.py
c.py
subpackage_2/
__init__.py
d.py
您可以将配置文件放在主目录中,许多应用程序都可以这样做(例如bash、vim…将python代码放在标准python目录中是最好的(例如/usr/local/lib/pythonX.Y/site包)。 不幸的是,我需要将源代码放入insde tha app dir,因此我将放入我认为第二好的位置: /opt/../app\u name-1.0.0/lib/python/app\u name/ 配置文件转到etc/
嗯,我不确定这是否符合标准,但对我来说似乎已经足够好了。是的,我想也可以。