Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Django: Core

You're reading from   Mastering Django: Core The Complete Guide to Django 1.8 LTS

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher
ISBN-13 9781787281141
Length 694 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Nigel George Nigel George
Author Profile Icon Nigel George
Nigel George
Arrow right icon
View More author details
Toc

Table of Contents (33) Chapters Close

Mastering Django: Core
Credits
About the Author
www.PacktPub.com
Preface
1. Introduction to Django and Getting Started FREE CHAPTER 2. Views and URLconfs 3. Templates 4. Models 5. The Django Admin Site 6. Forms 7. Advanced Views and URLconfs 8. Advanced Templates 9. Advanced Models 10. Generic Views 11. User Authentication in Django 12. Testing in Django 13. Deploying Django 14. Generating Non-HTML Content 15. Django Sessions 16. Djangos Cache Framework 17. Django Middleware 18. Internationalization 19. Security in Django 20. More on Installing Django 21. Advanced Database Management Model Definition Reference Database API Reference Generic View Reference Settings Built-in Template Tags and Filters Request and Response Objects Developing Django with Visual Studio

Available settings


There are a large number of settings available in Django. For ease of reference, I have broken them up into six sections, each with a corresponding table in this Appendix:

  • Core settings (Table D.1)
  • Authentication settings (Table D.2)
  • Message settings (Table D.3)
  • Session settings (Table D.4)
  • Django sites settings (Table D.5)
  • Static files settings (Table D.6)

Each table lists the available setting and it's default value. For additional information and use cases for each setting, see the Django Project website at https://docs.djangoproject.com/en/1.8/ref/settings/.

Note

Be careful when you override settings, especially when the default value is a non-empty list or dictionary, such as MIDDLEWARE_CLASSES and STATICFILES_FINDERS. Make sure you keep the components required by the features of Django you wish to use.

Core settings

Setting

Default Value

ABSOLUTE_URL_OVERRIDES

{} (Empty dictionary)

ADMINS

[] (Empty list)

ALLOWED_HOSTS

[] (Empty list)

APPEND_SLASH

True

CACHE_MIDDLEWARE_ALIAS

default

CACHES

{ 'default': { 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', } }

CACHE_MIDDLEWARE_KEY_PREFIX

'' (empty string)

CACHE_MIDDLEWARE_SECONDS

600

CSRF_COOKIE_AGE

31449600 (1 year, in seconds)

CSRF_COOKIE_DOMAIN

None

CSRF_COOKIE_HTTPONLY

False

CSRF_COOKIE_NAME

Csrftoken

CSRF_COOKIE_PATH

'/'

CSRF_COOKIE_SECURE

False

DATE_INPUT_FORMATS

[ '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y','%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y', ]

DATETIME_FORMAT

'N j, Y, P' (for example, Feb. 4, 2003, 4 p.m.)

DATETIME_INPUT_FORMATS

[ '%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S',

'%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M', '%m/%d/%y',

]

DEBUG

False

DEBUG_PROPAGATE_EXCEPTIONS

False

DECIMAL_SEPARATOR

'.' (Dot)

DEFAULT_CHARSET

'utf-8'

DEFAULT_CONTENT_TYPE

'text/html'

DEFAULT_EXCEPTION_REPORTER_FILTER

django.views.debug. SafeExceptionReporterFilter

DEFAULT_FILE_STORAGE

django.core.files.storage. FileSystemStorage

DEFAULT_FROM_EMAIL

'webmaster@localhost'.

DEFAULT_INDEX_TABLESPACE

'' (Empty string)

DEFAULT_TABLESPACE

'' (Empty string)

DISALLOWED_USER_AGENTS

[] (Empty list)

EMAIL_BACKEND

django.core.mail.backends.smtp. EmailBackend

EMAIL_HOST

'localhost'

EMAIL_HOST_PASSWORD

'' (Empty string)

EMAIL_HOST_USER

'' (Empty string)

EMAIL_PORT

25

EMAIL_SUBJECT_PREFIX

'[Django] '

EMAIL_USE_TLS

False

EMAIL_USE_SSL

False

EMAIL_SSL_CERTFILE

None

EMAIL_SSL_KEYFILE

None

EMAIL_TIMEOUT

None

FILE_CHARSET

'utf-8'

FILE_UPLOAD_HANDLERS

[ 'django.core.files.uploadhandler. MemoryFileUploadHandler', 'django.core.files.uploadhandler. TemporaryFileUploadHandler' ]

FILE_UPLOAD_MAX_MEMORY_SIZE

2621440 (that is, 2.5 MB)

FILE_UPLOAD_DIRECTORY_PERMISSIONS

None

FILE_UPLOAD_PERMISSIONS

None

FILE_UPLOAD_TEMP_DIR

None

FIRST_DAY_OF_WEEK

0 (Sunday)

FIXTURE_DIRS

[] (Empty list)

FORCE_SCRIPT_NAME

None

FORMAT_MODULE_PATH

None

IGNORABLE_404_URLS

[] (Empty list)

INSTALLED_APPS

[] (Empty list)

INTERNAL_IPS

[] (Empty list)

LANGUAGE_CODE

'en-us'

LANGUAGE_COOKIE_AGE

None (expires at browser close)

LANGUAGE_COOKIE_DOMAIN

None

LANGUAGE_COOKIE_NAME

'django_language'

LANGUAGES

A list of all available languages

LOCALE_PATHS

[] (Empty list)

LOGGING

A logging configuration dictionary

LOGGING_CONFIG

'logging.config.dictConfig'

MANAGERS

[] (Empty list)

MEDIA_ROOT

'' (Empty string)

MEDIA_URL

'' (Empty string)

MIDDLEWARE_CLASSES

[ 'django.middleware.common. CommonMiddleware', 'django.middleware.csrf.  CsrfViewMiddleware' ]

MIGRATION_MODULES

{} (empty dictionary)

MONTH_DAY_FORMAT

'F j'

NUMBER_GROUPING

0

PREPEND_WWW

False

ROOT_URLCONF

Not defined

SECRET_KEY

'' (Empty string)

SECURE_BROWSER_XSS_FILTER

False

SECURE_CONTENT_TYPE_NOSNIFF

False

SECURE_HSTS_INCLUDE_SUBDOMAINS

False

SECURE_HSTS_SECONDS

0

SECURE_PROXY_SSL_HEADER

None

SECURE_REDIRECT_EXEMPT

[] (Empty list)

SECURE_SSL_HOST

None

SECURE_SSL_REDIRECT

False

SERIALIZATION_MODULES

Not defined

SERVER_EMAIL

'root@localhost'

SHORT_DATE_FORMAT

m/d/Y (for example, 12/31/2003)

SHORT_DATETIME_FORMAT

m/d/Y P (for example, 12/31/2003 4 p.m.)

SIGNING_BACKEND

'django.core.signing.TimestampSigner'

SILENCED_SYSTEM_CHECKS

[] (Empty list)

TEMPLATES

[] (Empty list)

TEMPLATE_DEBUG

False

TEST_RUNNER

'django.test.runner.DiscoverRunner'

TEST_NON_SERIALIZED_APPS

[] (Empty list)

THOUSAND_SEPARATOR

, (Comma)

TIME_FORMAT

'P' (for example, 4 p.m.)

TIME_INPUT_FORMATS

[ '%H:%M:%S',

'%H:%M:%S.%f', '%H:%M',

]

TIME_ZONE

'America/Chicago'

USE_ETAGS

False

USE_I18N

True

USE_L10N

False

USE_THOUSAND_SEPARATOR

False

USE_TZ

False

USE_X_FORWARDED_HOST

False

WSGI_APPLICATION

None

YEAR_MONTH_FORMAT

'F Y'

X_FRAME_OPTIONS

'SAMEORIGIN'

Table D.1: Django core settings

Auth

Setting

Default Value

AUTHENTICATION_BACKENDS

'django.contrib.auth.backends.ModelBackend'

AUTH_USER_MODEL

'auth.User'

LOGIN_REDIRECT_URL

'/accounts/profile/'

LOGIN_URL

'/accounts/login/'

LOGOUT_URL

'/accounts/logout/'

PASSWORD_RESET_TIMEOUT_DAYS

3

PASSWORD_HASHERS

[ 'django.contrib.auth.hashers.PBKDF2PasswordHasher', 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher', 'django.contrib.auth.hashers.BCryptPasswordHasher', 'django.contrib.auth.hashers.SHA1PasswordHasher', 'django.contrib.auth.hashers.MD5PasswordHasher', 'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher', 'django.contrib.auth.hashers.CryptPasswordHasher' ]

Table D.2: Django authentication settings

Messages

Setting

Default Value

MESSAGE_LEVEL

messages

MESSAGE_STORAGE

'django.contrib.messages.storage.fallback.FallbackStorage'

MESSAGE_TAGS

{ messages.DEBUG: 'debug', messages.INFO: 'info', messages.SUCCESS: 'success', messages.WARNING: 'warning', messages.ERROR: 'error' }

Table D.3: Django messages settings

Sessions

Setting

Default Value

SESSION_CACHE_ALIAS

default

SESSION_COOKIE_AGE

1209600 (2 weeks, in seconds).

SESSION_COOKIE_DOMAIN

None

SESSION_COOKIE_HTTPONLY

True.

SESSION_COOKIE_NAME

'sessionid'

SESSION_COOKIE_PATH

'/'

SESSION_COOKIE_SECURE

False

SESSION_ENGINE

'django.contrib.sessions.backends.db'

SESSION_EXPIRE_AT_BROWSER_CLOSE

False

SESSION_FILE_PATH

None

SESSION_SAVE_EVERY_REQUEST

False

SESSION_SERIALIZER

'django.contrib.sessions.serializers. JSONSerializer'

Table D.4: Django sessions settings

Sites

Setting

Default Value

SITE_ID

Not defined

Table D.5: Django sites settings

Static files

Setting

Default Value

STATIC_ROOT

None

STATIC_URL

None

STATICFILES_DIRS

[] (Empty list)

STATICFILES_STORAGE

'django.contrib.staticfiles.storage.StaticFilesStorage'

STATICFILES_FINDERS

[

"django.contrib.staticfiles.finders.FileSystemFinder", "django.contrib.staticfiles.finders. AppDirectoriesFinder"

]

Table D.6: Django static files settings

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images