1

I know my .env file is loading but for some reason it seems to be jumping back to 'config.settings.local'?

I am using the latest Cookiecutter code.

this is my .env settings.

DJANGO_ALLOWED_HOSTS=178.128.108.20,178.128.108.20:8000,*
DJANGO_ADMIN_URL=admin
DJANGO_DEBUG=True
DJANGO_SETTINGS_MODULE='config.settings.production'
DJANGO_SECRET_KEY=2l@$#-#2z...=6n7-ejd%+51

below are the settings I get back from Ubuntu after it can not find the allowed host setting.

The DJANGO_ALLOWED_HOSTS is set for the correct address but I get back an error about not being set.

Than I noticed some setting like the DJANGO_SETTINGS_MODULE have changed back to the local host.

Any ideas why?

Here is what I get back from my development server. Note the change in the config.setting to local.

enter image description here

And here is my disallowed host message back from Ubuntu.

enter image description here

As you can see the local host is set for this address.

here is the beginning Cookiecutter code:

env = environ.Env()

READ_DOT_ENV_FILE = env.bool('DJANGO_READ_DOT_ENV_FILE', default=True)

if READ_DOT_ENV_FILE:
    # OS environment variables take precedence over variables from .env
    env.read_env(str(ROOT_DIR.path('.env')))

All this admin stuff is not my thing. Sorry if it is foolish question.

Thanks.

diogenes
  • 1,865
  • 3
  • 24
  • 51

1 Answers1

2

I spent days chasing this issue and it turns out that if you do not set up Cookiecutter for either Heroku or Docker it does not set up the .envs folders that are needed.

Once I rebuilt the site with the Heroku option, I was able to solve my .envs issues.

use_heroku [n]: y  

I can now set it up on Ubuntu (using Digital Ocean) and get the 'config.settings.production' to work.

Cheers.

diogenes
  • 1,865
  • 3
  • 24
  • 51