This is an exercise about blog.In this Blog,we can learn how to use Flask-- a microframework for Python based on Werkzeug and MongoDB rather than Django and sql Database.
This is my first project about flask,and I use Bootstrap as Frontend to decorate my blog succinctly,this is why it named SimpleBlog.
- v1.0 --USER LOGIN
- v2.0 --POST and COMMENTS
- v3.0 --RESTful API
- Multiple user
- Role:admin,editor,writer,reader
- Admin models
- Test Models
- Email comfirm
- MTV design model
- Markdown support
- Multiple comment plugin
- Blog features: posts, tags, categories, comments
- Flask
1.Flask-WTF
2.Flask-Login
3.Flask-Admin
4.Flask_Mail
5.Flask-Principal
6.flask_mongoengine
7.WTForms - MongoDB
mongoengine - Markdown2
- bleach
- Bootstrap
1.Clean Blog theme
2.bootbox.js
3.bootstrap-markdown.js
4.bootbox.js - JQuery
- Ajax
route:/SimpleBlog/app/api/v1/

Including Users
Posts
Comments
Errors
Take Users
as example:
URL | Method | Description |
---|---|---|
/api/v1/users/ | GET | Get all users list |
/api/v1/new-user/ | POST | Add a new user |
/api/v1/users/<user_id>/ | GET | Get a user information |
/api/v1/users/<user_id>/ | PUT | Modify a user information |
/api/v1/users/<user_id>/ | PATCH | Update a user information |
/api/v1/users/<user_id>/ | DELETE | Delete a user |
This is HTTP method.Anthor is Flask-Restful,you can find it in view function of this blog.
Install your MongoDB
Install virtual environment virtualenv
$ sudo apt-get install python-virtualenv
Install requirements:
(sudo) pip install -r requirements.txt
going to directorySimpleBlog/app/config.py
to set you database name.
Run SimpleBlog with this command:
python manage.py runserver
Then you can visit the blog with url: http://127.0.0.1:5052
If you want to customize manage.py, checkout Flask-Script
Get started with SimpleBlog
-
Create a superuser to administrate SimpleBlog
Visit the following url and create a superuser
http://127.0.0.1:5052/useraccounts/register/admin
If the url is forbidden, you need to go
SimpleBlog/app/config.py
to modify your configurations to allow the creation. -
Administrator interface
The admin home is: http://127.0.0.1:5052/admin -
Modify the default configurations
You either change settings inSimpleBlog/app/config.py
file, or set the environment variables defined in this file.
Setting environment variables is recommended, and once the configuration is changed, you need to restart the service.
This project is licensed under the MIT license, see LICENSE for more details.
Finally,enjoy it!