【问题标题】:Data in Postgresql dont savePostgresql 中的数据不保存
【发布时间】:2017-06-20 01:56:42
【问题描述】:

Ubuntu 16.04、Postgres 9.5、django==1.10.7

我的 django 项目中的数据不保存在数据库中。

我可以完全使用该应用程序。但是数据没有保存。

迁移正在运行,创建超级用户也是如此,但数据不保存。在本地开发中一切正常,但在生产中没有。

在 postgresql-9.5-main.log 中看到了这个:

2017-06-16 18:26:42 MSK [1026-2] LOG:  received fast shutdown request
2017-06-16 18:26:42 MSK [1026-3] LOG:  aborting any active transactions
2017-06-16 18:26:42 MSK [1040-2] LOG:  autovacuum launcher shutting down
2017-06-16 18:26:42 MSK [1037-1] LOG:  shutting down
2017-06-16 18:26:42 MSK [1037-2] LOG:  database system is shut down
2017-06-16 18:26:57 MSK [1056-1] LOG:  database system was shut down at 2017-06-16 18:26:42 MSK
2017-06-16 18:26:57 MSK [1056-2] LOG:  MultiXact member wraparound protections are now enabled
2017-06-16 18:26:57 MSK [1038-1] LOG:  database system is ready to accept connections
2017-06-16 18:26:57 MSK [1061-1] LOG:  autovacuum launcher started
2017-06-16 18:26:57 MSK [1273-1] [unknown]@[unknown] LOG:  incomplete startup packet
2017-06-16 21:35:42 MSK [5836-1] user@user LOG:  could not receive data from client: Connection reset by peer
2017-06-17 17:37:27 MSK [26684-1] user@user LOG:  could not receive data from client: Connection reset by peer
2017-06-17 17:37:27 MSK [26678-1] user@user LOG:  could not receive data from client: Connection reset by peer
2017-06-17 17:37:27 MSK [26676-1] user@user LOG:  could not receive data from client: Connection reset by peer

请帮帮我。我真的需要帮助。独立我能理解。我在 Google 上阅读了 5 页。

【问题讨论】:

  • Why is "Can someone help me?" not an actual question?。请参阅 How to Askminimal reproducible example,然后回来并 edit 您的帖子添加我们可以使用的细节,并提出一个实际的具体问题。
  • 由于您声称本地开发工作正常,唯一的问题是生产问题,可能的问题可能是您的生产数据库autocommit 模式已关闭。
  • @IndikaRajapaksha,不,自动提交 False,没有帮助我
  • 贴出使用数据的代码并保存。

标签: django postgresql ubuntu ubuntu-16.04


【解决方案1】:

经过多次尝试找出问题的原因,重新安装postgresql和日期转储的实验,甚至重新安装操作系统,重新部署完整的应用程序,我找到了原因故障。

整个问题是我的 nginx 配置包含以下行:

proxy_cache_methods GET HEAD POST;

这个指令缓存的是 POST 请求:

proxy_cache_valid 200 302 1m;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-27
    • 2016-11-12
    • 2018-07-25
    • 2021-08-12
    • 1970-01-01
    • 2017-04-04
    相关资源
    最近更新 更多