Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在本地计算机上设置停靠的python服务器会导致会话数据损坏_Python_Django_Reactjs_Postgresql_Docker - Fatal编程技术网

在本地计算机上设置停靠的python服务器会导致会话数据损坏

在本地计算机上设置停靠的python服务器会导致会话数据损坏,python,django,reactjs,postgresql,docker,Python,Django,Reactjs,Postgresql,Docker,我正在尝试在本地计算机上设置一个名为的停靠Python服务器: 它有3个组成部分: 所有这三项都需要协同工作才能使服务器启动并运行,因此这是docker compose文件,它位于前端和api服务器的顶层: version: '3' services: db: image: postgres environment: POSTGRES_PASSWORD: password POSTGRES_DB: bullettrain ports:

我正在尝试在本地计算机上设置一个名为的停靠Python服务器:

它有3个组成部分:

所有这三项都需要协同工作才能使服务器启动并运行,因此这是docker compose文件,它位于前端和api服务器的顶层:

version: '3'
services:
  db:
    image: postgres
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_DB: bullettrain
    ports:
     - "5432:5432"
  api:
    build:
      context: ./bullet-train-api
      dockerfile: docker/Dockerfile
    command: bash -c "pipenv run python manage.py migrate --noinput
              && pipenv run python manage.py collectstatic --noinput
              && pipenv run gunicorn --bind 0.0.0.0:8000 -w 3 app.wsgi
              && pipenv run python src/manage.py createsuperuser"
    environment:
      DJANGO_DB_NAME: bullettrain
      DJANGO_DB_USER: postgres
      DJANGO_DB_PASSWORD: password
      DJANGO_DB_PORT: 5432
      DJANGO_ALLOWED_HOSTS: localhost
    ports:
     - "8000:8000"
    depends_on:
      - db
    links:
      - db:db
  frontend:
    build:
      context: ./bullet-train-frontend
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
这样,所有3个组件都并行运行。到现在为止,一直都还不错!现在要初始化它,我通过以下步骤运行:

docker exec -it research_api_1 bash ## go to the context of the API server terminal
run python manage.py createsuperuser ## run the createsuperuser command
命令成功运行,我得到以下输出:

为了确认,我去了数据库:

docker exec -it research_db_1 bash ## go to the database instance
psql bullettrain postgres ## connect to the bullettrain database
select * from public.users_ffadminuser; ## check if the super user is created
结果表明用户确实被创建了:

现在,如果我按照文档转到,什么也不会发生,服务器日志总是抛出
会话数据已损坏