Created
January 19, 2009 05:09
-
-
Save trey/48879 to your computer and use it in GitHub Desktop.
Do the Django Settings Shuffle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can avoid this shuffle if you do something like this: | |
# | |
# You should only use this technique with private projects, | |
# since your passwords will be in source control for everyone to see. | |
hostname = os.uname()[1].lower() | |
if hostname in ['something.dev']: | |
# Development settings | |
elif hostname in ['something_else.com', 'and_another.com']: | |
# Staging settings | |
else: | |
# Production settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBUG = True | |
TEMPLATE_DEBUG = True | |
DATABASE_ENGINE = 'sqlite3' | |
DATABASE_NAME = 'dev.db' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file on your development machine should have this: | |
from dev_settings import * | |
# This file on your production machine should have this: | |
from production_settings import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEBUG = False | |
TEMPLATE_DEBUG = False | |
ADMINS = ( | |
('Your Name', 'you@yourdomain.com'), | |
) | |
MANAGERS = ADMINS | |
DATABASE_ENGINE = 'mysql' | |
DATABASE_NAME = '' | |
DATABASE_USER = '' | |
DATABASE_PASSWORD = '' | |
DATABASE_HOST = 'localhost' | |
DATABASE_PORT = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ... | |
try: | |
from local_settings import * | |
except ImportError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment