mirror of
https://github.com/MeoProject/lx-music-api-server.git
synced 2025-05-23 19:17:41 +08:00
chore: 优化启动脚本
This commit is contained in:
parent
92a69f048d
commit
5442e3340b
12
package.json
12
package.json
@ -3,11 +3,11 @@
|
||||
"version": "2.0.0.beta-12",
|
||||
"description": "一个适配 LX Music 的 API 后端实现",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev": "poetry run python poetry_run.py development",
|
||||
"prod": "poetry run python poetry_run.py production",
|
||||
"development": "poetry run python poetry_run.py development",
|
||||
"production": "poetry run python poetry_run.py production",
|
||||
"install": "poetry install"
|
||||
"dev": "python run.py development",
|
||||
"prod": "python run.py production",
|
||||
"install": "pip install -r requirements.txt",
|
||||
"poetry:install": "poetry install",
|
||||
"poetry:development": "poetry run python run.py development",
|
||||
"poetry:production": "poetry run python run.py production"
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
import os
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
def main_production():
|
||||
os.environ['CURRENT_ENV'] = 'production'
|
||||
subprocess.run(["python", "main.py"])
|
||||
|
||||
def main_development():
|
||||
os.environ['CURRENT_ENV'] = 'development'
|
||||
subprocess.run(["python", "main.py"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Script to set environment variables and run different environments.")
|
||||
parser.add_argument("environment", choices=["production", "development"], help="Specify the environment to run.")
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
if args.environment == "production":
|
||||
main_production()
|
||||
elif args.environment == "development":
|
||||
main_development()
|
||||
except KeyboardInterrupt:
|
||||
pass
|
21
run.py
Normal file
21
run.py
Normal file
@ -0,0 +1,21 @@
|
||||
import os
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(escription="Script to set environment variables and run different environments.")
|
||||
parser.add_argument(
|
||||
"environment",
|
||||
choices=["production", "development"],
|
||||
nargs="?",
|
||||
default="production",
|
||||
help="Specify the environment to run.",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
if args.environment:
|
||||
os.environ["CURRENT_ENV"] = args.environment
|
||||
subprocess.run(["python", "main.py"])
|
||||
except KeyboardInterrupt:
|
||||
pass
|
16
setup.py
16
setup.py
@ -9,16 +9,16 @@ except Exception:
|
||||
description = "Description not available"
|
||||
|
||||
setup(
|
||||
name='lx_music_api_server_setup',
|
||||
name="lx_music_api_server_setup",
|
||||
version=version,
|
||||
scripts=['poetry_run.py'],
|
||||
author='helloplhm-qwq',
|
||||
author_email='helloplhm-qwq@outlook.com',
|
||||
scripts=["run.py"],
|
||||
author="helloplhm-qwq",
|
||||
author_email="helloplhm-qwq@outlook.com",
|
||||
description=description,
|
||||
url='https://github.com/helloplhm-qwq/lx-music-api-server',
|
||||
url="https://github.com/helloplhm-qwq/lx-music-api-server",
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 3',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: OS Independent',
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user