https://github.com/assad2008/flask_blog
基于阿里云OSS为存储,采用Flask和Tornado编写
https://github.com/assad2008/flask_blog
Last synced: about 1 month ago
JSON representation
基于阿里云OSS为存储,采用Flask和Tornado编写
- Host: GitHub
- URL: https://github.com/assad2008/flask_blog
- Owner: assad2008
- Created: 2015-12-26T12:30:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-12-26T12:50:35.000Z (over 9 years ago)
- Last Synced: 2025-01-27T06:12:19.708Z (3 months ago)
- Language: HTML
- Size: 42 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# flask_blog
基于阿里云OSS为存储,采用`Flask`和`Tornado`以及`markdown`构建博客
示例:
首先在aliyun上创建一个OSS
然后创建两个目录,`blogs`用来存放博客,`topics`用来存放page页面。然后在`/blog/settings.py`配置OSS
OSS_ENDPOINT = "oss-cn-beijing-internal.aliyuncs.com"
OSS_KEY = ""
OSS_SECRET = ""
OSS_BUCKET = ""
这样就不用数据库或者其他存储了。然后配置Redis
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6000
博客业务使用Flask编写,请求处理使用的`Tornado`。端口默认为:8080启动:
python PATH/server.py --port=8080
博客文章示例:
见:
Nginx配置:
log_format blogaccess '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
upstream blogserver
{
server 127.0.0.1:8080;
}
server
{
listen 80;
server_name yourdomain.com;
index index.html index.htm;
location ^~ /static/ {
root PATH/app/;
}
location / {
proxy_read_timeout 1800;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Scheme $scheme;
proxy_pass http://blogserver;
}location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log blogaccess.log blogaccess;
}