What is the Best Practice or most efficient way to update custom python modules in pythonanywhere?

StackOverflow https://stackoverflow.com/questions/20078304

  •  31-07-2022
  •  | 
  •  

문제

For PythonAnywhere:

I am currently building a project where I have to change one of my installed packages frequently (because I am adding to the package as I build out the project). It is very manual and laborious to constantly update the package in the BASH console be reinstalling the package everytime I make a change locally. Is there a better process for this?

도움이 되었습니까?

해결책

It sounds like you want to be able to use a single command from your local machine to push up some changes to PythonAnywhere, one way to go about it would be to use PythonAnywere as a git remote. There's some details in this post, but, broadly:

username@PythonAnywhere:~$ mkdir my_repo.git
username@PythonAnywhere:~$ cd my_repo.git
username@PythonAnywhere:~$ git init --bare

Then, on your PC:

git remote add pythonanywhere username@ssh.pythonanywhere.com:my_repo.git

Then you should be able to push to the bare repository on PA from your machine with a

git push pythonanywhere master

You can then use a Git post-receive hook to update the package on PythonAnywhere, by whatever means you like. One might be to have your package checked out on PythonAnywhere:

username@PythonAnywhere:~$ git clone my_package ./my_repo.git

And then the post-receive hook could be as simple as

cd ~/my_package && git pull
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top