-
Notifications
You must be signed in to change notification settings - Fork 0
/
constant.py
154 lines (110 loc) · 5.54 KB
/
constant.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
"""
Document Description.
Many configuration parameters for the entire blog project
Each parameter is annotated with a description
"""
# Load environment variables first
from dotenv import find_dotenv, load_dotenv
load_dotenv(find_dotenv(), override=True)
import os
from datetime import timedelta
# Set the session expiration time Here you can also set weeks, months, etc.
sessionExpirationTime = timedelta(days=30)
# Set the category name of the homepage, here write five, you can also add
classification = ["Python", "LeetCode", "Project", "Learning", "Others"]
# Set the maximum number of comments per day for no one
commentNum = 10
# Whether the image verification code supports case-insensitive (this refers to the image verification code for login, not the text verification code for account registration)
whetherDistinguishCapital = False
# of points sent for registration
regGiveCredit = 50
# Daily login bonus points (already processed, you can only receive one login bonus per day)
loginEvereDayCredit = 1
# Points sent for publishing articles (there is no limit to the number of articles sent per day here, so please be careful to give editor status)
postArticleCredit = 10
# Adding comments and replying to comments increases points per point
replyAndAddCommentCredit = 2
# The author sets the article to receive points, and the author's share after other readers pay points
rateCreditForArticle = 0.5
# Posting with points for optional collection of points for articles
creditListForReleaseArticle = [1, 2, 5, 10, 20, 50]
# There are several articles per page
howArticleInWeb = 10
# of comments per post (not counting replies to replies to comments)
howCommentInArticle = 5
# Whether to have a rotating image of the home page
whetherSaveShufflingFigure = True
# The position of the image corresponding to the rotating image Note that the number of links should be consistent with the following images
# Note that this should be the image at the bottom of /static/img/banner (only the file name is filled in below)
shufflingFigurePicture = ["banner-1.jpg", "banner-2.jpg", "banner-3.jpg"]
# Click on the link of the corresponding image of the rotating image
shufflingFigureLink = [
"https://github.com/sanxiadaba/pythonBlog",
"https://github.com/sanxiadaba/pythonBlog",
"https://github.com/sanxiadaba/pythonBlog"
]
# The address of the logo on the top left corner of the home page (the location of the image here is placed under /static/img/logo)
indexLogoPicture = "logo.png"
# The length and width of the logo (in the form of an array)
indexLogoPictureSize = (60, 60)
# The two words at the top of the home page and the words in the upper left corner of the mobile
indexAboveStr = ["Welcome to my blog", "Study well", "Day Up"]
# of randomly generated avatar thumbnails (a random thumbnail is generated when the user registers, which can be changed by the reader later)
# Be sure to have the appropriate number of avatar images at the bottom of /static/img/avatar
thumbNailNum = 10
# of recommendations in the three columns of the sidebar
# Latest posts Most reads Special recommendations
recommendedNumOfSide = [9, 9, 9]
"""
Here are the settings related to the log file
"""
# Format of compressed files
compressedFormat = "zip"
# The time for regular cleaning (optional such as "1 day" "1 week" "3 months" etc.) Note the plural of time
clearLogTime = "1 month"
# Size of split logs (logs are automatically compressed after a certain volume and then a new log is started) Optional parameters are KB GM MB
logSize = "1 MB"
# Whether the printed loguru is output on the console
whetherLogPrintInConsole = True
# Captcha will expire after a specified time # in seconds
timeoutOfEcode = 120
# Set the maximum number of contributions and posts per user and editor per day
maxUserPostArticleNum = 10
maxUserPostArticleNumOfEditor = 20
# Set the maximum number of post modifications per day
maxModifyArticleNum = 10
# Maximum number of images uploaded per person per day
maxUploadPicNum = 20
# Set in the backend page of managing articles, not many article pagination
everyPageInHou = 5
# Here are some variables about the environment configuration
blogLanguage = os.environ.get("blogLanguage")
md5Salt = os.environ.get("md5Salt")
localOrRemote = os.environ.get("LOCAL_OR_REMOTE")
mysqlUserName = os.environ.get("MYSQL_USER_NAME")
mysqlPort = int(os.environ.get("MYSQL_PORT"))
mysqlUrl = os.environ.get("MYSQL_URL")
databaseName = os.environ.get("MYSQL_DATABASE_NAME")
portNum = int(os.environ.get("PORT_NUM"))
adminLogin = os.environ.get("ADMIN_LOGIN_NAME")
editorLogin = os.environ.get("EDITOR_LOGIN_NAME")
userLogin = os.environ.get("USER_LOGIN_NAME")
adminPassword = os.environ.get("ADMIN_PASSWORD")
editorPassword = os.environ.get("EDITOR_PASSWORD")
userPassword = os.environ.get("USER_PASSWORD")
whetherDebug = True if os.environ.get("DEBUG_MODE") == "True" else False
sessionRestart = True if os.environ.get("SESSION_RESTART") == "True" else False
# Send account with registered email
emailType = os.environ.get("USE_GMAIL_OR_QQMAIL")
emailAccount = os.environ.get("EMAIL_ACCOUNT")
emailAdmit = os.environ.get("EMAIL_PASSWORD")
mysqlPassword = os.environ.get("MYSQL_PASSWORD")
if localOrRemote == "localhost":
config_mysql = mysqlUserName + ":" + str(
mysqlPassword) + "@" + mysqlUrl + ":" + str(mysqlPort)
elif localOrRemote == "remote":
remoteAccount = os.environ.get("REMOTE_ADDRESS_ACCOUNT")
config_mysql = remoteAccount + ":" + mysqlUserName + ":" + str(
mysqlPassword) + "@" + mysqlUrl + ":" + str(portNum)
else:
raise Exception("Please configure the correct mysql")