Created
October 18, 2021 10:15
-
-
Save naimurhasan/a737e869e55cd40bf776a2e914fa5fd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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