Skip to content

Instantly share code, notes, and snippets.

@naimurhasan
Created October 18, 2021 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naimurhasan/a737e869e55cd40bf776a2e914fa5fd9 to your computer and use it in GitHub Desktop.
Save naimurhasan/a737e869e55cd40bf776a2e914fa5fd9 to your computer and use it in GitHub Desktop.
def git_pull(request):
if request.GET.get('pass') != custom_key.pull_pass:
return HttpResponse("Wrong Password")
os.system('git checkout master')
os.system('git pull origin master')
with open('requirements.txt', 'r+') as f:
text = f.read()
text = text.replace('pkg_resources==0.0.0', '')
f.seek(0)
f.write(text)
f.truncate()
os.system('pip install -r requirements.txt')
os.system('git stash')
os.system('python manage.py migrate')
child = pexpect.spawn('python manage.py collectstatic')
child.expect('yes')
child.sendline('yes')
child.close()
child = pexpect.spawn('sudo systemctl restart gunicorn')
child.expect('password')
child.sendline(custom_key.gunicorn_pass)
child.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment