forked from zimmerman-team/IATI.cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
33 lines (26 loc) · 817 Bytes
/
fabfile.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
32
33
import re
from fabric.api import local
from fabric.api import run
from fabric.api import env
def get_oipa_port():
"""
Get OIPA ssh port from `vagrant ssh-config` command
"""
result = local('vagrant ssh-config', capture=True)
for line in result.split('\n'):
match = re.findall(' Port (?P<port>\d+)', line)
if len(match):
return match[0]
return None
def serve():
"""
Serve django dev server on localhost:19088
"""
port = get_oipa_port()
if port is None:
print("Can not find OIPA instance port. Abort.")
return
env.password = 'vagrant'
env.use_ssh_config = True
run('/home/vagrant/.env/bin/python /vagrant/OIPA/manage.py runserver 0.0.0.0:8080')