We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Wrong initial value with default radio template
![image](https://cloud.githubusercontent.com/assets/1870738/12611581/b16ad47a-c4ed-11e5-96d2-41f63b6d33a8.png)

In example above I have selected second value but after refresh it show always first one. Why we change default radio template in first place?  I propose go with #370 .


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `saleor/core/templatetags/bootstrap.py`
Content:
```
1 from django import forms
2 from django.forms.forms import BoundField, BaseForm
3 from django.forms.utils import ErrorList
4 from django.template import Library, TemplateSyntaxError
5 from django.template.loader import render_to_string
6 from django.utils.safestring import mark_safe
7 
8 register = Library()
9 
10 TEMPLATE_ERRORS = 'bootstrap/_non_field_errors.html'
11 TEMPLATE_HORIZONTAL = 'bootstrap/_field_horizontal.html'
12 TEMPLATE_VERTICAL = 'bootstrap/_field_vertical.html'
13 TEMPLATE_PAGINATION = 'bootstrap/_pagination.html'
14 
15 
16 def render_non_field_errors(errors):
17     if not errors:
18         return ''
19     context = {'errors': errors}
20     return render_to_string(TEMPLATE_ERRORS, context=context)
21 
22 
23 def render_field(bound_field, show_label, template):
24     widget = bound_field.field.widget
25 
26     if isinstance(widget, forms.RadioSelect):
27         input_type = 'radio'
28     elif isinstance(widget, forms.Select):
29         input_type = 'select'
30     elif isinstance(widget, forms.Textarea):
31         input_type = 'textarea'
32     elif isinstance(widget, forms.CheckboxInput):
33         input_type = 'checkbox'
34     elif issubclass(type(widget), forms.MultiWidget):
35         input_type = 'multi_widget'
36     else:
37         input_type = 'input'
38 
39     context = {
40         'bound_field': bound_field,
41         'input_type': input_type,
42         'show_label': show_label}
43     return render_to_string(template, context=context)
44 
45 
46 def as_bootstrap(obj, show_label, template):
47     if isinstance(obj, BoundField):
48         return render_field(obj, show_label, template)
49     elif isinstance(obj, ErrorList):
50         return render_non_field_errors(obj)
51     elif isinstance(obj, BaseForm):
52         non_field_errors = render_non_field_errors(obj.non_field_errors())
53         fields = (render_field(field, show_label, template) for field in obj)
54         form = ''.join(fields)
55         return mark_safe(non_field_errors + form)
56     else:
57         raise TemplateSyntaxError('Filter accepts form, field and non fields '
58                                   'errors.')
59 
60 
61 @register.filter
62 def as_horizontal_form(obj, show_label=True):
63     return as_bootstrap(obj=obj, show_label=show_label,
64                         template=TEMPLATE_HORIZONTAL)
65 
66 
67 @register.filter
68 def as_vertical_form(obj, show_label=True):
69     return as_bootstrap(obj=obj, show_label=show_label,
70                         template=TEMPLATE_VERTICAL)
71 
72 
73 @register.simple_tag
74 def render_widget(obj, **attrs):
75     return obj.as_widget(attrs=attrs)
76 
77 
78 @register.filter
79 def as_pagination(items):
80     context = {'items': items}
81     return render_to_string(TEMPLATE_PAGINATION, context=context)
82
```

Path: `saleor/settings.py`
Content:
```
1 from __future__ import unicode_literals
2 
3 import ast
4 import os.path
5 
6 import dj_database_url
7 import dj_email_url
8 from django.contrib.messages import constants as messages
9 import django_cache_url
10 
11 
12 DEBUG = ast.literal_eval(os.environ.get('DEBUG', 'True'))
13 
14 SITE_ID = 1
15 
16 PROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
17 
18 ROOT_URLCONF = 'saleor.urls'
19 
20 WSGI_APPLICATION = 'saleor.wsgi.application'
21 
22 ADMINS = (
23     # ('Your Name', 'your_email@example.com'),
24 )
25 MANAGERS = ADMINS
26 INTERNAL_IPS = os.environ.get('INTERNAL_IPS', '127.0.0.1').split()
27 
28 CACHE_URL = os.environ.get('CACHE_URL',
29                            os.environ.get('REDIS_URL', 'locmem://'))
30 CACHES = {'default': django_cache_url.parse(CACHE_URL)}
31 
32 SQLITE_DB_URL = 'sqlite:///' + os.path.join(PROJECT_ROOT, 'dev.sqlite')
33 DATABASES = {'default': dj_database_url.config(default=SQLITE_DB_URL)}
34 
35 
36 TIME_ZONE = 'America/Chicago'
37 LANGUAGE_CODE = 'en-us'
38 USE_I18N = True
39 USE_L10N = True
40 USE_TZ = True
41 
42 
43 EMAIL_URL = os.environ.get('EMAIL_URL', 'console://')
44 email_config = dj_email_url.parse(EMAIL_URL)
45 
46 EMAIL_FILE_PATH = email_config['EMAIL_FILE_PATH']
47 EMAIL_HOST_USER = email_config['EMAIL_HOST_USER']
48 EMAIL_HOST_PASSWORD = email_config['EMAIL_HOST_PASSWORD']
49 EMAIL_HOST = email_config['EMAIL_HOST']
50 EMAIL_PORT = email_config['EMAIL_PORT']
51 EMAIL_BACKEND = email_config['EMAIL_BACKEND']
52 EMAIL_USE_TLS = email_config['EMAIL_USE_TLS']
53 DEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL')
54 
55 
56 MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')
57 MEDIA_URL = '/media/'
58 
59 STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')
60 STATIC_URL = '/static/'
61 STATICFILES_DIRS = [
62     os.path.join(PROJECT_ROOT, 'saleor', 'static')
63 ]
64 STATICFILES_FINDERS = [
65     'django.contrib.staticfiles.finders.FileSystemFinder',
66     'django.contrib.staticfiles.finders.AppDirectoriesFinder'
67 ]
68 
69 context_processors = [
70     'django.contrib.auth.context_processors.auth',
71     'django.core.context_processors.debug',
72     'django.core.context_processors.i18n',
73     'django.core.context_processors.media',
74     'django.core.context_processors.static',
75     'django.core.context_processors.tz',
76     'django.contrib.messages.context_processors.messages',
77     'django.core.context_processors.request',
78     'saleor.core.context_processors.default_currency',
79     'saleor.core.context_processors.categories']
80 
81 loaders = [
82     'django.template.loaders.filesystem.Loader',
83     'django.template.loaders.app_directories.Loader',
84     # TODO: this one is slow, but for now need for mptt?
85     'django.template.loaders.eggs.Loader']
86 
87 if not DEBUG:
88     loaders = [('django.template.loaders.cached.Loader', loaders)]
89 
90 TEMPLATES = [{
91     'BACKEND': 'django.template.backends.django.DjangoTemplates',
92     'DIRS': [os.path.join(PROJECT_ROOT, 'templates')],
93     'OPTIONS': {
94         'debug': DEBUG,
95         'context_processors': context_processors,
96         'loaders': loaders,
97         'string_if_invalid': '<< MISSING VARIABLE "%s" >>' if DEBUG else ''}}]
98 
99 # Make this unique, and don't share it with anybody.
100 SECRET_KEY = os.environ.get('SECRET_KEY')
101 
102 MIDDLEWARE_CLASSES = [
103     'django.contrib.sessions.middleware.SessionMiddleware',
104     'django.middleware.common.CommonMiddleware',
105     'django.middleware.csrf.CsrfViewMiddleware',
106     'django.contrib.auth.middleware.AuthenticationMiddleware',
107     'django.contrib.messages.middleware.MessageMiddleware',
108     'django.middleware.locale.LocaleMiddleware',
109     'babeldjango.middleware.LocaleMiddleware',
110     'saleor.cart.middleware.CartMiddleware',
111     'saleor.core.middleware.DiscountMiddleware',
112     'saleor.core.middleware.GoogleAnalytics'
113 ]
114 
115 INSTALLED_APPS = [
116     # External apps that need to go before django's
117     'offsite_storage',
118 
119     # Django modules
120     'django.contrib.contenttypes',
121     'django.contrib.sessions',
122     'django.contrib.messages',
123     'django.contrib.sitemaps',
124     'django.contrib.sites',
125     'django.contrib.staticfiles',
126     'django.contrib.admin',
127     'django.contrib.auth',
128 
129     # Local apps
130     'saleor.userprofile',
131     'saleor.product',
132     'saleor.cart',
133     'saleor.checkout',
134     'saleor.core',
135     'saleor.order',
136     'saleor.registration',
137     'saleor.dashboard',
138     'saleor.shipping',
139 
140     # External apps
141     'versatileimagefield',
142     'babeldjango',
143     'django_prices',
144     'emailit',
145     'mptt',
146     'payments',
147     'selectable',
148     'materializecssform',
149     'rest_framework',
150 ]
151 
152 LOGGING = {
153     'version': 1,
154     'disable_existing_loggers': False,
155     'formatters': {
156         'verbose': {
157             'format': '%(levelname)s %(asctime)s %(module)s '
158             '%(process)d %(thread)d %(message)s'
159         },
160         'simple': {
161             'format': '%(levelname)s %(message)s'
162         },
163     },
164     'filters': {
165         'require_debug_false': {
166             '()': 'django.utils.log.RequireDebugFalse'
167         },
168         'require_debug_true': {
169             '()': 'django.utils.log.RequireDebugTrue'
170         }
171     },
172     'handlers': {
173         'mail_admins': {
174             'level': 'ERROR',
175             'filters': ['require_debug_false'],
176             'class': 'django.utils.log.AdminEmailHandler'
177         },
178         'console': {
179             'level': 'DEBUG',
180             'class': 'logging.StreamHandler',
181             'filters': ['require_debug_true'],
182             'formatter': 'simple'
183         },
184     },
185     'loggers': {
186         'django.request': {
187             'handlers': ['mail_admins'],
188             'level': 'ERROR',
189             'propagate': True
190         },
191         'saleor': {
192             'handlers': ['console'],
193             'level': 'DEBUG',
194             'propagate': True
195         }
196     }
197 }
198 
199 AUTHENTICATION_BACKENDS = (
200     'saleor.registration.backends.EmailPasswordBackend',
201     'saleor.registration.backends.ExternalLoginBackend',
202     'saleor.registration.backends.TrivialBackend'
203 )
204 
205 AUTH_USER_MODEL = 'userprofile.User'
206 
207 LOGIN_URL = '/account/login'
208 
209 DEFAULT_CURRENCY = 'USD'
210 DEFAULT_WEIGHT = 'lb'
211 
212 ACCOUNT_ACTIVATION_DAYS = 3
213 
214 LOGIN_REDIRECT_URL = 'home'
215 
216 FACEBOOK_APP_ID = os.environ.get('FACEBOOK_APP_ID')
217 FACEBOOK_SECRET = os.environ.get('FACEBOOK_SECRET')
218 
219 GOOGLE_ANALYTICS_TRACKING_ID = os.environ.get('GOOGLE_ANALYTICS_TRACKING_ID')
220 GOOGLE_CLIENT_ID = os.environ.get('GOOGLE_CLIENT_ID')
221 GOOGLE_CLIENT_SECRET = os.environ.get('GOOGLE_CLIENT_SECRET')
222 
223 PAYMENT_MODEL = 'order.Payment'
224 
225 PAYMENT_VARIANTS = {
226     'default': ('payments.dummy.DummyProvider', {})
227 }
228 
229 SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
230 SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
231 
232 CHECKOUT_PAYMENT_CHOICES = [
233     ('default', 'Dummy provider')
234 ]
235 
236 MESSAGE_TAGS = {
237     messages.ERROR: 'danger',
238 }
239 
240 LOW_STOCK_THRESHOLD = 10
241 
242 PAGINATE_BY = 16
243 
244 TEST_RUNNER = ''
245 
246 ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'localhost').split()
247 
248 SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
249 
250 # Amazon S3 configuration
251 AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
252 AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
253 AWS_STATIC_BUCKET_NAME = os.environ.get('AWS_STATIC_BUCKET_NAME')
254 
255 AWS_MEDIA_ACCESS_KEY_ID = os.environ.get('AWS_MEDIA_ACCESS_KEY_ID')
256 AWS_MEDIA_SECRET_ACCESS_KEY = os.environ.get('AWS_MEDIA_SECRET_ACCESS_KEY')
257 AWS_MEDIA_BUCKET_NAME = os.environ.get('AWS_MEDIA_BUCKET_NAME')
258 
259 if AWS_STATIC_BUCKET_NAME:
260     STATICFILES_STORAGE = 'offsite_storage.storages.CachedS3FilesStorage'
261 
262 if AWS_MEDIA_BUCKET_NAME:
263     DEFAULT_FILE_STORAGE = 'offsite_storage.storages.S3MediaStorage'
264     THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE
265 
266 MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
267
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/saleor/core/templatetags/bootstrap.py b/saleor/core/templatetags/bootstrap.py
deleted file mode 100644
--- a/saleor/core/templatetags/bootstrap.py
+++ /dev/null
@@ -1,81 +0,0 @@
-from django import forms
-from django.forms.forms import BoundField, BaseForm
-from django.forms.utils import ErrorList
-from django.template import Library, TemplateSyntaxError
-from django.template.loader import render_to_string
-from django.utils.safestring import mark_safe
-
-register = Library()
-
-TEMPLATE_ERRORS = 'bootstrap/_non_field_errors.html'
-TEMPLATE_HORIZONTAL = 'bootstrap/_field_horizontal.html'
-TEMPLATE_VERTICAL = 'bootstrap/_field_vertical.html'
-TEMPLATE_PAGINATION = 'bootstrap/_pagination.html'
-
-
-def render_non_field_errors(errors):
-    if not errors:
-        return ''
-    context = {'errors': errors}
-    return render_to_string(TEMPLATE_ERRORS, context=context)
-
-
-def render_field(bound_field, show_label, template):
-    widget = bound_field.field.widget
-
-    if isinstance(widget, forms.RadioSelect):
-        input_type = 'radio'
-    elif isinstance(widget, forms.Select):
-        input_type = 'select'
-    elif isinstance(widget, forms.Textarea):
-        input_type = 'textarea'
-    elif isinstance(widget, forms.CheckboxInput):
-        input_type = 'checkbox'
-    elif issubclass(type(widget), forms.MultiWidget):
-        input_type = 'multi_widget'
-    else:
-        input_type = 'input'
-
-    context = {
-        'bound_field': bound_field,
-        'input_type': input_type,
-        'show_label': show_label}
-    return render_to_string(template, context=context)
-
-
-def as_bootstrap(obj, show_label, template):
-    if isinstance(obj, BoundField):
-        return render_field(obj, show_label, template)
-    elif isinstance(obj, ErrorList):
-        return render_non_field_errors(obj)
-    elif isinstance(obj, BaseForm):
-        non_field_errors = render_non_field_errors(obj.non_field_errors())
-        fields = (render_field(field, show_label, template) for field in obj)
-        form = ''.join(fields)
-        return mark_safe(non_field_errors + form)
-    else:
-        raise TemplateSyntaxError('Filter accepts form, field and non fields '
-                                  'errors.')
-
-
-@register.filter
-def as_horizontal_form(obj, show_label=True):
-    return as_bootstrap(obj=obj, show_label=show_label,
-                        template=TEMPLATE_HORIZONTAL)
-
-
-@register.filter
-def as_vertical_form(obj, show_label=True):
-    return as_bootstrap(obj=obj, show_label=show_label,
-                        template=TEMPLATE_VERTICAL)
-
-
-@register.simple_tag
-def render_widget(obj, **attrs):
-    return obj.as_widget(attrs=attrs)
-
-
-@register.filter
-def as_pagination(items):
-    context = {'items': items}
-    return render_to_string(TEMPLATE_PAGINATION, context=context)
diff --git a/saleor/settings.py b/saleor/settings.py
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -140,6 +140,7 @@
     # External apps
     'versatileimagefield',
     'babeldjango',
+    'bootstrap3',
     'django_prices',
     'emailit',
     'mptt',

{"golden_diff": "diff --git a/saleor/core/templatetags/bootstrap.py b/saleor/core/templatetags/bootstrap.py\ndeleted file mode 100644\n--- a/saleor/core/templatetags/bootstrap.py\n+++ /dev/null\n@@ -1,81 +0,0 @@\n-from django import forms\n-from django.forms.forms import BoundField, BaseForm\n-from django.forms.utils import ErrorList\n-from django.template import Library, TemplateSyntaxError\n-from django.template.loader import render_to_string\n-from django.utils.safestring import mark_safe\n-\n-register = Library()\n-\n-TEMPLATE_ERRORS = 'bootstrap/_non_field_errors.html'\n-TEMPLATE_HORIZONTAL = 'bootstrap/_field_horizontal.html'\n-TEMPLATE_VERTICAL = 'bootstrap/_field_vertical.html'\n-TEMPLATE_PAGINATION = 'bootstrap/_pagination.html'\n-\n-\n-def render_non_field_errors(errors):\n-    if not errors:\n-        return ''\n-    context = {'errors': errors}\n-    return render_to_string(TEMPLATE_ERRORS, context=context)\n-\n-\n-def render_field(bound_field, show_label, template):\n-    widget = bound_field.field.widget\n-\n-    if isinstance(widget, forms.RadioSelect):\n-        input_type = 'radio'\n-    elif isinstance(widget, forms.Select):\n-        input_type = 'select'\n-    elif isinstance(widget, forms.Textarea):\n-        input_type = 'textarea'\n-    elif isinstance(widget, forms.CheckboxInput):\n-        input_type = 'checkbox'\n-    elif issubclass(type(widget), forms.MultiWidget):\n-        input_type = 'multi_widget'\n-    else:\n-        input_type = 'input'\n-\n-    context = {\n-        'bound_field': bound_field,\n-        'input_type': input_type,\n-        'show_label': show_label}\n-    return render_to_string(template, context=context)\n-\n-\n-def as_bootstrap(obj, show_label, template):\n-    if isinstance(obj, BoundField):\n-        return render_field(obj, show_label, template)\n-    elif isinstance(obj, ErrorList):\n-        return render_non_field_errors(obj)\n-    elif isinstance(obj, BaseForm):\n-        non_field_errors = render_non_field_errors(obj.non_field_errors())\n-        fields = (render_field(field, show_label, template) for field in obj)\n-        form = ''.join(fields)\n-        return mark_safe(non_field_errors + form)\n-    else:\n-        raise TemplateSyntaxError('Filter accepts form, field and non fields '\n-                                  'errors.')\n-\n-\n-@register.filter\n-def as_horizontal_form(obj, show_label=True):\n-    return as_bootstrap(obj=obj, show_label=show_label,\n-                        template=TEMPLATE_HORIZONTAL)\n-\n-\n-@register.filter\n-def as_vertical_form(obj, show_label=True):\n-    return as_bootstrap(obj=obj, show_label=show_label,\n-                        template=TEMPLATE_VERTICAL)\n-\n-\n-@register.simple_tag\n-def render_widget(obj, **attrs):\n-    return obj.as_widget(attrs=attrs)\n-\n-\n-@register.filter\n-def as_pagination(items):\n-    context = {'items': items}\n-    return render_to_string(TEMPLATE_PAGINATION, context=context)\ndiff --git a/saleor/settings.py b/saleor/settings.py\n--- a/saleor/settings.py\n+++ b/saleor/settings.py\n@@ -140,6 +140,7 @@\n     # External apps\n     'versatileimagefield',\n     'babeldjango',\n+    'bootstrap3',\n     'django_prices',\n     'emailit',\n     'mptt',\n", "issue": "Wrong initial value with default radio template\n![image](https://cloud.githubusercontent.com/assets/1870738/12611581/b16ad47a-c4ed-11e5-96d2-41f63b6d33a8.png)\n\nIn example above I have selected second value but after refresh it show always first one. Why we change default radio template in first place?  I propose go with #370 .\n\n", "before_files": [{"content": "from django import forms\nfrom django.forms.forms import BoundField, BaseForm\nfrom django.forms.utils import ErrorList\nfrom django.template import Library, TemplateSyntaxError\nfrom django.template.loader import render_to_string\nfrom django.utils.safestring import mark_safe\n\nregister = Library()\n\nTEMPLATE_ERRORS = 'bootstrap/_non_field_errors.html'\nTEMPLATE_HORIZONTAL = 'bootstrap/_field_horizontal.html'\nTEMPLATE_VERTICAL = 'bootstrap/_field_vertical.html'\nTEMPLATE_PAGINATION = 'bootstrap/_pagination.html'\n\n\ndef render_non_field_errors(errors):\n    if not errors:\n        return ''\n    context = {'errors': errors}\n    return render_to_string(TEMPLATE_ERRORS, context=context)\n\n\ndef render_field(bound_field, show_label, template):\n    widget = bound_field.field.widget\n\n    if isinstance(widget, forms.RadioSelect):\n        input_type = 'radio'\n    elif isinstance(widget, forms.Select):\n        input_type = 'select'\n    elif isinstance(widget, forms.Textarea):\n        input_type = 'textarea'\n    elif isinstance(widget, forms.CheckboxInput):\n        input_type = 'checkbox'\n    elif issubclass(type(widget), forms.MultiWidget):\n        input_type = 'multi_widget'\n    else:\n        input_type = 'input'\n\n    context = {\n        'bound_field': bound_field,\n        'input_type': input_type,\n        'show_label': show_label}\n    return render_to_string(template, context=context)\n\n\ndef as_bootstrap(obj, show_label, template):\n    if isinstance(obj, BoundField):\n        return render_field(obj, show_label, template)\n    elif isinstance(obj, ErrorList):\n        return render_non_field_errors(obj)\n    elif isinstance(obj, BaseForm):\n        non_field_errors = render_non_field_errors(obj.non_field_errors())\n        fields = (render_field(field, show_label, template) for field in obj)\n        form = ''.join(fields)\n        return mark_safe(non_field_errors + form)\n    else:\n        raise TemplateSyntaxError('Filter accepts form, field and non fields '\n                                  'errors.')\n\n\n@register.filter\ndef as_horizontal_form(obj, show_label=True):\n    return as_bootstrap(obj=obj, show_label=show_label,\n                        template=TEMPLATE_HORIZONTAL)\n\n\n@register.filter\ndef as_vertical_form(obj, show_label=True):\n    return as_bootstrap(obj=obj, show_label=show_label,\n                        template=TEMPLATE_VERTICAL)\n\n\n@register.simple_tag\ndef render_widget(obj, **attrs):\n    return obj.as_widget(attrs=attrs)\n\n\n@register.filter\ndef as_pagination(items):\n    context = {'items': items}\n    return render_to_string(TEMPLATE_PAGINATION, context=context)\n", "path": "saleor/core/templatetags/bootstrap.py"}, {"content": "from __future__ import unicode_literals\n\nimport ast\nimport os.path\n\nimport dj_database_url\nimport dj_email_url\nfrom django.contrib.messages import constants as messages\nimport django_cache_url\n\n\nDEBUG = ast.literal_eval(os.environ.get('DEBUG', 'True'))\n\nSITE_ID = 1\n\nPROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))\n\nROOT_URLCONF = 'saleor.urls'\n\nWSGI_APPLICATION = 'saleor.wsgi.application'\n\nADMINS = (\n    # ('Your Name', 'your_email@example.com'),\n)\nMANAGERS = ADMINS\nINTERNAL_IPS = os.environ.get('INTERNAL_IPS', '127.0.0.1').split()\n\nCACHE_URL = os.environ.get('CACHE_URL',\n                           os.environ.get('REDIS_URL', 'locmem://'))\nCACHES = {'default': django_cache_url.parse(CACHE_URL)}\n\nSQLITE_DB_URL = 'sqlite:///' + os.path.join(PROJECT_ROOT, 'dev.sqlite')\nDATABASES = {'default': dj_database_url.config(default=SQLITE_DB_URL)}\n\n\nTIME_ZONE = 'America/Chicago'\nLANGUAGE_CODE = 'en-us'\nUSE_I18N = True\nUSE_L10N = True\nUSE_TZ = True\n\n\nEMAIL_URL = os.environ.get('EMAIL_URL', 'console://')\nemail_config = dj_email_url.parse(EMAIL_URL)\n\nEMAIL_FILE_PATH = email_config['EMAIL_FILE_PATH']\nEMAIL_HOST_USER = email_config['EMAIL_HOST_USER']\nEMAIL_HOST_PASSWORD = email_config['EMAIL_HOST_PASSWORD']\nEMAIL_HOST = email_config['EMAIL_HOST']\nEMAIL_PORT = email_config['EMAIL_PORT']\nEMAIL_BACKEND = email_config['EMAIL_BACKEND']\nEMAIL_USE_TLS = email_config['EMAIL_USE_TLS']\nDEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL')\n\n\nMEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')\nMEDIA_URL = '/media/'\n\nSTATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')\nSTATIC_URL = '/static/'\nSTATICFILES_DIRS = [\n    os.path.join(PROJECT_ROOT, 'saleor', 'static')\n]\nSTATICFILES_FINDERS = [\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder'\n]\n\ncontext_processors = [\n    'django.contrib.auth.context_processors.auth',\n    'django.core.context_processors.debug',\n    'django.core.context_processors.i18n',\n    'django.core.context_processors.media',\n    'django.core.context_processors.static',\n    'django.core.context_processors.tz',\n    'django.contrib.messages.context_processors.messages',\n    'django.core.context_processors.request',\n    'saleor.core.context_processors.default_currency',\n    'saleor.core.context_processors.categories']\n\nloaders = [\n    'django.template.loaders.filesystem.Loader',\n    'django.template.loaders.app_directories.Loader',\n    # TODO: this one is slow, but for now need for mptt?\n    'django.template.loaders.eggs.Loader']\n\nif not DEBUG:\n    loaders = [('django.template.loaders.cached.Loader', loaders)]\n\nTEMPLATES = [{\n    'BACKEND': 'django.template.backends.django.DjangoTemplates',\n    'DIRS': [os.path.join(PROJECT_ROOT, 'templates')],\n    'OPTIONS': {\n        'debug': DEBUG,\n        'context_processors': context_processors,\n        'loaders': loaders,\n        'string_if_invalid': '<< MISSING VARIABLE \"%s\" >>' if DEBUG else ''}}]\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = os.environ.get('SECRET_KEY')\n\nMIDDLEWARE_CLASSES = [\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.common.CommonMiddleware',\n    'django.middleware.csrf.CsrfViewMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.locale.LocaleMiddleware',\n    'babeldjango.middleware.LocaleMiddleware',\n    'saleor.cart.middleware.CartMiddleware',\n    'saleor.core.middleware.DiscountMiddleware',\n    'saleor.core.middleware.GoogleAnalytics'\n]\n\nINSTALLED_APPS = [\n    # External apps that need to go before django's\n    'offsite_storage',\n\n    # Django modules\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.sitemaps',\n    'django.contrib.sites',\n    'django.contrib.staticfiles',\n    'django.contrib.admin',\n    'django.contrib.auth',\n\n    # Local apps\n    'saleor.userprofile',\n    'saleor.product',\n    'saleor.cart',\n    'saleor.checkout',\n    'saleor.core',\n    'saleor.order',\n    'saleor.registration',\n    'saleor.dashboard',\n    'saleor.shipping',\n\n    # External apps\n    'versatileimagefield',\n    'babeldjango',\n    'django_prices',\n    'emailit',\n    'mptt',\n    'payments',\n    'selectable',\n    'materializecssform',\n    'rest_framework',\n]\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'formatters': {\n        'verbose': {\n            'format': '%(levelname)s %(asctime)s %(module)s '\n            '%(process)d %(thread)d %(message)s'\n        },\n        'simple': {\n            'format': '%(levelname)s %(message)s'\n        },\n    },\n    'filters': {\n        'require_debug_false': {\n            '()': 'django.utils.log.RequireDebugFalse'\n        },\n        'require_debug_true': {\n            '()': 'django.utils.log.RequireDebugTrue'\n        }\n    },\n    'handlers': {\n        'mail_admins': {\n            'level': 'ERROR',\n            'filters': ['require_debug_false'],\n            'class': 'django.utils.log.AdminEmailHandler'\n        },\n        'console': {\n            'level': 'DEBUG',\n            'class': 'logging.StreamHandler',\n            'filters': ['require_debug_true'],\n            'formatter': 'simple'\n        },\n    },\n    'loggers': {\n        'django.request': {\n            'handlers': ['mail_admins'],\n            'level': 'ERROR',\n            'propagate': True\n        },\n        'saleor': {\n            'handlers': ['console'],\n            'level': 'DEBUG',\n            'propagate': True\n        }\n    }\n}\n\nAUTHENTICATION_BACKENDS = (\n    'saleor.registration.backends.EmailPasswordBackend',\n    'saleor.registration.backends.ExternalLoginBackend',\n    'saleor.registration.backends.TrivialBackend'\n)\n\nAUTH_USER_MODEL = 'userprofile.User'\n\nLOGIN_URL = '/account/login'\n\nDEFAULT_CURRENCY = 'USD'\nDEFAULT_WEIGHT = 'lb'\n\nACCOUNT_ACTIVATION_DAYS = 3\n\nLOGIN_REDIRECT_URL = 'home'\n\nFACEBOOK_APP_ID = os.environ.get('FACEBOOK_APP_ID')\nFACEBOOK_SECRET = os.environ.get('FACEBOOK_SECRET')\n\nGOOGLE_ANALYTICS_TRACKING_ID = os.environ.get('GOOGLE_ANALYTICS_TRACKING_ID')\nGOOGLE_CLIENT_ID = os.environ.get('GOOGLE_CLIENT_ID')\nGOOGLE_CLIENT_SECRET = os.environ.get('GOOGLE_CLIENT_SECRET')\n\nPAYMENT_MODEL = 'order.Payment'\n\nPAYMENT_VARIANTS = {\n    'default': ('payments.dummy.DummyProvider', {})\n}\n\nSESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'\nSESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'\n\nCHECKOUT_PAYMENT_CHOICES = [\n    ('default', 'Dummy provider')\n]\n\nMESSAGE_TAGS = {\n    messages.ERROR: 'danger',\n}\n\nLOW_STOCK_THRESHOLD = 10\n\nPAGINATE_BY = 16\n\nTEST_RUNNER = ''\n\nALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'localhost').split()\n\nSECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')\n\n# Amazon S3 configuration\nAWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')\nAWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')\nAWS_STATIC_BUCKET_NAME = os.environ.get('AWS_STATIC_BUCKET_NAME')\n\nAWS_MEDIA_ACCESS_KEY_ID = os.environ.get('AWS_MEDIA_ACCESS_KEY_ID')\nAWS_MEDIA_SECRET_ACCESS_KEY = os.environ.get('AWS_MEDIA_SECRET_ACCESS_KEY')\nAWS_MEDIA_BUCKET_NAME = os.environ.get('AWS_MEDIA_BUCKET_NAME')\n\nif AWS_STATIC_BUCKET_NAME:\n    STATICFILES_STORAGE = 'offsite_storage.storages.CachedS3FilesStorage'\n\nif AWS_MEDIA_BUCKET_NAME:\n    DEFAULT_FILE_STORAGE = 'offsite_storage.storages.S3MediaStorage'\n    THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE\n\nMESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'\n", "path": "saleor/settings.py"}], "after_files": [{"content": null, "path": "saleor/core/templatetags/bootstrap.py"}, {"content": "from __future__ import unicode_literals\n\nimport ast\nimport os.path\n\nimport dj_database_url\nimport dj_email_url\nfrom django.contrib.messages import constants as messages\nimport django_cache_url\n\n\nDEBUG = ast.literal_eval(os.environ.get('DEBUG', 'True'))\n\nSITE_ID = 1\n\nPROJECT_ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))\n\nROOT_URLCONF = 'saleor.urls'\n\nWSGI_APPLICATION = 'saleor.wsgi.application'\n\nADMINS = (\n    # ('Your Name', 'your_email@example.com'),\n)\nMANAGERS = ADMINS\nINTERNAL_IPS = os.environ.get('INTERNAL_IPS', '127.0.0.1').split()\n\nCACHE_URL = os.environ.get('CACHE_URL',\n                           os.environ.get('REDIS_URL', 'locmem://'))\nCACHES = {'default': django_cache_url.parse(CACHE_URL)}\n\nSQLITE_DB_URL = 'sqlite:///' + os.path.join(PROJECT_ROOT, 'dev.sqlite')\nDATABASES = {'default': dj_database_url.config(default=SQLITE_DB_URL)}\n\n\nTIME_ZONE = 'America/Chicago'\nLANGUAGE_CODE = 'en-us'\nUSE_I18N = True\nUSE_L10N = True\nUSE_TZ = True\n\n\nEMAIL_URL = os.environ.get('EMAIL_URL', 'console://')\nemail_config = dj_email_url.parse(EMAIL_URL)\n\nEMAIL_FILE_PATH = email_config['EMAIL_FILE_PATH']\nEMAIL_HOST_USER = email_config['EMAIL_HOST_USER']\nEMAIL_HOST_PASSWORD = email_config['EMAIL_HOST_PASSWORD']\nEMAIL_HOST = email_config['EMAIL_HOST']\nEMAIL_PORT = email_config['EMAIL_PORT']\nEMAIL_BACKEND = email_config['EMAIL_BACKEND']\nEMAIL_USE_TLS = email_config['EMAIL_USE_TLS']\nDEFAULT_FROM_EMAIL = os.environ.get('DEFAULT_FROM_EMAIL')\n\n\nMEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')\nMEDIA_URL = '/media/'\n\nSTATIC_ROOT = os.path.join(PROJECT_ROOT, 'static')\nSTATIC_URL = '/static/'\nSTATICFILES_DIRS = [\n    os.path.join(PROJECT_ROOT, 'saleor', 'static')\n]\nSTATICFILES_FINDERS = [\n    'django.contrib.staticfiles.finders.FileSystemFinder',\n    'django.contrib.staticfiles.finders.AppDirectoriesFinder'\n]\n\ncontext_processors = [\n    'django.contrib.auth.context_processors.auth',\n    'django.core.context_processors.debug',\n    'django.core.context_processors.i18n',\n    'django.core.context_processors.media',\n    'django.core.context_processors.static',\n    'django.core.context_processors.tz',\n    'django.contrib.messages.context_processors.messages',\n    'django.core.context_processors.request',\n    'saleor.core.context_processors.default_currency',\n    'saleor.core.context_processors.categories']\n\nloaders = [\n    'django.template.loaders.filesystem.Loader',\n    'django.template.loaders.app_directories.Loader',\n    # TODO: this one is slow, but for now need for mptt?\n    'django.template.loaders.eggs.Loader']\n\nif not DEBUG:\n    loaders = [('django.template.loaders.cached.Loader', loaders)]\n\nTEMPLATES = [{\n    'BACKEND': 'django.template.backends.django.DjangoTemplates',\n    'DIRS': [os.path.join(PROJECT_ROOT, 'templates')],\n    'OPTIONS': {\n        'debug': DEBUG,\n        'context_processors': context_processors,\n        'loaders': loaders,\n        'string_if_invalid': '<< MISSING VARIABLE \"%s\" >>' if DEBUG else ''}}]\n\n# Make this unique, and don't share it with anybody.\nSECRET_KEY = os.environ.get('SECRET_KEY')\n\nMIDDLEWARE_CLASSES = [\n    'django.contrib.sessions.middleware.SessionMiddleware',\n    'django.middleware.common.CommonMiddleware',\n    'django.middleware.csrf.CsrfViewMiddleware',\n    'django.contrib.auth.middleware.AuthenticationMiddleware',\n    'django.contrib.messages.middleware.MessageMiddleware',\n    'django.middleware.locale.LocaleMiddleware',\n    'babeldjango.middleware.LocaleMiddleware',\n    'saleor.cart.middleware.CartMiddleware',\n    'saleor.core.middleware.DiscountMiddleware',\n    'saleor.core.middleware.GoogleAnalytics'\n]\n\nINSTALLED_APPS = [\n    # External apps that need to go before django's\n    'offsite_storage',\n\n    # Django modules\n    'django.contrib.contenttypes',\n    'django.contrib.sessions',\n    'django.contrib.messages',\n    'django.contrib.sitemaps',\n    'django.contrib.sites',\n    'django.contrib.staticfiles',\n    'django.contrib.admin',\n    'django.contrib.auth',\n\n    # Local apps\n    'saleor.userprofile',\n    'saleor.product',\n    'saleor.cart',\n    'saleor.checkout',\n    'saleor.core',\n    'saleor.order',\n    'saleor.registration',\n    'saleor.dashboard',\n    'saleor.shipping',\n\n    # External apps\n    'versatileimagefield',\n    'babeldjango',\n    'bootstrap3',\n    'django_prices',\n    'emailit',\n    'mptt',\n    'payments',\n    'selectable',\n    'materializecssform',\n    'rest_framework',\n]\n\nLOGGING = {\n    'version': 1,\n    'disable_existing_loggers': False,\n    'formatters': {\n        'verbose': {\n            'format': '%(levelname)s %(asctime)s %(module)s '\n            '%(process)d %(thread)d %(message)s'\n        },\n        'simple': {\n            'format': '%(levelname)s %(message)s'\n        },\n    },\n    'filters': {\n        'require_debug_false': {\n            '()': 'django.utils.log.RequireDebugFalse'\n        },\n        'require_debug_true': {\n            '()': 'django.utils.log.RequireDebugTrue'\n        }\n    },\n    'handlers': {\n        'mail_admins': {\n            'level': 'ERROR',\n            'filters': ['require_debug_false'],\n            'class': 'django.utils.log.AdminEmailHandler'\n        },\n        'console': {\n            'level': 'DEBUG',\n            'class': 'logging.StreamHandler',\n            'filters': ['require_debug_true'],\n            'formatter': 'simple'\n        },\n    },\n    'loggers': {\n        'django.request': {\n            'handlers': ['mail_admins'],\n            'level': 'ERROR',\n            'propagate': True\n        },\n        'saleor': {\n            'handlers': ['console'],\n            'level': 'DEBUG',\n            'propagate': True\n        }\n    }\n}\n\nAUTHENTICATION_BACKENDS = (\n    'saleor.registration.backends.EmailPasswordBackend',\n    'saleor.registration.backends.ExternalLoginBackend',\n    'saleor.registration.backends.TrivialBackend'\n)\n\nAUTH_USER_MODEL = 'userprofile.User'\n\nLOGIN_URL = '/account/login'\n\nDEFAULT_CURRENCY = 'USD'\nDEFAULT_WEIGHT = 'lb'\n\nACCOUNT_ACTIVATION_DAYS = 3\n\nLOGIN_REDIRECT_URL = 'home'\n\nFACEBOOK_APP_ID = os.environ.get('FACEBOOK_APP_ID')\nFACEBOOK_SECRET = os.environ.get('FACEBOOK_SECRET')\n\nGOOGLE_ANALYTICS_TRACKING_ID = os.environ.get('GOOGLE_ANALYTICS_TRACKING_ID')\nGOOGLE_CLIENT_ID = os.environ.get('GOOGLE_CLIENT_ID')\nGOOGLE_CLIENT_SECRET = os.environ.get('GOOGLE_CLIENT_SECRET')\n\nPAYMENT_MODEL = 'order.Payment'\n\nPAYMENT_VARIANTS = {\n    'default': ('payments.dummy.DummyProvider', {})\n}\n\nSESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'\nSESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'\n\nCHECKOUT_PAYMENT_CHOICES = [\n    ('default', 'Dummy provider')\n]\n\nMESSAGE_TAGS = {\n    messages.ERROR: 'danger',\n}\n\nLOW_STOCK_THRESHOLD = 10\n\nPAGINATE_BY = 16\n\nTEST_RUNNER = ''\n\nALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', 'localhost').split()\n\nSECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')\n\n# Amazon S3 configuration\nAWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')\nAWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')\nAWS_STATIC_BUCKET_NAME = os.environ.get('AWS_STATIC_BUCKET_NAME')\n\nAWS_MEDIA_ACCESS_KEY_ID = os.environ.get('AWS_MEDIA_ACCESS_KEY_ID')\nAWS_MEDIA_SECRET_ACCESS_KEY = os.environ.get('AWS_MEDIA_SECRET_ACCESS_KEY')\nAWS_MEDIA_BUCKET_NAME = os.environ.get('AWS_MEDIA_BUCKET_NAME')\n\nif AWS_STATIC_BUCKET_NAME:\n    STATICFILES_STORAGE = 'offsite_storage.storages.CachedS3FilesStorage'\n\nif AWS_MEDIA_BUCKET_NAME:\n    DEFAULT_FILE_STORAGE = 'offsite_storage.storages.S3MediaStorage'\n    THUMBNAIL_DEFAULT_STORAGE = DEFAULT_FILE_STORAGE\n\nMESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'\n", "path": "saleor/settings.py"}]}