对于 PythonAnywhere:
我目前正在构建一个项目,我必须经常更改其中一个已安装的包(因为我在构建项目时正在向包中添加内容)。在 BASH 控制台中不断更新包是非常手动和费力的,每次我在本地进行更改时都要重新安装包。是否有更好的流程?
最佳答案
听起来您希望能够从本地计算机使用单个命令将一些更改推送到 PythonAnywhere,一种方法是将 PythonAnywere 用作 git 远程。 this post中有一些细节,但是,广义上:
username@PythonAnywhere:~$ mkdir my_repo.git
username@PythonAnywhere:~$ cd my_repo.git
username@PythonAnywhere:~$ git init --bare
然后,在您的 PC 上:
git remote add pythonanywhere username@ssh.pythonanywhere.com:my_repo.git
然后你应该能够从你的机器上推送到 PA 上的裸仓库
git push pythonanywhere master
然后您可以使用 Git post-receive hook通过您喜欢的任何方式在 PythonAnywhere 上更新包。一种可能是在 PythonAnywhere 上检查您的包:
username@PythonAnywhere:~$ git clone my_package ./my_repo.git
然后接收后 Hook 可以像这样简单
cd ~/my_package && git pull
关于python - 在 pythonanywhere 中更新自定义 python 模块的最佳实践或最有效的方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20078304/