简体   繁体   中英

Current Path variable in .env file

Is there a way to refer to the current directory in a .env file?

Trying to point the location of a config file from userprofile, to the current path. For example,

CONFIG_FILE=${USERPROFILE}\.configs\config.cfg

I would like to set it to,

CONFIG_FILE=${CURRENTPATH}\.configs\config.cfg

Running my program w/ pipenv on Ubuntu, I'm able to do eg:

SETUP_CFG=${PWD}/setup.cfg

And in Python I can do:

import os
from pathlib import Path

assert os.environ.get("SETUP_CFG") == (Path.cwd() / "setup.cfg").as_posix()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM