小编arp*_*rpa的帖子

ufw 禁止 docker 容器连接到 postgres

在启用 ufw 的 ubuntu 18.04 上,我运行 docker 容器,该容器应该将 django 应用程序连接到本地安装的 Postgresql 服务器。

禁用ufw后一切运行完美

docker-compose -f docker-compose.prod.yml run --rm app  sh -c 'python manage.py createsuperuser'
Run Code Online (Sandbox Code Playgroud)

但是启用 ufw 后出现以下错误:

 conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: could not connect to server: Operation timed out
    Is the server running on host "host.docker.internal" (172.17.0.1) and accepting
    TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)

我有以下 ufw 规则

$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
Nginx Full                 ALLOW       Anywhere                  
OpenSSH                    ALLOW       Anywhere …
Run Code Online (Sandbox Code Playgroud)

django postgresql ubuntu docker ufw

4
推荐指数
1
解决办法
3968
查看次数

Google 日历 API 错误 - “API 密钥无效。请传递有效的 API 密钥。”,

从昨天起我开始从 google rest api 收到错误

{
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid API key.",
    "errors": [
      {
        "message": "API key not valid. Please pass a valid API key.",
        "domain": "global",
        "reason": "badRequest"
      }
    ],
    "status": "INVALID_ARGUMENT"
  }
}
Run Code Online (Sandbox Code Playgroud)

API端点为: https://www.googleapis.com/calendar/v3/calendars/ [CALENDAR_ID]/events?timeMax=2020-06-22T23%3A59%3A59.000%2B06%3A00&timeMin=2020-06-22T00% 3A00%3A00.000%2B06%3A00&key=[SECRET_KEY]

标题是:

"Content-length"    "0"
"Content-Type"  "application/x-www-form-urlencoded"
"Host"  "www.googleapis.com"
"Authorization" "Bearer [APPILCATION_ID]"
"Accept"    "application/json"
Run Code Online (Sandbox Code Playgroud)

我在开发者控制台中有 oAuth 2.0 客户端 ID。并发送与 3 个月前相同的请求 可能有什么问题?

oauth google-calendar-api google-api google-oauth

3
推荐指数
1
解决办法
7761
查看次数