Merge branch 'master' into dev

sh_branch
liangliangyy 7 years ago
commit 00cb082b35

@ -148,9 +148,9 @@ HAYSTACK_CONNECTIONS = {
'PATH': os.path.join(os.path.dirname(__file__), 'whoosh_index'),
},
}
# 自动更新搜索索引
# Automatically update searching index
HAYSTACK_SIGNAL_PROCESSOR = 'haystack.signals.RealtimeSignalProcessor'
# 允许使用用户名或密码登录
# Allow user login with username and password
AUTHENTICATION_BACKENDS = ['accounts.user_login_backend.EmailOrUsernameModelBackend']
STATIC_ROOT = os.path.join(SITE_ROOT, 'collectedstatic')
@ -164,14 +164,14 @@ LOGIN_URL = '/login/'
TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
DATE_TIME_FORMAT = '%Y-%m-%d'
# bootstrap颜色样式
# bootstrap color styles
BOOTSTRAP_COLOR_TYPES = [
'default', 'primary', 'success', 'info', 'warning', 'danger'
]
# 分页
# paginate
PAGINATE_BY = 10
# http缓存时间
# http cache timeout
CACHE_CONTROL_MAX_AGE = 2592000
# cache setting
CACHES = {
@ -203,9 +203,9 @@ EMAIL_HOST_USER = os.environ.get('DJANGO_EMAIL_USER')
EMAIL_HOST_PASSWORD = os.environ.get('DJANGO_EMAIL_PASSWORD')
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = os.environ.get('DJANGO_EMAIL_USER')
# 设置debug=false 未处理异常邮件通知
# Setting debug=false did NOT handle except email notifications
ADMINS = [('liangliang', 'liangliangyy@gmail.com')]
# 微信管理员密码(两次md5获得)
# WX ADMIN password(Two times md5)
WXADMIN = '995F03AC401D6CABABAEF756FC4D43C7'
LOGGING = {

@ -0,0 +1,124 @@
# DjangoBlog
🌍
*[English](README-en.md) ∙ [简体中文](README.md)*
A blog system based on `python3.6` and `Django2.1`.
[![Build Status](https://travis-ci.org/liangliangyy/DjangoBlog.svg?branch=master)](https://travis-ci.org/liangliangyy/DjangoBlog) [![codecov](https://codecov.io/gh/liangliangyy/DjangoBlog/branch/master/graph/badge.svg)](https://codecov.io/gh/liangliangyy/DjangoBlog) [![Requirements Status](https://requires.io/github/liangliangyy/DjangoBlog/requirements.svg?branch=master)](https://requires.io/github/liangliangyy/DjangoBlog/requirements/?branch=master) [![license](https://img.shields.io/github/license/liangliangyy/djangoblog.svg)]()
## Main Features:
- Articles, Pages, Categories, Tags(Add, Delete, Edit), edc. Articles and pages support `Markdown` and highlighting.
- Articles support full-text search.
- Complete comment feature, include posting reply comment and email notification. `Markdown` supporting.
- Sidebar feature: new articles, most readings, tags, etc.
- OAuth Login supported, including Google, GitHub, Facebook, Weibo, QQ.
- `Memcache` supported, with cache auto refresh.
- Simple SEO Features, notify Google and Baidu when there was a new article or other things.
- Simple picture bed feature integrated.
- `django-compressor` integrated, auto-compressed `css`, `js`.
- Website exception email notification. When there is an unhandle exception, system will send an email notification.
- Wechat official account feature integrated. Now, you can use wechat official account to manage your VPS.
## Installation
Change MySQL client from `pymysql` to `mysqlclient`, more details please reference [pypi](https://pypi.org/project/mysqlclient/) , checkout preperation before installation.
Install via pip: `pip install -Ur requirements.txt`
If you do NOT have `pip`, please use the following methods to install:
- OS X / Linux, run the following commands:
```
curl http://peak.telecommunity.com/dist/ez_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
```
- Windows
Download http://peak.telecommunity.com/dist/ez_setup.py and https://raw.github.com/pypa/pip/master/contrib/get-pip.py, and run with python.
### Configuration
Most configurations are in `setting.py`, others are in backend configurations.
I set many `setting` configuration with my environment variables (such as: `SECRET_KEY`, `OAUTH`, `mysql` and some email configuration parts.) and they did NOT been submitted to the `GitHub`. You can change these in the code with your own configuration or just add them into your environment variables.
Files in `test` directory are for `travis` with automatic testing. You do not need to care about this. Or just use it, in this way to integrate `travis` for automatic testing.
In `bin` directory, we have scripts to deploy with `Nginx`+`Gunicorn`+`virtualenv`+`supervisor` on `linux` and `Nginx` configuration file. You can reference with my article
>[Using Nginx+Gunicorn+virtualenv+supervisor to deploy django project.](https://www.lylinux.org/%E4%BD%BF%E7%94%A8nginxgunicornvirtualenvsupervisor%E6%9D%A5%E9%83%A8%E7%BD%B2django%E9%A1%B9%E7%9B%AE.html)
More deploy detail in this article.
## Run
Modify `DjangoBlog/setting.py` with database settings, as following:
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangoblog',
'USER': 'root',
'PASSWORD': 'password',
'HOST': 'host',
'PORT': 3306,
}
}
```
### Create database
Run the following command in MySQL shell:
```sql
CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
```
Run the following commands in Terminal:
```bash
./manage.py makemigrations
./manage.py migrate
```
**Attention: ** Before you using `./manage.py`, make sure the `python` command in your system is towards to `python 3.6` or above version. Otherwise you may solve this by one of the two following methods:
- Modify the first line in `manage.py`, change `#!/usr/bin/env python` to `#!/usr/bin/env python3`
- Just run with: `python3 ./manage.py makemigrations`
### Create super user
Run command in terminal:
```bash
./manage.py createsuperuser
```
### Create testing data
Run command in terminal:
```bash
./manage.py create_testdata
```
### Collect static files
Run command in terminal:
```bash
./manage.py collectstatic --noinput
./manage.py compress --force
```
### Getting start to run server
Execute: `./manage.py runserver`
Open up a browser and visit: http://127.0.0.1:8000/ , the you will see the blog.
## More configurations
[More configurations details](/bin/config.md)
## About the issues
If you have any *question*, please use Issue or send problem descriptions to my email `liangliangyy#gmail.com`. I will reponse you as soon as possible. And, we recommend you to use Issue.
---
## To Everyone 🙋‍♀️🙋‍♂️
If this project helps you, please submit your site address [here](https://github.com/liangliangyy/DjangoBlog/issues/214) to let more people see it.
Your reply will be the driving force for me to continue to update and maintain this project.
🙏🙏🙏

@ -1,105 +1,125 @@
# DjangoBlog
基于`python3.6`和`Django2.1`的博客。
[![Build Status](https://travis-ci.org/liangliangyy/DjangoBlog.svg?branch=master)](https://travis-ci.org/liangliangyy/DjangoBlog) [![codecov](https://codecov.io/gh/liangliangyy/DjangoBlog/branch/master/graph/badge.svg)](https://codecov.io/gh/liangliangyy/DjangoBlog) [![Requirements Status](https://requires.io/github/liangliangyy/DjangoBlog/requirements.svg?branch=master)](https://requires.io/github/liangliangyy/DjangoBlog/requirements/?branch=master) [![license](https://img.shields.io/github/license/liangliangyy/djangoblog.svg)]()
## 主要功能:
- 文章,页面,分类目录,标签的添加,删除,编辑等。文章及页面支持`Markdown`,支持代码高亮。
- 支持文章全文搜索。
- 完整的评论功能,包括发表回复评论,以及评论的邮件提醒,支持`Markdown`。
- 侧边栏功能,最新文章,最多阅读,标签云等。
- 支持Oauth登陆现已有Google,GitHub,facebook,微博,QQ登录。
- 支持`Memcache`缓存,支持缓存自动刷新。
- 简单的SEO功能新建文章等会自动通知Google和百度。
- 集成了简单的图床功能。
- 集成`django-compressor`,自动压缩`css``js`。
- 网站异常邮件提醒,若有未捕捉到的异常会自动发送提醒邮件。
- 集成了微信公众号功能现在可以使用微信公众号来管理你的vps了。
## 安装
mysql客户端从`pymysql`修改成了`mysqlclient`,具体请参考 [pypi](https://pypi.org/project/mysqlclient/) 查看安装前的准备。
使用pip安装
`pip install -Ur requirements.txt`
如果你没有pip使用如下方式安装
OS X / Linux 电脑,终端下执行:
curl http://peak.telecommunity.com/dist/ez_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
windows电脑
下载 http://peak.telecommunity.com/dist/ez_setup.py 和 https://raw.github.com/pypa/pip/master/contrib/get-pip.py 这两个文件,双击运行。
### 配置
配置都是在`setting.py`中.部分配置迁移到了后台配置中。
很多`setting`配置我都是写在环境变量里面的.并没有提交到`github`中来.例如`SECRET_KEY`,`OAHUTH`,`mysql`以及邮件部分的配置等.你可以直接修改代码成你自己的,或者在环境变量里面加入对应的配置就可以了.
`test`目录中的文件都是为了`travis`自动化测试使用的.不用去关注.或者直接使用.这样就可以集成`travis`自动化测试了.
`bin`目录是在`linux`环境中使用`Nginx`+`Gunicorn`+`virtualenv`+`supervisor`来部署的脚本和`Nginx`配置文件.可以参考我的文章:
>[使用Nginx+Gunicorn+virtualenv+supervisor来部署django项目](https://www.lylinux.org/%E4%BD%BF%E7%94%A8nginxgunicornvirtualenvsupervisor%E6%9D%A5%E9%83%A8%E7%BD%B2django%E9%A1%B9%E7%9B%AE.html)
有详细的部署介绍.
## 运行
修改`DjangoBlog/setting.py` 修改数据库配置,如下所示:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangoblog',
'USER': 'root',
'PASSWORD': 'password',
'HOST': 'host',
'PORT': 3306,
}
}
### 创建数据库
mysql数据库中执行:
```sql
CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
```
然后终端下执行:
./manage.py makemigrations
./manage.py migrate
### 创建超级用户
终端下执行:
./manage.py createsuperuser
### 创建测试数据
终端下执行:
./manage.py create_testdata
### 收集静态文件
终端下执行:  
./manage.py collectstatic --noinput
./manage.py compress --force
### 开始运行:
执行:
`./manage.py runserver`
浏览器打开: http://127.0.0.1:8000/ 就可以看到效果了。
## 更多配置:
[更多配置介绍](/bin/config.md)
## 问题相关
有任何问题欢迎提Issue,或者将问题描述发送至我邮箱 `liangliangyy#gmail.com`.我会尽快解答.推荐提交Issue方式.
---
## 致大家🙋‍♀️🙋‍♂️
如果本项目帮助到了你,请在[这里](https://github.com/liangliangyy/DjangoBlog/issues/214)留下你的网址,让更多的人看到。
您的回复将会是我继续更新维护下去的动力。
🙏🙏🙏
# DjangoBlog
🌍
*[English](README-en.md) ∙ [简体中文](README.md)*
基于`python3.6`和`Django2.1`的博客。
[![Build Status](https://travis-ci.org/liangliangyy/DjangoBlog.svg?branch=master)](https://travis-ci.org/liangliangyy/DjangoBlog) [![codecov](https://codecov.io/gh/liangliangyy/DjangoBlog/branch/master/graph/badge.svg)](https://codecov.io/gh/liangliangyy/DjangoBlog) [![Requirements Status](https://requires.io/github/liangliangyy/DjangoBlog/requirements.svg?branch=master)](https://requires.io/github/liangliangyy/DjangoBlog/requirements/?branch=master) [![license](https://img.shields.io/github/license/liangliangyy/djangoblog.svg)]()
## 主要功能:
- 文章,页面,分类目录,标签的添加,删除,编辑等。文章及页面支持`Markdown`,支持代码高亮。
- 支持文章全文搜索。
- 完整的评论功能,包括发表回复评论,以及评论的邮件提醒,支持`Markdown`。
- 侧边栏功能,最新文章,最多阅读,标签云等。
- 支持Oauth登陆现已有Google,GitHub,facebook,微博,QQ登录。
- 支持`Memcache`缓存,支持缓存自动刷新。
- 简单的SEO功能新建文章等会自动通知Google和百度。
- 集成了简单的图床功能。
- 集成`django-compressor`,自动压缩`css``js`。
- 网站异常邮件提醒,若有未捕捉到的异常会自动发送提醒邮件。
- 集成了微信公众号功能现在可以使用微信公众号来管理你的vps了。
## 安装
mysql客户端从`pymysql`修改成了`mysqlclient`,具体请参考 [pypi](https://pypi.org/project/mysqlclient/) 查看安装前的准备。
使用pip安装 `pip install -Ur requirements.txt`
如果你没有pip使用如下方式安装
- OS X / Linux 电脑,终端下执行:
```
curl http://peak.telecommunity.com/dist/ez_setup.py | python
curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
```
- Windows电脑
下载 http://peak.telecommunity.com/dist/ez_setup.py 和 https://raw.github.com/pypa/pip/master/contrib/get-pip.py 这两个文件,双击运行。
### 配置
配置都是在 `setting.py` 中,部分配置迁移到了后台配置中。
很多 `setting` 配置我都是写在环境变量里面的.并没有提交到 `github` 中来.例如`SECRET_KEY`,`OAHUTH`,`mysql`以及邮件部分的配置等.你可以直接修改代码成你自己的,或者在环境变量里面加入对应的配置就可以了.
`test`目录中的文件都是为了`travis`自动化测试使用的.不用去关注.或者直接使用.这样就可以集成`travis`自动化测试了.
`bin`目录是在`linux`环境中使用`Nginx`+`Gunicorn`+`virtualenv`+`supervisor`来部署的脚本和`Nginx`配置文件.可以参考我的文章:
>[使用Nginx+Gunicorn+virtualenv+supervisor来部署django项目](https://www.lylinux.org/%E4%BD%BF%E7%94%A8nginxgunicornvirtualenvsupervisor%E6%9D%A5%E9%83%A8%E7%BD%B2django%E9%A1%B9%E7%9B%AE.html)
有详细的部署介绍.
## 运行
修改`DjangoBlog/setting.py` 修改数据库配置,如下所示:
```python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'djangoblog',
'USER': 'root',
'PASSWORD': 'password',
'HOST': 'host',
'PORT': 3306,
}
}
```
### 创建数据库
mysql数据库中执行:
```sql
CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci */;
```
然后终端下执行:
```bash
./manage.py makemigrations
./manage.py migrate
```
**注意:** 在使用 `./manage.py` 之前需要确定你系统中的 `python` 命令是指向 `python 3.6` 及以上版本的。如果不是如此,请使用以下两种方式中的一种:
- 修改 `manage.py` 第一行 `#!/usr/bin/env python``#!/usr/bin/env python3`
- 直接使用 `python3 ./manage.py makemigrations`
### 创建超级用户
终端下执行:
```bash
./manage.py createsuperuser
```
### 创建测试数据
终端下执行:
```bash
./manage.py create_testdata
```
### 收集静态文件
终端下执行:  
```bash
./manage.py collectstatic --noinput
./manage.py compress --force
```
### 开始运行:
执行: `./manage.py runserver`
浏览器打开: http://127.0.0.1:8000/ 就可以看到效果了。
## 更多配置:
[更多配置介绍](/bin/config.md)
## 问题相关
有任何问题欢迎提Issue,或者将问题描述发送至我邮箱 `liangliangyy#gmail.com`.我会尽快解答.推荐提交Issue方式.
---
## 致大家🙋‍♀️🙋‍♂️
如果本项目帮助到了你,请在[这里](https://github.com/liangliangyy/DjangoBlog/issues/214)留下你的网址,让更多的人看到。
您的回复将会是我继续更新维护下去的动力。
🙏🙏🙏

@ -2,29 +2,30 @@ appdirs==1.4.3
asn1crypto==0.24.0
astroid==2.2.5
bottle==0.12.16
certifi==2019.3.9
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
colorama==0.4.1
coverage==4.5.3
cryptography==2.6.1
Django==2.2.1
cryptography==2.7
Django==2.2.2
django-appconf==1.0.3
django-autoslug==1.9.4
django-compressor==2.2
django-compressor==2.3
django-debug-toolbar==1.11
django-haystack==2.8.1
django-ipware==2.1.0
django-mdeditor==0.1.14
django-uuslug==1.1.8
elasticsearch==7.0.0
elasticsearch==7.0.2
elasticsearch-dsl==7.0.0
idna==2.8
ipaddress==1.0.22
isort==4.3.20
jieba==0.39
jsonpickle==1.1
jsonpickle==1.2
lazy-object-proxy==1.4.1
markdown2==2.3.7
markdown2==2.3.8
mccabe==0.6.1
mistune==0.8.4
mysqlclient==1.4.2.post1
@ -32,7 +33,7 @@ olefile==0.46
packaging==19.0
Pillow==6.0.0
pycparser==2.19
Pygments==2.4.0
Pygments==2.4.2
pylint==2.3.1
pyparsing==2.4.0
python-dateutil==2.8.0
@ -47,9 +48,9 @@ rjsmin==1.1.0
six==1.12.0
sqlparse==0.3.0
text-unidecode==1.2
typed-ast==1.3.1
Unidecode==1.0.23
urllib3==1.25.2
typed-ast==1.4.0
Unidecode==1.1.0
urllib3==1.25.3
webencodings==0.5.1
WeRoBot==1.9.0
Whoosh==2.7.4

@ -2,29 +2,30 @@ appdirs==1.4.3
asn1crypto==0.24.0
astroid==2.2.5
bottle==0.12.16
certifi==2019.3.9
certifi==2019.6.16
cffi==1.12.3
chardet==3.0.4
colorama==0.4.1
coverage==4.5.3
cryptography==2.6.1
Django==2.2.1
cryptography==2.7
Django==2.2.2
django-appconf==1.0.3
django-autoslug==1.9.4
django-compressor==2.2
django-compressor==2.3
django-debug-toolbar==1.11
django-haystack==2.8.1
django-ipware==2.1.0
django-mdeditor==0.1.14
django-uuslug==1.1.8
elasticsearch==7.0.0
elasticsearch==7.0.2
elasticsearch-dsl==7.0.0
idna==2.8
ipaddress==1.0.22
isort==4.3.20
jieba==0.39
jsonpickle==1.1
jsonpickle==1.2
lazy-object-proxy==1.4.1
markdown2==2.3.7
markdown2==2.3.8
mccabe==0.6.1
mistune==0.8.4
mysqlclient==1.4.2.post1
@ -32,7 +33,7 @@ olefile==0.46
packaging==19.0
Pillow==6.0.0
pycparser==2.19
Pygments==2.4.0
Pygments==2.4.2
pylint==2.3.1
pyparsing==2.4.0
python-dateutil==2.8.0
@ -46,9 +47,9 @@ rjsmin==1.1.0
six==1.12.0
sqlparse==0.3.0
text-unidecode==1.2
typed-ast==1.3.1
Unidecode==1.0.23
urllib3==1.25.2
typed-ast==1.4.0
Unidecode==1.1.0
urllib3==1.25.3
webencodings==0.5.1
WeRoBot==1.9.0
Whoosh==2.7.4

Loading…
Cancel
Save