-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.py
31 lines (24 loc) · 850 Bytes
/
deploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from pathlib import Path
import subprocess
def create_virtualenv():
subprocess.run(['python', '-m', 'venv', 'venv'])
if os.name == 'posix':
subprocess.run(['source', str(Path('venv', 'bin', 'activate'))], shell = True)
elif os.name == 'nt':
subprocess.run([str(Path('venv', 'scripts', 'activate'))], shell = True)
def install_dependencies():
subprocess.run(['pip', 'install', '-r', 'requirements.txt'])
def deploy_application():
subprocess.run(['python', 'main.py'])
def main():
print("Starting deployment...")
print("Creating virtual environment...")
create_virtualenv()
print("Installing dependencies...")
install_dependencies()
print("Deploying application...")
deploy_application()
print("Deployment complete.")
if __name__ == "__main__":
main()