-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathrunserver.py
More file actions
31 lines (25 loc) · 769 Bytes
/
runserver.py
File metadata and controls
31 lines (25 loc) · 769 Bytes
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
#!/usr/bin/env python
from multiprocessing import Process
import subprocess
import os
import configparser
_conf = configparser.ConfigParser()
_conf.read('src/deploy.conf')
OutIp = _conf.get('host', 'ipaddress')
BASEPATH = os.path.dirname(os.path.abspath(__file__))
def startdjango():
os.chdir(os.path.join(BASEPATH, 'src'))
subprocess.call('python3 manage.py runserver 0.0.0.0:8000', shell=True)
def startnode():
os.chdir(os.path.join(BASEPATH, 'webpage'))
subprocess.call('npm run dev', shell=True)
def main():
print('请访问%s'%OutIp)
django = Process(target=startdjango, args=())
node = Process(target=startnode, args=())
django.start()
node.start()
django.join()
node.join()
if __name__ == "__main__":
main()