.env
file and should contain all environment variables needed for your project..env
file..env
files into source control ! It would be a security risk in the event someone gained access to your repository since sensitive credentials and data would get exposed..env
and .env.*
are in the project .gitignore
file by default, so you should not worry about accidentally committing those files to source control..env.example
file located at project root directory will define minimum and common configuration values for a Masonite application. During the installation process, this file will be copied to .env
file..env
file then you can create it manually and copy and paste the contents of .env-example
file..env
file located at your project root into the Python environment.APP_ENV
variable inside the already loaded .env
. If it is defined it will try to load the .env.{APP_ENV}
file corresponding to this environment name.APP_ENV
is set to local
, Masonite will additionally load the .env.local
environment file.env()
helper.os.getenv()
method to get an environment variable value. It looks like:env
to read an environment variable value. It looks like:""
. For convenience this helper is casting types. Here are different examples of variables type casting:5432
(int)True
(bool)None
(None)""
(str)True
(bool)False
(bool)False
(bool)smtp
(string)cast=False
:APP_ENV
variable located in your .env
file. You can access it easily through the Masonite app environment()
helper:testing
. You can use is_running_tests()
helper to check if environment is testing
:APP_DEBUG
environment variable used in config/application.py
configuration file. When crafting a new project, the debug mode is enabled (APP_ENV=True
). It should stay enabled for local development.500
, 404
, 403
error pages are rendered.is_debug()
helper or with the config
helper: