The Django tutorial says the following, using a list in the installed_apps. But the default is a tuple, and other sources also say that Django prefers tuples rather than lists in this situation.
My question is: If I follow what the tutorial says, and use a list rather than a tuple, will this cause problems elsewhere in the setup? Or does it not really matter?
I am using virtualenv on PythonAnywhere running Django 1.8 and Python 3.4
What the tutorial says to add to mysite/settings.py:
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
No. Tuples and lists are exactly equivalent here.
Yes, there is a difference. Tuples are immutable.
Sometimes it's handy to be able to append something to initial applications list (for example, in 'local' configs, imported at the end of settings.py
). If you have your INSTALLED_APPS
in tuple you can only replace the whole value. If you have them in list — you can just append something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With