有没有办法阻止 datajoint 在导入时询问用户名和密码

Is there a way to stop datajoint from asking for username and password when I import it

在 Datajoint 中,系统会提示您输入用户名和密码。我正在使用 Sphinx 创建一个 readthedocs 网站,我需要系统不提示输入用户名和密码。我怎样才能关闭它?

DataJoint 仅在设置字典 dj.config 中尚未提供数据库凭据时才要求提供数据库凭据。这些值可以通过编程方式设置、从配置文件加载或从环境变量加载。文档中描述了这些设置:https://docs.datajoint.org/python/setup/01-Install-and-Connect.html

感谢您提出这个问题! 基本上有三种方法可以做到这一点:

  • dj.config.save_local():这会将整个 dj.config 保存为项目级别 json
  • dj.config.save_global():这将在系统级别进行保存
  • 系统变量 DJ_HOSTDJ_USERDJ_PASS:可以像 export 在终端中设置一次或在 ~/.bashrc 或 [= 中永久设置16=] 用于 linux/mac 或在您的系统 settings/environment 变量设置中用于 windows

请查看DataJoint Documentation了解更多详情