|
|
@@ -47,29 +47,46 @@ recommended to install Oscar in a virtualenv.
|
|
47
|
47
|
Django settings
|
|
48
|
48
|
===============
|
|
49
|
49
|
|
|
50
|
|
-Edit your settings file ``frobshop.frobshop.settings.py`` to specify
|
|
51
|
|
-``TEMPLATE_CONTEXT_PROCESSORS``:
|
|
|
50
|
+Edit your settings file ``frobshop.frobshop.settings.py`` to modify your
|
|
|
51
|
+``TEMPLATES`` to include the main Oscar template directory and add the extra
|
|
|
52
|
+context processors.
|
|
52
|
53
|
|
|
53
|
54
|
.. code-block:: django
|
|
54
|
55
|
|
|
55
|
|
- TEMPLATE_CONTEXT_PROCESSORS = (
|
|
56
|
|
- "django.contrib.auth.context_processors.auth",
|
|
57
|
|
- "django.core.context_processors.request",
|
|
58
|
|
- "django.core.context_processors.debug",
|
|
59
|
|
- "django.core.context_processors.i18n",
|
|
60
|
|
- "django.core.context_processors.media",
|
|
61
|
|
- "django.core.context_processors.static",
|
|
62
|
|
- "django.core.context_processors.tz",
|
|
63
|
|
- "django.contrib.messages.context_processors.messages",
|
|
64
|
|
- 'oscar.apps.search.context_processors.search_form',
|
|
65
|
|
- 'oscar.apps.promotions.context_processors.promotions',
|
|
66
|
|
- 'oscar.apps.checkout.context_processors.checkout',
|
|
67
|
|
- 'oscar.apps.customer.notifications.context_processors.notifications',
|
|
68
|
|
- 'oscar.core.context_processors.metadata',
|
|
69
|
|
- )
|
|
|
56
|
+ TEMPLATES = [
|
|
|
57
|
+ {
|
|
|
58
|
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
59
|
+ 'DIRS': [
|
|
|
60
|
+ os.path.join(BASE_DIR, 'templates'),
|
|
|
61
|
+ OSCAR_MAIN_TEMPLATE_DIR
|
|
|
62
|
+ ],
|
|
|
63
|
+ 'APP_DIRS': True,
|
|
|
64
|
+ 'OPTIONS': {
|
|
|
65
|
+ 'context_processors': [
|
|
|
66
|
+ 'django.template.context_processors.debug',
|
|
|
67
|
+ 'django.template.context_processors.request',
|
|
|
68
|
+ 'django.contrib.auth.context_processors.auth',
|
|
|
69
|
+ 'django.contrib.messages.context_processors.messages',
|
|
|
70
|
+
|
|
|
71
|
+ 'oscar.apps.search.context_processors.search_form',
|
|
|
72
|
+ 'oscar.apps.promotions.context_processors.promotions',
|
|
|
73
|
+ 'oscar.apps.checkout.context_processors.checkout',
|
|
|
74
|
+ 'oscar.apps.customer.notifications.context_processors.notifications',
|
|
|
75
|
+ 'oscar.core.context_processors.metadata',
|
|
|
76
|
+ ],
|
|
|
77
|
+ },
|
|
|
78
|
+ },
|
|
|
79
|
+ ]
|
|
|
80
|
+
|
|
|
81
|
+.. attention::
|
|
|
82
|
+
|
|
|
83
|
+ Before Django 1.8 this setting was split between
|
|
|
84
|
+ ``TEMPLATE_CONTEXT_PROCESSORS`` and ``TEMPLATE_DIRS``.
|
|
|
85
|
+
|
|
70
|
86
|
|
|
71
|
|
-Next, modify ``INSTALLED_APPS`` to be a list, add ``django.contrib.sites``, ``django.contrib.flatpages`` and ``compressor``
|
|
72
|
|
-and append Oscar's core apps. Also set ``SITE_ID``:
|
|
|
87
|
+Next, modify ``INSTALLED_APPS`` to be a list, add ``django.contrib.sites``,
|
|
|
88
|
+``django.contrib.flatpages``, ``compressor`` and ``widget_tweaks`` and append
|
|
|
89
|
+Oscar's core apps. Also set ``SITE_ID``:
|
|
73
|
90
|
|
|
74
|
91
|
.. code-block:: django
|
|
75
|
92
|
|
|
|
@@ -85,6 +102,7 @@ and append Oscar's core apps. Also set ``SITE_ID``:
|
|
85
|
102
|
'django.contrib.flatpages',
|
|
86
|
103
|
...
|
|
87
|
104
|
'compressor',
|
|
|
105
|
+ 'widget_tweaks',
|
|
88
|
106
|
] + get_core_apps()
|
|
89
|
107
|
|
|
90
|
108
|
SITE_ID = 1
|
|
|
@@ -98,11 +116,12 @@ More info about installing ``flatpages`` is in the `Django docs`_.
|
|
98
|
116
|
|
|
99
|
117
|
.. tip::
|
|
100
|
118
|
|
|
101
|
|
- Oscar's default templates use django-compressor_ but it's optional really.
|
|
102
|
|
- You may decide to use your own templates that don't use compressor. Hence
|
|
103
|
|
- why it is not one of the 'core apps'.
|
|
|
119
|
+ Oscar's default templates use django-compressor_ and django-widget-tweaks_
|
|
|
120
|
+ but it's optional really. You may decide to use your own templates that
|
|
|
121
|
+ don't use either. Hence why they are not in the 'core apps'.
|
|
104
|
122
|
|
|
105
|
123
|
.. _django-compressor: https://github.com/jezdez/django_compressor
|
|
|
124
|
+.. _django-widget-tweaks: https://github.com/kmike/django-widget-tweaks
|
|
106
|
125
|
|
|
107
|
126
|
Next, add ``oscar.apps.basket.middleware.BasketMiddleware`` and
|
|
108
|
127
|
``django.contrib.flatpages.middleware.FlatpageFallbackMiddleware`` to
|
|
|
@@ -137,20 +156,7 @@ files from a remote storage (e.g. Amazon S3), you must manually copy a
|
|
137
|
156
|
.. _`configured correctly`: https://docs.djangoproject.com/en/1.7/howto/static-files/
|
|
138
|
157
|
.. _sandbox settings: https://github.com/django-oscar/django-oscar/blob/3a5160a86c9b14c940c76a224a28cd37dd29f7f1/sites/sandbox/settings.py#L99
|
|
139
|
158
|
|
|
140
|
|
-Modify your ``TEMPLATE_DIRS`` to include the main Oscar template directory:
|
|
141
|
159
|
|
|
142
|
|
-.. code-block:: django
|
|
143
|
|
-
|
|
144
|
|
- import os
|
|
145
|
|
- from oscar import OSCAR_MAIN_TEMPLATE_DIR
|
|
146
|
|
-
|
|
147
|
|
- location = lambda x: os.path.join(
|
|
148
|
|
- os.path.dirname(os.path.realpath(__file__)), x)
|
|
149
|
|
-
|
|
150
|
|
- TEMPLATE_DIRS = (
|
|
151
|
|
- location('templates'),
|
|
152
|
|
- OSCAR_MAIN_TEMPLATE_DIR,
|
|
153
|
|
- )
|
|
154
|
160
|
|
|
155
|
161
|
The last addition to the settings file is to import all of Oscar's default settings:
|
|
156
|
162
|
|