Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Corsi
Templates
Base reveal.js POuL Template
Commits
b86a6648
Commit
b86a6648
authored
May 30, 2019
by
JackV
Browse files
deploy.py: kill the http server before closing the application
parent
21c41571
Changes
1
Hide whitespace changes
Inline
Side-by-side
deploy.py
View file @
b86a6648
...
...
@@ -20,10 +20,14 @@ parser.add_argument('--show', action='store_true', default=False,
arg
=
parser
.
parse_args
()
def
httpd_t
():
print
(
"Serving at http://{}:{}"
.
format
(
DEFAULT_ADDR
,
arg
.
port
))
s
=
TCPServer
((
DEFAULT_ADDR
,
arg
.
port
),
Handler
)
s
.
serve_forever
()
class
stoppable_httpd
(
Thread
):
def
run
(
self
):
print
(
"Serving at http://{}:{}"
.
format
(
DEFAULT_ADDR
,
arg
.
port
))
self
.
s
=
TCPServer
((
DEFAULT_ADDR
,
arg
.
port
),
Handler
)
self
.
s
.
serve_forever
()
def
stop
(
self
):
self
.
s
.
shutdown
()
def
show
():
...
...
@@ -31,8 +35,7 @@ def show():
if
__name__
==
'__main__'
:
httpd
=
Thread
(
target
=
httpd_t
)
httpd
.
daemon
=
True
httpd
=
stoppable_httpd
()
httpd
.
start
()
if
arg
.
show
:
...
...
@@ -42,4 +45,5 @@ if __name__ == '__main__':
while
True
:
sleep
(
60
*
60
*
24
)
except
(
KeyboardInterrupt
,
SystemExit
):
httpd
.
stop
()
sys
.
exit
(
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment