Skip to content

ZGrauer/Python-Blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Personal Blog in Google Cloud


What is it?

A personal blog for posting content with commenting and score system. Built using Python for the backend, and runs on Google App Engine. The Python server uses jinja2 for HTML templating and stores all site data in Google Cloud Datastore.

Installation

  1. Download and install Python 2.7
  2. Download and install Google App Engine SDK for Python
  3. Sign Up for a Google App Engine Account
  4. Create a new project in Google’s Developer Console using a unique name
  5. Follow the App Engine Quickstart to get an app up and running
  6. Clone this repository into Google's repository using these instructions

Development

Modify the site as needed. front.html in the templates directory is inherited/extended by all other HTML templates. Edit this file to change the page header and navigation.

Styling can be changed using CSS in file style.css in the css folder.

Be sure to change the value of SECRET, which is used for hashing. This can be found on line 16 of main.py.

SECRET = "LVFuBg9EM8Bq3cd992Tb5g01Uh30GCV2"

Running Locally

To run the site on your local machine, run this command from a Terminal within the application's directory.

$ dev_appserver.py .

The site will then be avialible at http://localhost:8080/. The local Google Datastore can be viewed and edited using this address http://localhost:8000/. All valid paths can be used and edited at the bottom of main.py:

app = webapp2.WSGIApplication([("/", BlogFront),
                               ("/blog/?", BlogFront),
                               ("/blog/([0-9]+)", PostPage),
                               ("/blog/newpost", NewPost),
                               ("/blog/signup", Signup),
                               ("/blog/login", Login),
                               ("/blog/logout", Logout)],
                              debug=True)

Deploying to Cloud

Modified app files can be deployed to Google Cloud using:

$ gcloud app deploy

Todos

  • Add user roles so only some users can post articles
  • Add like/dislike tracking to block multiple likes/dislikes
  • Add user administration functionality

License

MIT