-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
串接大平台1 #93
串接大平台1 #93
Conversation
17dd4d6
to
a8bbd8f
Compare
2. Add create jwt function to fix jwt_token expire problem
love_letter/config.py
Outdated
@@ -7,3 +7,8 @@ | |||
DB_PASSWORD = os.environ.get("DB_PASSWORD") | |||
DB_NAME = os.environ.get("DB_NAME", "love_letter") | |||
DB_COLLECTION = os.environ.get("DB_COLLECTION", "love_letter") | |||
FRONTEND_HOST = os.environ.get("FRONTEND_HOST", "http://127.0.0.1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config 的內容,把它們收納成一個 class 或一個 object instance。
這樣統一 import 一個 class 或 object 就可以用了,不會讓參數那麼「零碎」。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
喔~ 看了自己寫的FRONTEND_HOST
後,好像有點懂「零碎」的意思了,指的是這樣嗎~
# 原本import方式,可以直接得到想要的參數
from love_letter.config import FRONTEND_HOST
print(FRONTEND_HOST)
# 包進class並初始化後,只能透過該object才能抓到要的參數,增加了使用config時的約束力(一定要import這個object才能使用)
from love_letter.config import config
print(config.FRONTEND_HOST)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
對呦。這樣才不會需要超過 1 個以上的 import 來處理同時使用的問題
love_letter/models/__init__.py
Outdated
@@ -333,7 +333,8 @@ class Seen: | |||
|
|||
|
|||
class Player: | |||
def __init__(self, name: str): | |||
def __init__(self, name: str, _id: Union[str] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_id
似乎沒有必要,大概是為了避內建的 id
嗎?如果 lint 沒有意見,那就保留,或改成 user_id
或 account_id
或 account
之類的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
為了避開內建的id
,我改成user_id
好了
) | ||
return True | ||
except Exception as e: | ||
print(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接近要上線的時刻,也許值得在追另新的 task,接上 sentry
https://sentry.io/welcome/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
酷~ 好喔,沒玩過之後來試試看
先開發一部分issue內的東西