| | 573 | |
| | 574 | == Rob Golding's method == |
| | 575 | Rob Golding posted on his blog how he solved this issue. It's a bit of a hack really but it works nicely and allows you to override or extend anything in {{{settings.py}}}. |
| | 576 | |
| | 577 | Add this to the bottom of {{{settings.py}}}: |
| | 578 | {{{ |
| | 579 | #!python |
| | 580 | try: |
| | 581 | LOCAL_SETTINGS |
| | 582 | except NameError: |
| | 583 | try: |
| | 584 | from local_settings import * |
| | 585 | except ImportError: |
| | 586 | pass |
| | 587 | }}} |
| | 588 | |
| | 589 | Now create a {{{local_settings.py}}} with the following: |
| | 590 | {{{ |
| | 591 | #!python |
| | 592 | LOCAL_SETTINGS = True |
| | 593 | from settings import * |
| | 594 | }}} |
| | 595 | |
| | 596 | You can now add things to {{{local_settings.py}}} like this: |
| | 597 | {{{ |
| | 598 | #!python |
| | 599 | MIDDLEWARE_CLASSES += |
| | 600 | ('debug_toolbar.middleware.DebugToolbarMiddleware',) |
| | 601 | INTERNAL_IPS = ('127.0.0.1',) |
| | 602 | INSTALLED_APPS += ('debug_toolbar',) |
| | 603 | }}} |
| | 604 | |
| | 605 | This does however have the drawback of {{{settings.py}}} being parsed twice but that shouldn't cause any sort of mention worthy performance loss. |