# blog-web-application
**Repository Path**: quarky/blog-web-application
## Basic Information
- **Project Name**: blog-web-application
- **Description**: https://github.com/JmilkFan/blog-web-application.git
- **Primary Language**: Python
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-09-29
- **Last Updated**: 2024-10-08
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Blog Web Application base on Python-Flask framework
开发笔记与文档:[《用 Flask 来写个轻博客》](https://blog.csdn.net/jmilk/category_9631002.html)
## Installation
- **Step 1**: clone the source code from GitHub
```
git clone https://github.com/JmilkFan/JmilkFan-s-Blog.git
cd JmilkFan-s-Blog
```
- **Step 2**: building and using virtual environment via tools of `virtualenv`
```
virtualenv blog_env
source blog_env/bin/activate
```
- **Step 3**: Install the requirements package
```
pip install -r requirements.txt -e .
```
## Start service
- **Srep 1**: Create the DB for app of jmilkfansblog, e.g.
```
mysql -uroot -pfanguiju -e "CREATE DATABASE myblog default charset utf8 COLLATE utf8_general_ci;"
mysql -uroot -pfanguiju -e "GRANT ALL ON egis.* TO 'user'@'127.0.0.1' IDENTIFIED BY 'fanguiju';"
mysql -uroot -pfanguiju -e "GRANT ALL ON egis.* TO 'user'@'localhost' IDENTIFIED BY 'fanguiju';"
mysql -uroot -pfanguiju -e "GRANT ALL ON egis.* TO 'user'@'%' IDENTIFIED BY 'fanguiju';"
```
- **Step 2**: Setup the Configuration.
Edit the config option `connection` for etc file `etc/jmilkfansblog.conf` e.g.
```
connection = 'mysql+pymysql://root:fanguiju@127.0.0.1:3306/myblog?charset=utf8'
```
Edit the config option `host`/`server_port`/`api_port`. e.g.
```
host = '127.0.0.1'
server_port = 8089
api_port = 8080
```
- **Step 3**: Init the database
```
jmilkfansblog-manager db upgrade -d jmilkfansblog/db/sqlalchemy/alembic
```
- **Step 4**: Start the service
```
jmilkfansblog-manager server
```
- **Step 5**: Start the API service
```
jmilkfansblog-api
```
- **Step 6**: Register the account(Have to access the google reCAPTCHA).
```
http://127.0.0.1:8088/register
```
## Issue
1. ERROR: `Command "python setup.py egg_info" failed with error code 1`
if you meet this error when you installing the dependency packet from requirements file.
Plase check whether installed the MySQL, because the package PyMySQL will be depend on it.
## Change Log
============== 2016-11-13 =============
1. First commit
2. Completed development environment configuration
3. Created the base application
4. Installed the Flask extend: Flask-Script CLI
5. Installed the Flask extend: Flask-SQLAlchemy
6. Connect the MySQL with SQLAlchemy
============== 2016-11-16 =============
1. Created the database myblog
2. Implements models class User
============== 2016-11-19 =============
1. Implements models class Post
============== 2016-11-20 =============
1. Implements models class Comment
2. Implements models class Tag
3. Installed the Flask extend: Flask-Migrate
============== 2016-11-23 =============
1. Added the file views.py
2. Created the view function for tables
3. Installed the Bootstrap
4. Implements the HTML base template of Jinja
5. Implements the macro: render pagination
6. Fix the bug from base.html
============== 2016-11-24 =============
1. Implements the template for view function: `home()`
2. Installed the Flask-WTF
3. Implements the Form class: `CommentForm`
============== 2016-11-24 =============
1. Fix the bug for pagination linked
2. Implements template: `post.html`
3. Add the Form class CommentForm() into view function: `post()`
============== 2016-11-26 =============
1. Add the template: `page_not_fount.html`
2. Implements the Blueprint: `blog`
3. Reconstruction project code
============== 2016-11-27 =============
1. Using the Factory Method to create app instance
2. Installed the Flask-Bcrypt
3. Using the Flask-Bcrypt to encipher the password
4. Using reCAPTCHA
5. Implements Login and Register Forms
============== 2016-11-28 =============
1. Fix the bug for reCAPTCHA
2. Implements view function login/logout/register
3. Implements template: `login.html`
============== 2016-11-29 =============
1. Implements the template: `register.html`
============== 2016-11-30 =============
1. Implements the View function: new_post/edit_post
2. Implements the template: new.html/edit.html
3. Fix the bug for edit and new the post
============== 2016-12-02 =============
1. Fix the bug for controller: `blog.py`
============== 2016-12-03 =============
1. Fix the bug for login/register/net_post/edit_post
============== 2016-12-04 =============
1. Installed the Flask-OpenID
2. Implements use the OpenID to login the blog
3. Installed the Flask-Oauth
4. Implements use the Facebook and Twitter to login the blog
5. Installed the Flask-Login
6. Installed the Flask-Principal
7. Using the session to confirm the uses login status
8. Add the table: `users_roles` and `roles`
9. Using the Flask-Principal to implements the role permission
10. Using the Flask-Login to implements the ensure the user login status
============== 2016-12-05 =============
1. Fix some bug for Flask-Principal
============== 2016-12-06 =============
2. Add the Remember Me optional box
============== 2016-12-08 =============
1. Add the Script plug-in with duoshuo-comment
2. Add the Script plug-in with duoshuo-share
============== 2016-12-09 =============
1. Fix some bug for Flask-Principal
============== 2016-12-10 =============
1. Installed the Flask-Restful
2. Implements restful api `GET` for /api/posts
3. Implements restful api `POST` for /api/posts
4. Implements restful api `PUT` for /api/posts/post_id
5. Implements restful api `DELETE` for /api/posts/post_id
6. Implements restful api `POST` for /api/auth
============== 2016-12-11 =============
1. Added the database migrate version: `Init database`
2. Added the table `browse_volumes`
3. Added the database migrate version: `Add table of browse_volumes`
4. Fix some bug
5. Installed Celery and Flask-Celery-Helper
============== 2016-12-12 =============
1. Implements the celery_runner(Celery worker)
============== 2016-12-13 =============
1. Installed flower
2. Setup the timed task
3. Add table `reminders`
4. Implements Remind when registered the user
5. Implements weekly digest
============== 2016-12-14 =============
1. Implements email content of weekly-digest `digest.html`
2. Installed Flask-Debug-Toolbar
3. Installed Flask-Cache
4. Installed Flask-Redis
5. Implements make cache for `post.html/home.html` and function `verify_auth_token`
6. Using Redis as BackEndStieCache
7. Installed Flask-Assets
8. Installed Flask-Admin
9. Implements the Post-Admin page via Flask-Admin
10. Implements access File System via Flask-Admin
11. Installed Flask-Mail
============== 2016-12-15 =============
1. Fix some bug
============== 2016-12-16 =============
1. Fix some bug
============== 2016-12-17 =============
1. Fix some bug for Flask-Admin
2. Replace the property of Post Model: `users` to `user`
============== 2016-12-18 =============
1. Create a new manager command `assset`
2. Pack up the static file
3. Fix the bug for UnicodeEncodeError
============== 2016-12-19 =============
1. Implements Flask-Youku extension
2. Implements Flask-GZip extension
============== 2016-12-20 =============
1. Packup the extensions Flask-Youku and Flask-GZip
============== 2016-12-21 =============
1. Installed selenium
2. Installed coverage
3. Implements Unit test `TestURLs`
4. Fix some bug
============== 2016-12-24 =============
1. Fix some bug for flask_youku
2. Installed oslo_config
3. Using oslo_config to setup the config
============== tag 0.0.1 Done to Python-Flask =============
============== 2016-12-26 =============
1. Fix the bug for oslo_config
2. Implements setup.cfg and setup.py
3. Tag 0.0.1 Done to Python-Flask
4. Source archive v0.0.1
============== 2016-12-27 =============
1. Installed Pecan
2. Implements Restful api `v1/users` via Pecan
3. Create the db directory
4. Create the api directory for Pecan RESTful API
============== 2016-12-28 =============
1. Implements RESTful API `v1/posts` via Pecan
============== 2016-12-30 =============
1. Installed oslo_db
2. Using oslo_db.sqlalchemy.session.EngineFacahe to create the session
3. Using oslo_db.concurrency to wrapper the operation of database
============== 2017-01-02 =============
1. Fix the bug for Flask-Admin
2. Return post_id when response the flask_restful api `/posts` GET
============== 2017-01-04 =============
1. Implements the GET `v1/posts` via pecan RESTful
============== 2017-01-05 =============
1. Installed oslo_i18n
2. Try to use the oslo_log and oslo_config
============== 2017-01-08 =============
1. Fix some bug
2. Implements console-script via setup.cfg
============== 2017-01-09 =============
1. Fix the bug for db.api.CONF
============== 2017-03-31 =============
1. Test the oslo_config
============== 2017-04-03 =============
1. Fix the oslo_log and jinja syntax bug