From e22ad9bd142b9bb8516d2c0cf65e8c0ffd0f5ff0 Mon Sep 17 00:00:00 2001 From: ismdeep Date: Sun, 30 Jun 2019 14:16:38 +0800 Subject: [PATCH] Move bin/config.md to docs/config.md Add docs/config-en.md as English version of config.md --- .gitignore | 1 + README-en.md | 2 +- README.md | 2 +- docs/config-en.md | 64 +++++++++++++++++++++++++++++++++++++++++ {bin => docs}/config.md | 2 +- 5 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 docs/config-en.md rename {bin => docs}/config.md (95%) diff --git a/.gitignore b/.gitignore index df0809f..9aa5e14 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,4 @@ werobot_session django.jpg uploads/ settings_production.py +werobot_session.db diff --git a/README-en.md b/README-en.md index 8c31168..5ad8d41 100644 --- a/README-en.md +++ b/README-en.md @@ -109,7 +109,7 @@ 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) +[More configurations details](/docs/config-en.md) ## About the issues diff --git a/README.md b/README.md index 9e24346..a29611e 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ CREATE DATABASE `djangoblog` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8 浏览器打开: http://127.0.0.1:8000/ 就可以看到效果了。 ## 更多配置: -[更多配置介绍](/bin/config.md) +[更多配置介绍](/docs/config.md) ## 问题相关 diff --git a/docs/config-en.md b/docs/config-en.md new file mode 100644 index 0000000..b877efb --- /dev/null +++ b/docs/config-en.md @@ -0,0 +1,64 @@ +# Introduction to main features settings + +## Cache: +Cache using `memcache` for default. If you don't have `memcache` environment, you can remove the `default` setting in `CACHES` and change `locmemcache` to `default`. +```python +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'LOCATION': '127.0.0.1:11211', + 'KEY_PREFIX': 'django_test' if TESTING else 'djangoblog', + 'TIMEOUT': 60 * 60 * 10 + }, + 'locmemcache': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + 'TIMEOUT': 10800, + 'LOCATION': 'unique-snowflake', + } +} +``` + +## OAuth Login: +QQ, Weibo, Google, GitHub and Facebook are now supported for OAuth login. Fetch OAuth login permissions from the corresponding open platform, and save them with `appkey`, `appsecret` and callback address in **Backend->OAuth** configuration. + +### Callback address examples: +QQ: http://your-domain-name/oauth/authorize?type=qq +Weibo: http://your-domain-name/oauth/authorize?type=weibo +type is in the type field of `oauthmanager`. + +## owntracks: +owntracks is a location tracking application. It will send your locaiton to the server by timing.Simple support owntracks features. Just install owntracks app and set api address as `your-domain-name/owntracks/logtracks`. Visit `your-domain-name/owntracks/show_dates` and you will see the date with latitude and langitude, click it and see the motion track. The map is drawn by AMap. + +## Email feature: +Same as before, Configure your own error msg recvie email information with`ADMINS = [('liangliang', 'liangliangyy@gmail.com')]` in `settings.py`. And modify: +```python +EMAIL_HOST = 'smtp.zoho.com' +EMAIL_PORT = 587 +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') +``` +with your email account information. + +## WeChat Official Account +Simple wechat official account features integrated. Set token as `your-domain-name/robot` in wechat backend. Default token is `lylinux`, you can change it to your own in `servermanager/robot.py`. Add a new command in `Backend->Servermanager->command`, in this way, you can manage the system through wechat official account. + +## Introduction to website configuration +You can add website configuration in **Backend->BLOG->WebSiteConfiguration**. Such as: keywords, description, Google Ad, website stats code, case number, etc. +OAuth user avatar path is saved in *StaticFileSavedAddress*. Please input absolute path, code directory for default. + +## Source code highlighting +If the code block in your article didn't show hightlight, please write the code blocks as following: + +![](https://resource.lylinux.net/image/codelang.png) + +That is, you should add the corresponding language name before the code block. + +## Update +If you get errors as following while executing database migrations: +```python +django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table ((1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1")) +``` +This problem may cause by the mysql version under 5.6, a new version( >= 5.6 ) mysql is needed. + diff --git a/bin/config.md b/docs/config.md similarity index 95% rename from bin/config.md rename to docs/config.md index 76dac74..73555dc 100644 --- a/bin/config.md +++ b/docs/config.md @@ -19,7 +19,7 @@ CACHES = { ``` ## oauth登录: -现在已经支持微博,Google,GitHub,Facebook登录,需要在其对应的开放平台申请oauth登录权限,然后在 +现在已经支持QQ,微博,Google,GitHub,Facebook登录,需要在其对应的开放平台申请oauth登录权限,然后在 **后台->Oauth** 配置中新增配置,填写对应的`appkey`和`appsecret`以及回调地址。 ### 回调地址示例: qq:http://你的域名/oauth/authorize?type=qq