Skip to content

Separate Settings Files for Dev and Production #84

@jshcrm

Description

@jshcrm

After #78 is merged, create a settings/ folder in config/ and create 3 settings files: base.py, dev.py and prod.py.

dev.py:
`
from .base import *

DEBUG = True
SECRET_KEY = 'SECRET'
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
`

prod.py:
`
from .base import *

DEBUG = False
SECRET_KEY = os.environ.get('SECRET_KEY')
ALLOWED_HOSTS = ['suppliestracker.pythonanywhere.com']
`

The rest of the current settings.py can be moved to base.py. An article for reference, although he says multiple settings files should only be used for larger projects, I disagree. There should always be at least prod and dev for dev-only apps and the settings above. This is also the suggested approach in Two Scoops of Django.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions