我想将用python编写的discord bot用于开发过程,但是我无法完成它。在docker-compose中就是这样:
discord_bot:
build: ./discord
volumes:
- ./discord:/usr/src/discord
depends_on:
- mongo
- node
有没有办法在仍然使用discord.py的同时热重新加载此代码?
如果您希望它在本地开发的代码更改时自动重新加载,那么您拥有的内容大多是正确的。你缺少的一件事是通过某种文件监视器启动主进程。你可以使用nodemon with python,或者专门为python找一些等价物。
您需要做出的更改:
discord_bot:
build: ./discord <--- Should include file watcher executable (nodemon or some python equivalent)
command: nodemon /usr/src/discord/index.js <--- add this line
volumes:
- ./discord:/usr/src/discord
depends_on:
- mongo
- node