python - 在 pythonanywhere 中更新自定义 python 模块的最佳实践或最有效的方法是什么?

标签 python module pythonanywhere

对于 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/

相关文章:

python - 渲染存储在 FTP 服务器上的 Jinja 模板

python - 如何测试 django 消息中是否存在某个级别

PythonAnywhere + 虚拟环境 : "Could not find platform dependent libraries <exec_prefix>..."

ios - Appcelerator IOS模块开发

javascript - ES6中同步加载运行时确定名称的模块

python - 在 PythonAnywhere 中更新导入模块后如何在控制台中查看新结果

python - 在 PythonAnywhere 上部署 Django 应用程序

python - Objective-C 字符串操作

python - 如何对文本文件执行二进制搜索以在 python 中搜索关键字?

ruby - 将 Ruby 方法与子类中的重写隔离开来? (像 Java 的私有(private)方法)