|
3 | 3 | from __future__ import unicode_literals |
4 | 4 | import os, sys, datetime |
5 | 5 |
|
6 | | -OctBlogSettings = { |
7 | | - 'post_types': ('post', 'page'), # deprecated |
8 | | - 'allow_registration': os.environ.get('allow_registration', 'false').lower() == 'true', |
9 | | - 'allow_su_creation': os.environ.get('allow_su_creation', 'false').lower() == 'true', |
10 | | - 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
11 | | - 'auto_role': os.environ.get('auto_role', 'reader').lower(), |
12 | | - 'blog_meta': { |
13 | | - 'name': os.environ.get('name') if os.environ.get('name') else 'Oct Blog', |
14 | | - 'subtitle': os.environ.get('subtitle') if os.environ.get('subtitle') else 'Oct Blog Subtitle', |
15 | | - 'description': os.environ.get('description') if os.environ.get('description') else 'Oct Blog Description', |
16 | | - 'wechat_name': os.environ.get('wechat_name') if os.environ.get('wechat_name') else 'Oct Blog Wechat Root', |
17 | | - 'wechat_subtitle': os.environ.get('wechat_subtitle') if os.environ.get('wechat_subtitle') else 'Oct Blog Wechat Subtitle', |
18 | | - 'owner': os.environ.get('owner') if os.environ.get('owner') else 'Gevin', |
19 | | - 'keywords': os.environ.get('keywords') if os.environ.get('keywords') else 'python,django,flask,docker,MongoDB', |
20 | | - 'google_site_verification': os.environ.get('google_site_verification') or '12345678', |
21 | | - 'baidu_site_verification': os.environ.get('baidu_site_verification') or '87654321', |
22 | | - 'sogou_site_verification': os.environ.get('sogou_site_verification') or '87654321', |
23 | | - }, |
24 | | - 'search_engine_submit_urls':{ |
25 | | - 'baidu': os.environ.get('baidu_submit_url') |
26 | | - }, |
27 | | - 'pagination':{ |
28 | | - 'per_page': int(os.environ.get('per_page', 5)), |
29 | | - 'admin_per_page': int(os.environ.get('admin_per_page', 10)), |
30 | | - 'archive_per_page': int(os.environ.get('admin_per_page', 20)), |
31 | | - }, |
32 | | - 'blog_comment':{ |
33 | | - 'allow_comment': os.environ.get('allow_comment', 'true').lower() == 'true', |
34 | | - 'comment_type': os.environ.get('comment_type', 'octblog').lower(), # currently, OctBlog only supports duoshuo comment |
35 | | - 'comment_opt':{ |
36 | | - 'octblog': 'oct-blog', # shotname of octblog |
37 | | - 'duoshuo': 'oct-blog', # shotname of duoshuo |
38 | | - } |
39 | | - }, |
40 | | - 'donation': { |
41 | | - 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
42 | | - 'donation_msg': os.environ.get('donation_msg', 'You can donate to me if the article makes sense to you'), |
43 | | - 'donation_img_url': os.environ.get('donation_img_url') or 'http://img-own.igevin.info/weixin-pay.jpg?imageView/2/w/300' |
44 | | - }, |
45 | | - 'wechat': { |
46 | | - 'display_wechat': os.environ.get('display_wechat', 'true').lower() == 'true', |
47 | | - 'wechat_msg': os.environ.get('wechat_msg', 'Welcome to follow my wechat'), |
48 | | - 'wechat_image_url': os.environ.get('wechat_image_url') or 'http://7tsygu.com1.z0.glb.clouddn.com/gevin-view.jpg?imageView/2/w/150', |
49 | | - 'wechat_title': os.environ.get('wechat_title', 'GevinView'), |
50 | | - }, |
51 | | - 'copyright': { |
52 | | - 'display_copyright': os.environ.get('allow_display_copyright', 'true').lower() == 'true', |
53 | | - 'copyright_msg': os.environ.get('copyright_msg', 'The article is not allowed to repost unless author authorized') |
54 | | - }, |
55 | | - 'only_abstract_in_feed': os.environ.get('only_abstract_in_feed', 'false').lower() == 'true', |
56 | | - 'allow_share_article': os.environ.get('allow_share_article', 'true').lower() == 'true', |
57 | | - 'gavatar_cdn_base': os.environ.get('gavatar_cdn_base', '//cdn.v2ex.com/gravatar/'), |
58 | | - 'gavatar_default_image': os.environ.get('gavatar_default_image', 'http://7tsygu.com1.z0.glb.clouddn.com/user-avatar.jpg'), |
59 | | - 'background_image': { |
60 | | - 'home': os.environ.get('bg_home') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
61 | | - 'post': os.environ.get('bg_post') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
62 | | - 'about': os.environ.get('bg_about') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog_about.jpg', |
63 | | - 'qiniu': os.environ.get('qiniu') or 'http://assets.qiniu.com/qiniu-transparent.png', |
64 | | - }, |
65 | | - |
66 | | -} |
67 | | - |
68 | 6 | # OctBlogSettings = { |
69 | 7 | # 'post_types': ('post', 'page'), # deprecated |
70 | 8 | # 'allow_registration': os.environ.get('allow_registration', 'false').lower() == 'true', |
71 | 9 | # 'allow_su_creation': os.environ.get('allow_su_creation', 'false').lower() == 'true', |
72 | 10 | # 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
73 | 11 | # 'auto_role': os.environ.get('auto_role', 'reader').lower(), |
74 | 12 | # 'blog_meta': { |
75 | | -# # 'name': os.environ.get('name').decode('utf8') if os.environ.get('name') else 'Oct Blog', |
76 | 13 | # 'name': os.environ.get('name') if os.environ.get('name') else 'Oct Blog', |
77 | | -# 'subtitle': os.environ.get('subtitle').decode('utf8') if os.environ.get('subtitle') else 'Oct Blog Subtitle', |
78 | | -# 'description': os.environ.get('description').decode('utf8') if os.environ.get('description') else 'Oct Blog Description', |
79 | | -# 'wechat_name': os.environ.get('wechat_name').decode('utf8') if os.environ.get('wechat_name') else 'Oct Blog Wechat Root', |
80 | | -# 'wechat_subtitle': os.environ.get('wechat_subtitle').decode('utf8') if os.environ.get('wechat_subtitle') else 'Oct Blog Wechat Subtitle', |
81 | | -# 'owner': os.environ.get('owner').decode('utf8') if os.environ.get('owner') else 'Gevin', |
82 | | -# 'keywords': os.environ.get('keywords').decode('utf8') if os.environ.get('keywords') else 'python,django,flask,docker,MongoDB', |
| 14 | +# 'subtitle': os.environ.get('subtitle') if os.environ.get('subtitle') else 'Oct Blog Subtitle', |
| 15 | +# 'description': os.environ.get('description') if os.environ.get('description') else 'Oct Blog Description', |
| 16 | +# 'wechat_name': os.environ.get('wechat_name') if os.environ.get('wechat_name') else 'Oct Blog Wechat Root', |
| 17 | +# 'wechat_subtitle': os.environ.get('wechat_subtitle') if os.environ.get('wechat_subtitle') else 'Oct Blog Wechat Subtitle', |
| 18 | +# 'owner': os.environ.get('owner') if os.environ.get('owner') else 'Gevin', |
| 19 | +# 'keywords': os.environ.get('keywords') if os.environ.get('keywords') else 'python,django,flask,docker,MongoDB', |
83 | 20 | # 'google_site_verification': os.environ.get('google_site_verification') or '12345678', |
84 | 21 | # 'baidu_site_verification': os.environ.get('baidu_site_verification') or '87654321', |
85 | 22 | # 'sogou_site_verification': os.environ.get('sogou_site_verification') or '87654321', |
|
102 | 39 | # }, |
103 | 40 | # 'donation': { |
104 | 41 | # 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
105 | | -# 'donation_msg': os.environ.get('donation_msg', 'You can donate to me if the article makes sense to you').decode('utf8') |
| 42 | +# 'donation_msg': os.environ.get('donation_msg', 'You can donate to me if the article makes sense to you'), |
| 43 | +# 'donation_img_url': os.environ.get('donation_img_url') or 'http://img-own.igevin.info/weixin-pay.jpg?imageView/2/w/300' |
106 | 44 | # }, |
107 | 45 | # 'wechat': { |
108 | 46 | # 'display_wechat': os.environ.get('display_wechat', 'true').lower() == 'true', |
109 | | -# 'wechat_msg': os.environ.get('wechat_msg', 'Welcome to follow my wechat').decode('utf8') |
| 47 | +# 'wechat_msg': os.environ.get('wechat_msg', 'Welcome to follow my wechat'), |
| 48 | +# 'wechat_image_url': os.environ.get('wechat_image_url') or 'http://7tsygu.com1.z0.glb.clouddn.com/gevin-view.jpg?imageView/2/w/150', |
| 49 | +# 'wechat_title': os.environ.get('wechat_title', 'GevinView'), |
110 | 50 | # }, |
111 | 51 | # 'copyright': { |
112 | 52 | # 'display_copyright': os.environ.get('allow_display_copyright', 'true').lower() == 'true', |
113 | | -# 'copyright_msg': os.environ.get('copyright_msg', 'The article is not allowed to repost unless author authorized').decode('utf8') |
| 53 | +# 'copyright_msg': os.environ.get('copyright_msg', 'The article is not allowed to repost unless author authorized') |
114 | 54 | # }, |
115 | 55 | # 'only_abstract_in_feed': os.environ.get('only_abstract_in_feed', 'false').lower() == 'true', |
116 | 56 | # 'allow_share_article': os.environ.get('allow_share_article', 'true').lower() == 'true', |
|
119 | 59 | # 'background_image': { |
120 | 60 | # 'home': os.environ.get('bg_home') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
121 | 61 | # 'post': os.environ.get('bg_post') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
122 | | -# 'about': os.environ.get('bg_about') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog_about.jpg' |
| 62 | +# 'about': os.environ.get('bg_about') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog_about.jpg', |
| 63 | +# 'qiniu': os.environ.get('qiniu') or 'http://assets.qiniu.com/qiniu-transparent.png', |
123 | 64 | # }, |
124 | 65 |
|
125 | 66 | # } |
126 | 67 |
|
| 68 | +if sys.version_info < (3, 0): |
| 69 | + OctBlogSettings = { |
| 70 | + 'post_types': ('post', 'page'), # deprecated |
| 71 | + 'allow_registration': os.environ.get('allow_registration', 'false').lower() == 'true', |
| 72 | + 'allow_su_creation': os.environ.get('allow_su_creation', 'false').lower() == 'true', |
| 73 | + 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
| 74 | + 'auto_role': os.environ.get('auto_role', 'reader').lower(), |
| 75 | + 'blog_meta': { |
| 76 | + 'name': os.environ.get('name', 'Oct Blog').decode('utf8'), |
| 77 | + 'subtitle': os.environ.get('subtitle', 'Oct Blog Subtitle').decode('utf8'), |
| 78 | + 'description': os.environ.get('description', 'Oct Blog Description').decode('utf8'), |
| 79 | + 'wechat_name': os.environ.get('wechat_name', 'Oct Blog Wechat Root').decode('utf8'), |
| 80 | + 'wechat_subtitle': os.environ.get('wechat_subtitle', 'Oct Blog Wechat Subtitle').decode('utf8'), |
| 81 | + 'owner': os.environ.get('owner', 'Gevin').decode('utf8'), |
| 82 | + 'keywords': os.environ.get('keywords', 'python,django,flask,docker,MongoDB').decode('utf8'), |
| 83 | + 'google_site_verification': os.environ.get('google_site_verification') or '12345678', |
| 84 | + 'baidu_site_verification': os.environ.get('baidu_site_verification') or '87654321', |
| 85 | + 'sogou_site_verification': os.environ.get('sogou_site_verification') or '87654321', |
| 86 | + }, |
| 87 | + 'search_engine_submit_urls':{ |
| 88 | + 'baidu': os.environ.get('baidu_submit_url') |
| 89 | + }, |
| 90 | + 'pagination':{ |
| 91 | + 'per_page': int(os.environ.get('per_page', 5)), |
| 92 | + 'admin_per_page': int(os.environ.get('admin_per_page', 10)), |
| 93 | + 'archive_per_page': int(os.environ.get('admin_per_page', 20)), |
| 94 | + }, |
| 95 | + 'blog_comment':{ |
| 96 | + 'allow_comment': os.environ.get('allow_comment', 'true').lower() == 'true', |
| 97 | + 'comment_type': os.environ.get('comment_type', 'octblog').lower(), # currently, OctBlog only supports duoshuo comment |
| 98 | + 'comment_opt':{ |
| 99 | + 'octblog': 'oct-blog', # shotname of octblog |
| 100 | + 'duoshuo': 'oct-blog', # shotname of duoshuo |
| 101 | + } |
| 102 | + }, |
| 103 | + 'donation': { |
| 104 | + 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
| 105 | + 'donation_msg': os.environ.get('donation_msg', 'You can donate to me if the article makes sense to you').decode('utf8'), |
| 106 | + 'donation_img_url': os.environ.get('donation_img_url') or 'http://img-own.igevin.info/weixin-pay.jpg?imageView/2/w/300' |
| 107 | + }, |
| 108 | + 'wechat': { |
| 109 | + 'display_wechat': os.environ.get('display_wechat', 'true').lower() == 'true', |
| 110 | + 'wechat_msg': os.environ.get('wechat_msg', 'Welcome to follow my wechat').decode('utf8'), |
| 111 | + 'wechat_image_url': os.environ.get('wechat_image_url') or 'http://7tsygu.com1.z0.glb.clouddn.com/gevin-view.jpg?imageView/2/w/150', |
| 112 | + 'wechat_title': os.environ.get('wechat_title', 'GevinView'), |
| 113 | + }, |
| 114 | + 'copyright': { |
| 115 | + 'display_copyright': os.environ.get('allow_display_copyright', 'true').lower() == 'true', |
| 116 | + 'copyright_msg': os.environ.get('copyright_msg', 'The article is not allowed to repost unless author authorized').decode('utf8') |
| 117 | + }, |
| 118 | + 'only_abstract_in_feed': os.environ.get('only_abstract_in_feed', 'false').lower() == 'true', |
| 119 | + 'allow_share_article': os.environ.get('allow_share_article', 'true').lower() == 'true', |
| 120 | + 'gavatar_cdn_base': os.environ.get('gavatar_cdn_base', '//cdn.v2ex.com/gravatar/'), |
| 121 | + 'gavatar_default_image': os.environ.get('gavatar_default_image', 'http://7tsygu.com1.z0.glb.clouddn.com/user-avatar.jpg'), |
| 122 | + 'background_image': { |
| 123 | + 'home': os.environ.get('bg_home') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
| 124 | + 'post': os.environ.get('bg_post') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
| 125 | + 'about': os.environ.get('bg_about') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog_about.jpg', |
| 126 | + 'qiniu': os.environ.get('qiniu') or 'http://assets.qiniu.com/qiniu-transparent.png', |
| 127 | + }, |
| 128 | + |
| 129 | + } |
| 130 | +else: |
| 131 | + OctBlogSettings = { |
| 132 | + 'post_types': ('post', 'page'), # deprecated |
| 133 | + 'allow_registration': os.environ.get('allow_registration', 'false').lower() == 'true', |
| 134 | + 'allow_su_creation': os.environ.get('allow_su_creation', 'false').lower() == 'true', |
| 135 | + 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
| 136 | + 'auto_role': os.environ.get('auto_role', 'reader').lower(), |
| 137 | + 'blog_meta': { |
| 138 | + 'name': os.environ.get('name') if os.environ.get('name') else 'Oct Blog', |
| 139 | + 'subtitle': os.environ.get('subtitle') if os.environ.get('subtitle') else 'Oct Blog Subtitle', |
| 140 | + 'description': os.environ.get('description') if os.environ.get('description') else 'Oct Blog Description', |
| 141 | + 'wechat_name': os.environ.get('wechat_name') if os.environ.get('wechat_name') else 'Oct Blog Wechat Root', |
| 142 | + 'wechat_subtitle': os.environ.get('wechat_subtitle') if os.environ.get('wechat_subtitle') else 'Oct Blog Wechat Subtitle', |
| 143 | + 'owner': os.environ.get('owner') if os.environ.get('owner') else 'Gevin', |
| 144 | + 'keywords': os.environ.get('keywords') if os.environ.get('keywords') else 'python,django,flask,docker,MongoDB', |
| 145 | + 'google_site_verification': os.environ.get('google_site_verification') or '12345678', |
| 146 | + 'baidu_site_verification': os.environ.get('baidu_site_verification') or '87654321', |
| 147 | + 'sogou_site_verification': os.environ.get('sogou_site_verification') or '87654321', |
| 148 | + }, |
| 149 | + 'search_engine_submit_urls':{ |
| 150 | + 'baidu': os.environ.get('baidu_submit_url') |
| 151 | + }, |
| 152 | + 'pagination':{ |
| 153 | + 'per_page': int(os.environ.get('per_page', 5)), |
| 154 | + 'admin_per_page': int(os.environ.get('admin_per_page', 10)), |
| 155 | + 'archive_per_page': int(os.environ.get('admin_per_page', 20)), |
| 156 | + }, |
| 157 | + 'blog_comment':{ |
| 158 | + 'allow_comment': os.environ.get('allow_comment', 'true').lower() == 'true', |
| 159 | + 'comment_type': os.environ.get('comment_type', 'octblog').lower(), # currently, OctBlog only supports duoshuo comment |
| 160 | + 'comment_opt':{ |
| 161 | + 'octblog': 'oct-blog', # shotname of octblog |
| 162 | + 'duoshuo': 'oct-blog', # shotname of duoshuo |
| 163 | + } |
| 164 | + }, |
| 165 | + 'donation': { |
| 166 | + 'allow_donate': os.environ.get('allow_donate', 'true').lower() == 'true', |
| 167 | + 'donation_msg': os.environ.get('donation_msg', 'You can donate to me if the article makes sense to you'), |
| 168 | + 'donation_img_url': os.environ.get('donation_img_url') or 'http://img-own.igevin.info/weixin-pay.jpg?imageView/2/w/300' |
| 169 | + }, |
| 170 | + 'wechat': { |
| 171 | + 'display_wechat': os.environ.get('display_wechat', 'true').lower() == 'true', |
| 172 | + 'wechat_msg': os.environ.get('wechat_msg', 'Welcome to follow my wechat'), |
| 173 | + 'wechat_image_url': os.environ.get('wechat_image_url') or 'http://7tsygu.com1.z0.glb.clouddn.com/gevin-view.jpg?imageView/2/w/150', |
| 174 | + 'wechat_title': os.environ.get('wechat_title', 'GevinView'), |
| 175 | + }, |
| 176 | + 'copyright': { |
| 177 | + 'display_copyright': os.environ.get('allow_display_copyright', 'true').lower() == 'true', |
| 178 | + 'copyright_msg': os.environ.get('copyright_msg', 'The article is not allowed to repost unless author authorized') |
| 179 | + }, |
| 180 | + 'only_abstract_in_feed': os.environ.get('only_abstract_in_feed', 'false').lower() == 'true', |
| 181 | + 'allow_share_article': os.environ.get('allow_share_article', 'true').lower() == 'true', |
| 182 | + 'gavatar_cdn_base': os.environ.get('gavatar_cdn_base', '//cdn.v2ex.com/gravatar/'), |
| 183 | + 'gavatar_default_image': os.environ.get('gavatar_default_image', 'http://7tsygu.com1.z0.glb.clouddn.com/user-avatar.jpg'), |
| 184 | + 'background_image': { |
| 185 | + 'home': os.environ.get('bg_home') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
| 186 | + 'post': os.environ.get('bg_post') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog-bg.jpg', |
| 187 | + 'about': os.environ.get('bg_about') or 'http://7d9q7a.com1.z0.glb.clouddn.com/octblog_about.jpg', |
| 188 | + 'qiniu': os.environ.get('qiniu') or 'http://assets.qiniu.com/qiniu-transparent.png', |
| 189 | + }, |
| 190 | + |
| 191 | + } |
| 192 | + |
127 | 193 | class Config(object): |
128 | 194 | DEBUG = False |
129 | 195 | TESTING = False |
|
0 commit comments