我的项目是一个React项目。
当我更改网络语言时,我的网站是多功能网站。moment.locale(lang)不工作。
我的代码是:
const startDate = moment.utc(start).locale(lang);
const endDate = moment.utc(end).locale(lang);
Run Code Online (Sandbox Code Playgroud)
无论我lang检查的startDate.locale()是什么,始终显示'en'
startDate.format('ll')结果始终是英语。
我使用 docker-compose 用 postgresql 构建了一个烧瓶应用程序。但是flask无法连接postgresql。错误信息:
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
Is the server running on host "postgres-db" (192.168.16.2) and accepting
TCP/IP connections on port 5432?
Run Code Online (Sandbox Code Playgroud)
当我进入 docker 容器并 ping 时postgres-db,它运行良好。我启动了烧瓶应用程序,它也运行良好。只有当我使用 docker-compose up 时才无法连接
我的 docker-compose 文件:
version: '3.7'
services:
postgres-db:
restart: always
image: postgres:11.1-alpine
privileged: true
ports:
- 5432:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: Aa123456
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- ./db/postgres/data:/var/lib/postgresql/data/pgdata
api:
build:
context: ./api
dockerfile: Dockerfile
volumes:
- './api:/usr/src/app'
ports: …Run Code Online (Sandbox Code Playgroud)