Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I use an approach in which my settings is actually a package and not a module</p> <p>settings/ <strong>init</strong>.py base.py local.py #this one is on .gitignore</p> <p><strong>init</strong>.py:</p> <pre><code>from setings import * try: from local.py import * except ImportError: pass </code></pre> <p>base.py:</p> <pre><code>import os DEBUG = False TEMPLATE_DEBUG = DEBUG SITE_ROOT = os.path.join( os.path.dirname( os.path.realpath(__file__) ) ,'..' ) ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } etc... </code></pre> <p>local.py:</p> <pre><code>from settings import settings as PROJECT_DEFAULT PREPEND_WWW = False DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_pyscopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': 'somesecretname', # Or path to database file if using sqlite3. 'USER': 'somesecretuser', # Not used with sqlite3. 'PASSWORD': 'somesecretpassword', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } } INSTALLED_APPS += PROJECT_DEFAULT.INSTALLED_APPS + ('debug_toolbar',) </code></pre> <p>You can see an example of this in <a href="https://github.com/armonge/django_html5boilerplate/blob/master/settings/local.py.example" rel="nofollow">here</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload