我有一个托管在 Heroku 上的 Django 应用程序,带有 postgresql 数据库,采用 Standard 0 计划。我想访问并读取此特定应用程序的
postgresql.conf
文件(以确定/编辑设置)。谁能指导我该怎么做?
注意:我无法通过 Heroku 仪表板执行此操作,而且我不知道如何通过 Ubuntu 命令行访问应用程序的文件结构。
您可以列出所有当前设置,而无需访问
postgres.conf
:
SELECT name, current_setting(name)
FROM pg_settings;
name | current_setting
-------------------------+-----------------------
allow_system_table_mods | off
application_name | psql.bin
archive_command | (disabled)
archive_mode | off
archive_timeout | 0
...
您还可以检查
postgres.conf
中哪些参数设置为默认值以外的值:
SELECT name, current_setting(name), sourcefile, sourceline
FROM pg_settings
WHERE sourcefile notnull;
name | current_setting | sourcefile | sourceline
----------------------------+-------------------+----------------------------------------+------------
DateStyle | ISO, DMY | /opt/postgres/9.5/data/postgresql.conf | 538
default_text_search_config | pg_catalog.simple | /opt/postgres/9.5/data/postgresql.conf | 560
dynamic_shared_memory_type | posix | /opt/postgres/9.5/data/postgresql.conf | 130
...
如果您有标准计划,您可以通过运行访问设置:
heroku pg:设置-a APP
但是您可以更改的设置数量非常有限...
https://devcenter.heroku.com/articles/heroku-postgres-settings