Showing results for 
Search instead for 
Did you mean: 
Valued Contributor I

Setting Up Distribute and Flask Web Server on Galileo

Hi All

I haven't seen anyone use Flask on the Galileo, which is a shame as it is a great way to include a web interface in your projects

Distribute is a way of installing programs, and you may have used it on other platforms with the command "easy_install" and Flask is a really nice, easy to use, Web Server.

Below are my notes on how to set up a Galileo and used Flask. I assume you are familiar with how to work with Linux and are coming from a background with Arduino and/or Raspberry Pi.

If you already have AlexT's uClibc-based distribution of Yocto running and a text editor you like, you can skip to Install distribute and Flask below.


If confused as to what you are running, see /message/241845# 241845 241845 for a discussion of different versions.

First things is to get the Galileo up and running.


There are a number of good tutorials, such as one I like at SparkFun.


Do not forget to update the firmware or will have problems.

When you reach the part about installing the bigger form of Linux, download Alex's developmental version of Linux.


You can check /message/239581# 239581 239581 to find the latest version.


But for now it is at


Uncompress and copy to a micro SD card. You can now insert the micro SD card and power up the Galileo.

Finding the IP address and hostname 

As discussed on Clay and Galileo ( there are a number of ways to connect to the Galileo.

Since the system at my university assigns new IP addresses every time one connects and the each SD card has a different name, I like to have a small screen display the hostname and IP address, as it makes connecting easier.

In addition, since the Galileo is so easily damaged if the USB cable is left in when power is lost, and a normal LCD shield or screen uses a lot of GPIO pins, I would suggest using an I2C LCD.


You can set up a I2C backpack LCD or Grove RGB LCD to show IP address following instructions at /thread/57741?sr=inbox

If you want to use an LCD screen, the following sketch will display the IP address onto an DFRobot LCD screen. Just be sure to remove the USB cable once the sketch is loaded so you don't forget and turn power off with it connected.





Richard Bradley


Program to display IP Address on DFRobot LCD Shield


Note: Ethernet cable must be plugged in prior to starting Galileo or it won't get an address


Note: Need to put electrical tape on LCD or will short against Ethernet port connector


Note: Needs updated Liquid Crystal Library


Download and put in Sketches/library directory


Based on sketches from




and /thread/45335




The circuit:


* LCD RS pin to digital pin 12


* LCD Enable pin to digital pin 11


* LCD D4 pin to digital pin 5


* LCD D5 pin to digital pin 4


* LCD D6 pin to digital pin 3


* LCD D7 pin to digital pin 2


* LCD R/W pin to ground


* 10K resistor:


* ends to +5V and ground


* wiper to LCD VO pin (pin 3)



// include the library code:


# include


// initialize the library with the numbers of the interface pins


LiquidCrystal lcd(8, 9, 4, 5, 6, 7);


char FileBuffer[15]; //set up space to read in files

void setup() {


// set up the LCD's number of columns and rows:


lcd.begin(16, 2);


// Print a message to the LCD.


lcd.setCursor(0, 0);


lcd.print("Welcome to VGU!");


// initialize serial communications:




// Start the telnet server on Galileo


system("telnetd -l /bin/sh");





void loop()




// Call ifconfig, pipe through grep to get ipaddress and redirect to file in /home/root


system("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'>/home/root/ip.txt");


FILE *fp;




fgets(FileBuffer, 15, fp);




lcd.setCursor(0, 1);







Set up access to Alex's repository</st...

0 Kudos
1 Reply
Valued Contributor I

Hi All

Matt Richardson put up a great little tutorial on Flask for Raspberry Pi where he set up a web server that controlled pins via a web page Serving Raspberry Pi with Flask - Matt Richardson, Creative Technologist

I ported the example to the Galileo using wiring_x86 (see /message/266970# 266970 266970 for how to set up wiring) and am controlling LEDs using pins 13 & 7 (BTW - make sure you use a resistor with pin 7 (I used 390R as didn't need it so bright) or you will burn out the LED quickly)

You can easily modify this to control multiple devices.

After you install wiring_x86 you can copy the attached files to /media/realroot and run

Since the webserver is using port 80, you just need to put in your IP address, or .local (if you have bonjour running) in the URL line of your browser

For an explanation of how it works, please go to Matt Richardson's website mentioned above.

Hope it is useful to someone.

Merry Christmas