Introduction: How to Set Up Blogpy on Raspberry Pi
I recently purchased a Raspberry Pi and I wanted to make a web server out of it. I found a blog generator called Blogpy that's written in Python. This is great because Raspberry Pi has Python built in. Blogpy uses Python 2.7 and the Python Markdown package. Here I will detail the installation process.
0. I will assume that you already have Raspian Wheezy installed on your Raspberry Pi. But I think this should work on other linux systems that's working on the Raspberry Pi.
1. First, you need to install Flask, and to do that you need to install PIP. So open up the LXTerminal, as we will do everything in the terminal, and type: "sudo apt-get install python-pip" (without the quotes). So your command line should look like this:
pi@raspberrypi ~ $ sudo apt-get install python-pip
type "y" for yes after a few seconds, when you see the prompt. After you are done, you will see "pi@raspberrypi ~ $" again. Then install Flask by typing:
sudo pip install flask
2. Install Blogpy by running this code:
git clone https://github.com/travisred/blogpy.git
This shouldn't take long, either.
3. Navigate to the blogpy folder by typing "ls" (that's a lowercase letter L, not the number 1, and the letter s), your command line should look like this:
pi@raspberrypi ~ $ ls
blogpy Documents ocr_pi.png Scratch
Desktop indiecity python_games squeak
"ls" lists all the contents in the folder. You see that the blogpy folder is in your home folder, navigate there by typing "cd blogpy/" in the command line. You can also view the contents in the blogpy folder by typing "ls" again:
pi@raspberrypi ~/blogpy $ ls
build.py md screenshot.png settings.pyc static
LICENSE.txt README.md settings.py site
4. Edit the "settings.py" file by running this code "nano settings.py" on the command line. Your command line should look like this:
pi@raspberrypi ~/blogpy $ nano settings.py
You can change the settings in this file. If you are running blogy live then have the site_root set to "http://www.yoursite.com/". I changed it to an empty string because I'm not running it live. This is just a test to see if I can get it working locally on Raspberry Pi. Below is my setting:
site_name = "blogpy"
site_root = ""
site_description = "A simple static blog generator in python"
number_of_posts_on_front_page = 3
Save this file by pressing Control-X, then press "y" to save it. Press Enter to save the file with the same name.
5. Install the Markdown package by running the code: "sudo easy_install markdown" in the command line.
6. Run the build.py file by typing "python build.py" in the command line. Your command line should look like this:
pi@raspberrypi ~/blogpy $ python build.py
7. Now you have blogpy all set up. Go to your home folder using the File Manager. It should be at /home/pi, open up the blogpy folder, then the site folder, and run the index.html on Midori. You should see a sample blog.
8. To add a post, go to blogpy folder, then the md folder. Here you see the "hello" file. You can copy the file, change the name, then edit the file to make a new post. Then you have to run "python build.py" again in the terminal to make the new page show up in the index.html
9. To make your blogpy site live, simply upload the contents of the "site" folder to your host's root directory.
NOTE: After I set up my blogpy site, the links to the posts don't seem to work. I don't know how to fix it. Maybe someone have the same issue. Please let me know if you know how to fix it. I'm thinking there's something wrong in the build.py file or the way I set it up.
Participated in the
Raspberry Pi Contest