| Running the Tornado Blog example app |
| ==================================== |
| This demo is a simple blogging engine that uses MySQL to store posts and |
| Google Accounts for author authentication. Since it depends on MySQL, you |
| need to set up MySQL and the database schema for the demo to run. |
| |
| 1. Install prerequisites and build tornado |
| |
| See http://www.tornadoweb.org/ for installation instructions. If you can |
| run the "helloworld" example application, your environment is set up |
| correctly. |
| |
| 2. Install MySQL if needed |
| |
| Consult the documentation for your platform. Under Ubuntu Linux you |
| can run "apt-get install mysql". Under OS X you can download the |
| MySQL PKG file from http://dev.mysql.com/downloads/mysql/ |
| |
| 3. Connect to MySQL and create a database and user for the blog. |
| |
| Connect to MySQL as a user that can create databases and users: |
| mysql -u root |
| |
| Create a database named "blog": |
| mysql> CREATE DATABASE blog; |
| |
| Allow the "blog" user to connect with the password "blog": |
| mysql> GRANT ALL PRIVILEGES ON blog.* TO 'blog'@'localhost' IDENTIFIED BY 'blog'; |
| |
| 4. Create the tables in your new database. |
| |
| You can use the provided schema.sql file by running this command: |
| mysql --user=blog --password=blog --database=blog < schema.sql |
| |
| You can run the above command again later if you want to delete the |
| contents of the blog and start over after testing. |
| |
| 5. Run the blog example |
| |
| With the default user, password, and database you can just run: |
| ./blog.py |
| |
| If you've changed anything, you can alter the default MySQL settings |
| with arguments on the command line, e.g.: |
| ./blog.py --mysql_user=casey --mysql_password=happiness --mysql_database=foodblog |
| |
| 6. Visit your new blog |
| |
| Open http://localhost:8888/ in your web browser. You will be redirected to |
| a Google account sign-in page because the blog uses Google accounts for |
| authentication. |
| |
| Currently the first user to connect will automatically be given the |
| ability to create and edit posts. |
| |
| Once you've created one blog post, subsequent users will not be |
| prompted to sign in. |