在项目的根目录上创建.env文件 [英] Creating .env file on the root of the project

查看:46
本文介绍了在项目的根目录上创建.env文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从github下载Django项目,其中一项要求是:由于该项目使用python-decouple,因此您需要在该项目的根目录上使用三个值创建一个名为.env的文件,如下所示:

I am trying to download a Django project from github and one of the requirements is:"As the project uses python-decouple you will need to create a file named .env on the root of the project with three values, as following:

DEBUG=True
SECRET_KEY='mys3cr3tk3y'
DATABASE_URL='postgres://u_bootcamp:p4ssw0rd@localhost:5432/bootcamp

"

1.项目的根本部分在哪里,设置在项目的一部分吗?

1.What(where) is the root part of the project, is it part of the project where are settings?

2..env应该是哪种文件?(我想是python包)

2.What kind of file should .env be?(python package I suppose)

3.文件名应该只是.env(或something.env)吗?

3.Should name of the file be simply .env(or something.env)?

4..env文件是否要导入到设置文件中?

4.Is .env file going to be imported in settings file?

推荐答案

  1. 项目的根本部分在哪里,设置在项目的一部分吗?

  1. What(where) is the root part of the project, is it part of the project where are settings?

  • manage.py 文件所在的位置(即项目的根目录).
  • Where your manage.py file is (that is your project root directory).

.env应该是哪种文件?(我猜想是python包)

What kind of file should .env be? (python package I suppose)

  • .env 是文本文件,而不是程序包.
  • .env is a text file not a package.

文件名应该只是.env(或something.env)吗?

Should name of the file be simply .env (or something.env)?

  • 只需 .env

.env文件是否要导入到设置文件中?

Is .env file going to be imported in settings file?

  • 无需导入, python-decouple 会从那里自动选择变量.
  • No need to import, python-decouple automatically picks variables from there.

详细了解设置数据在哪里 python-decouple 的用法 .

Read more about Where the settings data are stored? and Usage of python-decouple.

这篇关于在项目的根目录上创建.env文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆