A basic Blog control CLI app.
Third-party Libraries used - Peewee ORM
, Cement 2.4
Python Interpreter = Python 3.4.2
Database = Sqlite3
- Blog_post model with fileds
title
,content
,category
and anid
field that is automatically generated by Sqlite as primary key field. - Category models(lists available categories under which a blog post can be categorized) with a field
category
andid
field automatically generated by Sqlite as a primary key field.
- Run
rmodel.py
to create models for the minimal Blog . BlogApp.py
is the main command-line app to control the Blog , usage is as given below.
Usage | Description |
---|---|
BlogApp.py |
Name of application itself. |
BlogApp.py --help |
Lists help and commands available. |
BlogApp.py post add "title" "content" |
Adds a new blog a new blog post with title and content. |
BlogApp.py post list |
Lists all blog posts. |
BlogApp.py post search "keyword" |
Lists all blog posts where “keyword” is found in title and/or content. |
BlogApp.py category add "category-name" |
Creates a new category. |
BlogApp.py category list |
Lists all categories |
BlogApp.py category assign <post-id> <cat-id> |
Assigns category to post |
BlogApp.py post add "title" "content" --category="cat-name" |
Adds a new blog a new blog post with title, content and assign a category to it. It category doesn’t exist, it is be created first. |
- Needs Code refactoring .
- More Error handling to make the usage graeful.
- In-depth Study of the Cement Latest version Documentaion to make the utility near robust by using necessary framework features .
- This app was made more to be result oriented inorder to meet a self imposed deadline ,so the code efficiency and best practices were not the top concern .