<div dir="ltr">Added to toaster-next and submitted to bitbake-devel.<div><br></div><div>Elliot</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 20 April 2016 at 18:46, Michael Wood <span dir="ltr"><<a href="mailto:michael.g.wood@intel.com" target="_blank">michael.g.wood@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Allow binding to a specified address and port to start the django<br>
development server on.<br>
Remove the assumption that you want to bind to 0.0.0.0 and set the<br>
default to localhost.<br>
Add some additional help text after Toaster webserver has started<br>
<br>
Signed-off-by: Michael Wood <<a href="mailto:michael.g.wood@intel.com">michael.g.wood@intel.com</a>><br>
---<br>
 bitbake/bin/toaster | 18 +++++++++++++-----<br>
 1 file changed, 13 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster<br>
index 2d07255..d48a773 100755<br>
--- a/bitbake/bin/toaster<br>
+++ b/bitbake/bin/toaster<br>
@@ -69,7 +69,7 @@ webserverStartAll()<br>
<br>
  Â  Â echo "Starting webserver..."<br>
<br>
-  Â  $MANAGE runserver "0.0.0.0:$WEB_PORT" \<br>
+  Â  $MANAGE runserver "$ADDR_PORT" \<br>
  Â  Â  Â  Â  Â  </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \<br>
  Â  Â  Â  Â  Â  & echo $! >${BUILDDIR}/.toastermain.pid<br>
<br>
@@ -79,7 +79,8 @@ webserverStartAll()<br>
  Â  Â  Â  Â retval=1<br>
  Â  Â  Â  Â rm "${BUILDDIR}/.toastermain.pid"<br>
  Â  Â else<br>
-  Â  Â  Â  echo "Webserver address:  http://0.0.0.0:$WEB_PORT/"<br>
+  Â  Â  Â  echo "Toaster development webserver started at http://$ADDR_PORT"<br>
+  Â  Â  Â  echo -e "\nYou can now run 'bitbake <target>' on the command line and monitor your build in Toaster, you can also use a Toaster project to configure and run a build.\n"<br>
  Â  Â fi<br>
<br>
  Â  Â return $retval<br>
@@ -180,7 +181,7 @@ fi<br>
 export TOASTER_DIR=`pwd`<br>
<br>
 WEBSERVER=1<br>
-WEB_PORT="8000"<br>
+ADDR_PORT="localhost:8000"<br>
 unset CMD<br>
 for param in $*; do<br>
  Â  Â case $param in<br>
@@ -194,7 +195,14 @@ for param in $*; do<br>
  Â  Â  Â  Â  Â  Â CMD=$param<br>
  Â  Â ;;<br>
  Â  Â webport=*)<br>
-  Â  Â  Â  Â  Â  WEB_PORT="${param#*=}"<br>
+  Â  Â  Â  Â  Â  ADDR_PORT="${param#*=}"<br>
+  Â  Â  Â  Â  Â  # Split the addr:port string<br>
+  Â  Â  Â  Â  Â  ADDR=`echo $ADDR_PORT | cut -f 1 -d ':'`<br>
+  Â  Â  Â  Â  Â  PORT=`echo $ADDR_PORT | cut -f 2 -d ':'`<br>
+  Â  Â  Â  Â  Â  # If only a port has been speified then set address to localhost.<br>
+  Â  Â  Â  Â  Â  if [ $ADDR = $PORT ] ; then<br>
+  Â  Â  Â  Â  Â  Â  Â  ADDR_PORT="localhost:$PORT"<br>
+  Â  Â  Â  Â  Â  fi<br>
  Â  Â ;;<br>
  Â  Â *)<br>
  Â  Â  Â  Â  Â  Â echo "$HELP"<br>
@@ -247,7 +255,7 @@ case $CMD in<br>
  Â  Â start )<br>
  Â  Â  Â  Â # check if addr:port is not in use<br>
  Â  Â  Â  Â if [ "$CMD" == 'start' ]; then<br>
-  Â  Â  Â  Â  Â  Â $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1<br>
+  Â  Â  Â  Â  Â  Â $MANAGE checksocket "$ADDR_PORT" || return 1<br>
  Â  Â  Â  Â fi<br>
<br>
  Â  Â  Â  Â # kill Toaster web server if it's alive<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.4<br>
<br>
--<br>
_______________________________________________<br>
toaster mailing list<br>
<a href="mailto:toaster@yoctoproject.org">toaster@yoctoproject.org</a><br>
<a href="https://lists.yoctoproject.org/listinfo/toaster" rel="noreferrer" target="_blank">https://lists.yoctoproject.org/listinfo/toaster</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Elliot Smith<br>Software Engineer<br>Intel Open Source Technology Centre</div></div></div>
</div>