TeCoEd (Teaching Computing Education)
  • Home
    • Freelance
    • Book
    • Downloading
  • Python
    • Learn Python >
      • Python Modules
    • PyGame Zero
    • Python Programs >
      • Higher or Lower
      • Magic Calculator
      • Password Checker
      • Python Pit
    • What's News App
    • Pixels to Cells
    • Python Mosaics
    • Python OCR
    • L-1-AM
    • Web Scraping >
      • Scraping Trains
    • Weather App
    • Snakes and Windows
    • Python Web Server >
      • Flask
    • Python Picks
  • Ras Pi
    • All About the Pi
    • Getting Started
    • Remote Desktop and VNC
    • Static IP Address
    • Sonic Pi >
      • 3.14
    • Twitter Feed >
      • Tweepy
    • Android & Pi >
      • Advanced Apps
      • Odds
    • A.I on the the Pi
    • CRON
    • Pick Your Own
  • Pi Hardware
    • Pi HATS >
      • Sense Hat Hacks
      • AstroPi HAT
      • Unicorn-HAT >
        • Unicorn Alphabet Disco
        • Uni Codes / Programs
      • Skywriter
      • Piano HAT
    • STS Pi
    • Pi Camera >
      • Pi-Cam, Python & Email >
        • Time Lapse
      • Pi Noir
    • Pipsta >
      • Flask, Input & Printers
    • Raspberry Pi Power >
      • Energenie IR power
    • Pibrella
    • Distance Sensor
    • LCD Screen
    • Pi-Tooth
    • Robot Arm
    • PiGlow
    • PiFM
    • Accelerometer
    • PiFace >
      • Installing PiFace >
        • Python Commands
  • Pi-Hacks
    • Drone Hacks
    • Pi Glue Gun Hack
    • Blinkt!
    • Sonic Pixels
    • R2D2
    • Get to the chopper
    • Astro Bird
    • Twitter Translator
    • Hacking a Robot
    • Nature_Box >
      • Best Nature Photos
    • Wearable Tech >
      • Project New York
      • P.N.Y Part 2 Health
      • P.N.Y Part 3 Games
      • P.N.Y Part 4 Translation
    • Dino-Tweet
    • Other Links
  • Pi-Hacks 2
    • The Joker
    • Hologram Machine
    • Google Vision: Camera Tell
    • Yoda Tweets
    • Pi Phone
    • Darth Beats
    • Twitter Keyword Finder
    • Crimbo Lights Hack
    • Xmas Elf
    • Halloween 2016
    • Halloween Hack 2015
    • Socrative Zombie
    • Voice Translation
    • The Blue-Who Finder
    • GPIO, Twitter
    • Pi Chat Bot >
      • Dictionary Definitions
    • PiGlow & Email
    • Pibrella Alarm System
    • SMS with Python >
      • Spooking a Mobile
  • Pi-Hacks 3
    • LED Dance Suit
    • Ferminal
    • Crypto Tracker
    • David Bowie
    • Lamp Prank >
      • TEST
    • Yoda FM
    • Retro Player
    • LED Pixel Art
    • TARDIS
    • Battleships
    • LED Board
    • Night Vision
    • Enviro+ Weather
  • Minecraft
    • Minecraft API
    • Minecraft Sweeper
    • PiGlove: Minecraft Power Up
    • Minecraft Photo-booth
    • Rendering Pixels
    • Speed Cube
    • Lucky Dip
  • Computing
    • Why Computing?
    • Can You Compute
    • micro:bit
    • Coding Resources
    • Learn to Code >
      • Coding with iPads
      • Apps Creation Tools
      • sKratchInn
      • Sound Editing
    • Cheat Sheets
    • Theory
    • HOUR OF CODING
    • BEBRAS Computing Challange
    • Computer Facts
    • Free Software and Links
  • Contact Me
  • Random Hacks
    • Movile

What is it?


So you have Raspberry Pi and you are creating lots of exciting new projects and code and you want to back them up or save them or even share them with others.  

You can use USB pens but this can be a faff on, especially if you are away from the Pi and want to access it.  What do you do?
You will have heard of snake charming? Well Python can be charmed to serve you, well to serve your files.  

Python has a really simple but powerful feature that can be used to share any file or folder from your Raspberry Pi.  

A Simple Webpage


You may be familiar with using HTML to code a webpage.   The Python Server also doubles up as a simple method for hosting your webpage or website. Firstly, 
  1. Create a new folder to save the webpage in, let's call it Page 
  2. Within the folder create a new text document and add your HTML code
  3. Save the file as index.html
  4. Open the LX Terminal
  5. Navigate to the 'Page folder' using the cd Page 
  6. type python -m SimpleHTTPServer 8000 to start the server
  7. Open your web browser on any device and enter the IP address of the Raspberry Pi and the port 8000, For example, http://192.156.5.56:8000.
  8. Your website will be displayed

Charming Example 



How to Share


Load the LX Terminal and type:
python -m SimpleHTTPServer 8000

This sets up your Raspberry Pi as a simple web server that can now be accessed via any web browsers on another devices.  You can view your files and open / download them by doing to another device and type in your IP Address, colon, 8000 into the address bar of your browser.  For example, http://192.156.5.56:8000.  If you do not know your IP Address,

Load the LX Terminal and type:
Hostname -I

This python command will probably share every single file / folder on your Raspberry Pi which is not really advisable or secure practice. It is therefore best to navigate to the folder that you want to share and then run the Python sever.  

Load the LX Terminal and type:
cd nameofthefolderyouwanttoshare
python -m SimpleHTTPServer 8000

If you refresh your browser page F5 you should see that only the contents of this folder are now shared and accessible.
Powered by Create your own unique website with customizable templates.