Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
99d9f9e8
Commit
99d9f9e8
authored
Nov 24, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read servers' hostname from env HOST var
parent
367697ef
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
6 deletions
+17
-6
debug.sh
debug.sh
+5
-1
run.sh
run.sh
+5
-1
server_comex_registration.py
server_comex_registration.py
+7
-4
No files found.
debug.sh
View file @
99d9f9e8
...
@@ -2,7 +2,11 @@
...
@@ -2,7 +2,11 @@
#
#
# simple web server running server_comex_registration:app
# simple web server running server_comex_registration:app
gunicorn
-b
0.0.0.0:9090
\
if
[
-z
"
$HOST
"
]
then
export
HOST
=
"0.0.0.0"
fi
gunicorn
-b
$HOST
:9090
\
--log-level
debug
\
--log-level
debug
\
--access-logfile
test_gu_access.log
\
--access-logfile
test_gu_access.log
\
--error-logfile
test_gu_error.log
\
--error-logfile
test_gu_error.log
\
...
...
run.sh
View file @
99d9f9e8
...
@@ -2,4 +2,8 @@
...
@@ -2,4 +2,8 @@
#
#
# simple web server running server_comex_registration:app
# simple web server running server_comex_registration:app
gunicorn
-b
0.0.0.0:9090 server_comex_registration:app
if
[
-z
"
$HOST
"
]
then
export
HOST
=
"0.0.0.0"
fi
gunicorn
-b
$HOST
:9090 server_comex_registration:app
server_comex_registration.py
View file @
99d9f9e8
...
@@ -24,12 +24,16 @@ from ctypes import c_int32
...
@@ -24,12 +24,16 @@ from ctypes import c_int32
from
jinja2
import
Template
,
Environment
,
FileSystemLoader
from
jinja2
import
Template
,
Environment
,
FileSystemLoader
from
sqlite3
import
connect
from
sqlite3
import
connect
from
re
import
sub
from
re
import
sub
from
os
import
environ
# ============= read environ =============
MY_DEBUG_FLAG
=
(
'MY_DEBUG_FLAG'
in
environ
)
MY_HOST
=
environ
.
get
(
'HOST'
,
'0.0.0.0'
)
# ============= app creation =============
# ============= app creation =============
app
=
Flask
(
__name__
)
app
=
Flask
(
__name__
)
app
.
config
[
'DEBUG'
]
=
True
app
.
config
[
'DEBUG'
]
=
(
'MY_DEBUG_FLAG'
in
environ
)
# templating setup
# templating setup
...
@@ -216,6 +220,5 @@ def read_records(incoming_data):
...
@@ -216,6 +220,5 @@ def read_records(incoming_data):
########### MAIN ###########
########### MAIN ###########
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
# our app should be bound to an ip (cf. http://stackoverflow.com/a/30329547/2489184)
# our app should be bound to an ip (cf. http://stackoverflow.com/a/30329547/2489184)
# TODO read host ip from config
app
.
run
(
host
=
MY_HOST
)
app
.
run
(
host
=
'0.0.0.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