Sfoglia il codice sorgente

Remove the `US` demo site from the repository.

This might be resurrected in a separate repository in the future.
master
Michael van Tellingen 10 anni fa
parent
commit
bcbbd053f9

+ 0
- 13
Makefile Vedi File

@@ -52,19 +52,6 @@ build_demo:
52 52
 
53 53
 demo: install build_demo
54 54
 
55
-us_site: install
56
-	# Install additional requirements
57
-	pip install -r requirements_us.txt
58
-	# Create database
59
-	sites/us/manage.py reset_db --router=default --noinput
60
-	sites/us/manage.py migrate
61
-	# Import some fixtures
62
-	sites/us/manage.py oscar_populate_countries
63
-	sites/us/manage.py loaddata sites/us/fixtures/*.json
64
-	sites/us/manage.py loaddata sites/_fixtures/auth.json sites/_fixtures/ranges.json 
65
-	# Create catalogue (using a fixture from the demo site)
66
-	sites/us/manage.py create_demo_products --class=Books sites/demo/fixtures/books.csv
67
-
68 55
 docs:
69 56
 	cd docs && make html
70 57
 

+ 0
- 5
docs/source/howto/how_to_handle_us_taxes.rst Vedi File

@@ -75,8 +75,3 @@ An example implementation of the ``tax.py`` module is:
75 75
         def calculate_tax(price, rate):
76 76
             tax = price * rate
77 77
             return tax.quantize(D('0.01'))
78
-
79
-.. tip::
80
-
81
-   Oscar's repository contains a sample Oscar site customised for the US.  See
82
-   :ref:`us_site` for more information.

+ 2
- 23
docs/source/internals/sandbox.rst Vedi File

@@ -2,9 +2,8 @@
2 2
 Sample Oscar projects
3 3
 =====================
4 4
 
5
-Oscar ships with three sample projects: a 'sandbox' site, which is a vanilla
6
-install of Oscar using the default templates and styles, a sample US site which
7
-customises Oscar to use US style taxes, and a fully featured
5
+Oscar ships with two sample projects: a 'sandbox' site, which is a vanilla
6
+install of Oscar using the default templates and styles and a fully featured
8 7
 'demo' site which demonstrates how Oscar can be re-skinned and customised to
9 8
 model a domain.
10 9
 
@@ -90,26 +89,6 @@ at: http://localhost:8000.  A sample superuser is installed with credentials::
90 89
 
91 90
 .. _us_site:
92 91
 
93
-The US site
94
------------
95
-
96
-The US site is a relatively simple Oscar that makes a few key customisations in
97
-order to mimic how sites in the US work. Specifically, it:
98
-
99
-- Overrides the partner app to supply a new strategy selector which ensures all
100
-  prices are returned without taxes.
101
-
102
-- Overrides the checkout app in order to apply taxes to submissions once the
103
-  shipping address is known.
104
-
105
-To browse the US site locally run:
106
-
107
-.. code-block:: bash
108
-
109
-   (oscar) $ make us_site
110
-   (oscar) $ sites/us/manage.py runserver
111
-
112
-and the US site will be browsable at http://localhost:8000
113 92
 
114 93
 The demo site
115 94
 -------------

+ 0
- 1
requirements_us.txt Vedi File

@@ -1 +0,0 @@
1
-django-localflavor==1.0

+ 0
- 6
sites/us/README.rst Vedi File

@@ -1,6 +0,0 @@
1
-=======
2
-US site
3
-=======
4
-
5
-This is a simple Oscar site configured to sell products in USD with taxes only
6
-calculated during checkout.

+ 0
- 0
sites/us/__init__.py Vedi File


+ 0
- 0
sites/us/apps/__init__.py Vedi File


+ 0
- 0
sites/us/apps/checkout/__init__.py Vedi File


+ 0
- 14
sites/us/apps/checkout/forms.py Vedi File

@@ -1,14 +0,0 @@
1
-from django.utils.translation import ugettext_lazy as _
2
-from localflavor.us import forms as us_forms
3
-
4
-from oscar.apps.checkout import forms as checkout_forms
5
-
6
-
7
-class ShippingAddressForm(checkout_forms.ShippingAddressForm):
8
-    state = us_forms.USStateField(label="State", widget=us_forms.USStateSelect)
9
-
10
-    def __init__(self, *args, **kwargs):
11
-        super(ShippingAddressForm, self).__init__(*args, **kwargs)
12
-        self.fields['postcode'].label = _("Zip code")
13
-        self.fields['state'].help_text = _(
14
-            "Only orders going to New Jersey are liable for Sales tax")

+ 0
- 0
sites/us/apps/checkout/models.py Vedi File


+ 0
- 29
sites/us/apps/checkout/session.py Vedi File

@@ -1,29 +0,0 @@
1
-from oscar.apps.checkout import session
2
-from apps import tax
3
-
4
-
5
-# Override the session mixin (which every checkout view uses) so we can apply
6
-# takes when the shipping address is known.
7
-class CheckoutSessionMixin(session.CheckoutSessionMixin):
8
-
9
-    def build_submission(self, **kwargs):
10
-        submission = super(CheckoutSessionMixin, self).build_submission(
11
-            **kwargs)
12
-
13
-        if submission['shipping_address'] and submission['shipping_method']:
14
-            tax.apply_to(submission)
15
-
16
-            # Recalculate order total to ensure we have a tax-inclusive total
17
-            submission['order_total'] = self.get_order_totals(
18
-                submission['basket'], submission['shipping_charge'])
19
-
20
-        return submission
21
-
22
-    def get_context_data(self, **kwargs):
23
-        ctx = super(CheckoutSessionMixin, self).get_context_data(**kwargs)
24
-
25
-        # Oscar's checkout templates look for this variable which specifies to
26
-        # break out the tax totals into a separate subtotal.
27
-        ctx['show_tax_separately'] = True
28
-
29
-        return ctx

+ 0
- 1
sites/us/apps/checkout/views.py Vedi File

@@ -1 +0,0 @@
1
-

+ 0
- 0
sites/us/apps/partner/__init__.py Vedi File


+ 0
- 110
sites/us/apps/partner/migrations/0001_initial.py Vedi File

@@ -1,110 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-from __future__ import unicode_literals
3
-
4
-from django.db import models, migrations
5
-import oscar.models.fields.autoslugfield
6
-import oscar.models.fields
7
-from django.conf import settings
8
-
9
-
10
-class Migration(migrations.Migration):
11
-
12
-    dependencies = [
13
-        ('catalogue', '0001_initial'),
14
-        ('address', '0001_initial'),
15
-        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
16
-    ]
17
-
18
-    operations = [
19
-        migrations.CreateModel(
20
-            name='Partner',
21
-            fields=[
22
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
23
-                ('code', oscar.models.fields.autoslugfield.AutoSlugField(populate_from='name', unique=True, verbose_name='Code', max_length=128, editable=False, blank=True)),
24
-                ('name', models.CharField(max_length=128, verbose_name='Name', blank=True)),
25
-                ('users', models.ManyToManyField(related_name='partners', blank=True, verbose_name='Users', to=settings.AUTH_USER_MODEL, null=True)),
26
-            ],
27
-            options={
28
-                'verbose_name_plural': 'Fulfillment partners',
29
-                'verbose_name': 'Fulfillment partner',
30
-                'abstract': False,
31
-                'permissions': (('dashboard_access', 'Can access dashboard'),),
32
-            },
33
-            bases=(models.Model,),
34
-        ),
35
-        migrations.CreateModel(
36
-            name='PartnerAddress',
37
-            fields=[
38
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
39
-                ('title', models.CharField(verbose_name='Title', max_length=64, blank=True, choices=[('Mr', 'Mr'), ('Miss', 'Miss'), ('Mrs', 'Mrs'), ('Ms', 'Ms'), ('Dr', 'Dr')])),
40
-                ('first_name', models.CharField(max_length=255, verbose_name='First name', blank=True)),
41
-                ('last_name', models.CharField(max_length=255, verbose_name='Last name', blank=True)),
42
-                ('line1', models.CharField(max_length=255, verbose_name='First line of address')),
43
-                ('line2', models.CharField(max_length=255, verbose_name='Second line of address', blank=True)),
44
-                ('line3', models.CharField(max_length=255, verbose_name='Third line of address', blank=True)),
45
-                ('line4', models.CharField(max_length=255, verbose_name='City', blank=True)),
46
-                ('state', models.CharField(max_length=255, verbose_name='State/County', blank=True)),
47
-                ('postcode', oscar.models.fields.UppercaseCharField(max_length=64, verbose_name='Post/Zip-code', blank=True)),
48
-                ('search_text', models.TextField(editable=False, verbose_name='Search text - used only for searching addresses')),
49
-                ('country', models.ForeignKey(verbose_name='Country', to='address.Country')),
50
-                ('partner', models.ForeignKey(verbose_name='Partner', related_name='addresses', to='partner.Partner')),
51
-            ],
52
-            options={
53
-                'verbose_name_plural': 'Partner addresses',
54
-                'verbose_name': 'Partner address',
55
-                'abstract': False,
56
-            },
57
-            bases=(models.Model,),
58
-        ),
59
-        migrations.CreateModel(
60
-            name='StockAlert',
61
-            fields=[
62
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
63
-                ('threshold', models.PositiveIntegerField(verbose_name='Threshold')),
64
-                ('status', models.CharField(default='Open', max_length=128, verbose_name='Status', choices=[('Open', 'Open'), ('Closed', 'Closed')])),
65
-                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date Created')),
66
-                ('date_closed', models.DateTimeField(blank=True, verbose_name='Date Closed', null=True)),
67
-            ],
68
-            options={
69
-                'ordering': ('-date_created',),
70
-                'verbose_name_plural': 'Stock alerts',
71
-                'verbose_name': 'Stock alert',
72
-                'abstract': False,
73
-            },
74
-            bases=(models.Model,),
75
-        ),
76
-        migrations.CreateModel(
77
-            name='StockRecord',
78
-            fields=[
79
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
80
-                ('partner_sku', models.CharField(max_length=128, verbose_name='Partner SKU')),
81
-                ('price_currency', models.CharField(default='GBP', max_length=12, verbose_name='Currency')),
82
-                ('price_excl_tax', models.DecimalField(max_digits=12, decimal_places=2, blank=True, verbose_name='Price (excl. tax)', null=True)),
83
-                ('price_retail', models.DecimalField(max_digits=12, decimal_places=2, blank=True, verbose_name='Price (retail)', null=True)),
84
-                ('cost_price', models.DecimalField(max_digits=12, decimal_places=2, blank=True, verbose_name='Cost Price', null=True)),
85
-                ('num_in_stock', models.PositiveIntegerField(blank=True, verbose_name='Number in stock', null=True)),
86
-                ('num_allocated', models.IntegerField(blank=True, verbose_name='Number allocated', null=True)),
87
-                ('low_stock_threshold', models.PositiveIntegerField(blank=True, verbose_name='Low Stock Threshold', null=True)),
88
-                ('date_created', models.DateTimeField(auto_now_add=True, verbose_name='Date created')),
89
-                ('date_updated', models.DateTimeField(auto_now=True, db_index=True, verbose_name='Date updated')),
90
-                ('partner', models.ForeignKey(verbose_name='Partner', related_name='stockrecords', to='partner.Partner')),
91
-                ('product', models.ForeignKey(verbose_name='Product', related_name='stockrecords', to='catalogue.Product')),
92
-            ],
93
-            options={
94
-                'verbose_name_plural': 'Stock records',
95
-                'verbose_name': 'Stock record',
96
-                'abstract': False,
97
-            },
98
-            bases=(models.Model,),
99
-        ),
100
-        migrations.AlterUniqueTogether(
101
-            name='stockrecord',
102
-            unique_together=set([('partner', 'partner_sku')]),
103
-        ),
104
-        migrations.AddField(
105
-            model_name='stockalert',
106
-            name='stockrecord',
107
-            field=models.ForeignKey(verbose_name='Stock Record', related_name='alerts', to='partner.StockRecord'),
108
-            preserve_default=True,
109
-        ),
110
-    ]

+ 0
- 20
sites/us/apps/partner/migrations/0002_auto_20141007_2032.py Vedi File

@@ -1,20 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-from __future__ import unicode_literals
3
-
4
-from django.db import models, migrations
5
-import oscar.core.utils
6
-
7
-
8
-class Migration(migrations.Migration):
9
-
10
-    dependencies = [
11
-        ('partner', '0001_initial'),
12
-    ]
13
-
14
-    operations = [
15
-        migrations.AlterField(
16
-            model_name='stockrecord',
17
-            name='price_currency',
18
-            field=models.CharField(default=oscar.core.utils.get_default_currency, max_length=12, verbose_name='Currency'),
19
-        ),
20
-    ]

+ 0
- 0
sites/us/apps/partner/migrations/__init__.py Vedi File


+ 0
- 1
sites/us/apps/partner/models.py Vedi File

@@ -1 +0,0 @@
1
-from oscar.apps.partner.models import *

+ 0
- 7
sites/us/apps/partner/strategy.py Vedi File

@@ -1,7 +0,0 @@
1
-from oscar.apps.partner import strategy
2
-
3
-
4
-class Selector(object):
5
-
6
-    def strategy(self, request=None, user=None, **kwargs):
7
-        return strategy.US(request)

+ 0
- 0
sites/us/apps/shipping/__init__.py Vedi File


+ 0
- 1
sites/us/apps/shipping/admin.py Vedi File

@@ -1 +0,0 @@
1
-from oscar.apps.shipping.admin import *  # noqa

+ 0
- 76
sites/us/apps/shipping/migrations/0001_initial.py Vedi File

@@ -1,76 +0,0 @@
1
-# -*- coding: utf-8 -*-
2
-from __future__ import unicode_literals
3
-
4
-from django.db import models, migrations
5
-import oscar.models.fields.autoslugfield
6
-from decimal import Decimal
7
-import django.core.validators
8
-
9
-
10
-class Migration(migrations.Migration):
11
-
12
-    dependencies = [
13
-        ('address', '0001_initial'),
14
-    ]
15
-
16
-    operations = [
17
-        migrations.CreateModel(
18
-            name='OrderAndItemCharges',
19
-            fields=[
20
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
21
-                ('code', oscar.models.fields.autoslugfield.AutoSlugField(populate_from='name', unique=True, verbose_name='Slug', max_length=128, editable=False, blank=True)),
22
-                ('name', models.CharField(unique=True, max_length=128, verbose_name='Name')),
23
-                ('description', models.TextField(verbose_name='Description', blank=True)),
24
-                ('price_per_order', models.DecimalField(default=Decimal('0.00'), max_digits=12, decimal_places=2, verbose_name='Price per order')),
25
-                ('price_per_item', models.DecimalField(default=Decimal('0.00'), max_digits=12, decimal_places=2, verbose_name='Price per item')),
26
-                ('free_shipping_threshold', models.DecimalField(max_digits=12, decimal_places=2, blank=True, verbose_name='Free Shipping', null=True)),
27
-                ('countries', models.ManyToManyField(blank=True, verbose_name='Countries', to='address.Country', null=True)),
28
-            ],
29
-            options={
30
-                'ordering': ['name'],
31
-                'verbose_name_plural': 'Order and Item Charges',
32
-                'verbose_name': 'Order and Item Charge',
33
-                'abstract': False,
34
-            },
35
-            bases=(models.Model,),
36
-        ),
37
-        migrations.CreateModel(
38
-            name='WeightBand',
39
-            fields=[
40
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
41
-                ('upper_limit', models.DecimalField(verbose_name='Upper Limit', decimal_places=3, validators=[django.core.validators.MinValueValidator(Decimal('0.00'))], help_text='Enter upper limit of this weight band in kg. The lower limit will be determined by the other weight bands.', max_digits=12)),
42
-                ('charge', models.DecimalField(max_digits=12, decimal_places=2, validators=[django.core.validators.MinValueValidator(Decimal('0.00'))], verbose_name='Charge')),
43
-            ],
44
-            options={
45
-                'ordering': ['method', 'upper_limit'],
46
-                'verbose_name_plural': 'Weight Bands',
47
-                'verbose_name': 'Weight Band',
48
-                'abstract': False,
49
-            },
50
-            bases=(models.Model,),
51
-        ),
52
-        migrations.CreateModel(
53
-            name='WeightBased',
54
-            fields=[
55
-                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
56
-                ('code', oscar.models.fields.autoslugfield.AutoSlugField(populate_from='name', unique=True, verbose_name='Slug', max_length=128, editable=False, blank=True)),
57
-                ('name', models.CharField(unique=True, max_length=128, verbose_name='Name')),
58
-                ('description', models.TextField(verbose_name='Description', blank=True)),
59
-                ('default_weight', models.DecimalField(validators=[django.core.validators.MinValueValidator(Decimal('0.00'))], verbose_name='Default Weight', default=Decimal('0.000'), max_digits=12, decimal_places=3, help_text='Default product weight in kg when no weight attribute is defined')),
60
-                ('countries', models.ManyToManyField(blank=True, verbose_name='Countries', to='address.Country', null=True)),
61
-            ],
62
-            options={
63
-                'ordering': ['name'],
64
-                'verbose_name_plural': 'Weight-based Shipping Methods',
65
-                'verbose_name': 'Weight-based Shipping Method',
66
-                'abstract': False,
67
-            },
68
-            bases=(models.Model,),
69
-        ),
70
-        migrations.AddField(
71
-            model_name='weightband',
72
-            name='method',
73
-            field=models.ForeignKey(verbose_name='Method', related_name='bands', to='shipping.WeightBased'),
74
-            preserve_default=True,
75
-        ),
76
-    ]

+ 0
- 0
sites/us/apps/shipping/migrations/__init__.py Vedi File


+ 0
- 1
sites/us/apps/shipping/models.py Vedi File

@@ -1 +0,0 @@
1
-from oscar.apps.shipping.models import *

+ 0
- 28
sites/us/apps/shipping/repository.py Vedi File

@@ -1,28 +0,0 @@
1
-from decimal import Decimal as D
2
-
3
-from oscar.apps.shipping import repository, methods, models
4
-
5
-
6
-class Standard(methods.FixedPrice):
7
-    code = "standard"
8
-    name = "Standard"
9
-    charge_excl_tax = D('10.00')
10
-
11
-
12
-class Express(methods.FixedPrice):
13
-    code = "express"
14
-    name = "Express"
15
-    charge_excl_tax = D('20.00')
16
-
17
-
18
-class Repository(repository.Repository):
19
-
20
-    def get_available_shipping_methods(
21
-            self, basket, shipping_addr=None, **kwargs):
22
-        methods = [Standard(), Express()]
23
-        if shipping_addr:
24
-            item_methods = models.OrderAndItemCharges.objects.filter(
25
-                countries=shipping_addr.country)
26
-            methods.extend(list(item_methods))
27
-
28
-        return methods

+ 0
- 36
sites/us/apps/tax.py Vedi File

@@ -1,36 +0,0 @@
1
-from decimal import Decimal as D
2
-
3
-
4
-# State tax rates
5
-STATE_TAX_RATES = {
6
-    'NJ': D('0.07')
7
-}
8
-ZERO = D('0.00')
9
-
10
-
11
-def apply_to(submission):
12
-    """
13
-    Calculate and apply taxes to a submission
14
-    """
15
-    # This is a dummy tax function which only applies taxes for addresses in
16
-    # New Jersey and New York. In reality, you'll probably want to use a tax
17
-    # service like Avalara to look up the taxes for a given submission.
18
-    shipping_address = submission['shipping_address']
19
-    rate = STATE_TAX_RATES.get(
20
-        shipping_address.state, ZERO)
21
-    for line in submission['basket'].all_lines():
22
-        line_tax = calculate_tax(
23
-            line.line_price_excl_tax_incl_discounts, rate)
24
-        # We need to split the line tax down into a unit tax amount.
25
-        unit_tax = (line_tax / line.quantity).quantize(D('0.01'))
26
-        line.purchase_info.price.tax = unit_tax
27
-
28
-    shipping_charge = submission['shipping_charge']
29
-    if shipping_charge is not None:
30
-        shipping_charge.tax = calculate_tax(
31
-            shipping_charge.excl_tax, rate)
32
-
33
-
34
-def calculate_tax(price, rate):
35
-    tax = price * rate
36
-    return tax.quantize(D('0.01'))

+ 0
- 86
sites/us/fixtures/product-attributes.json Vedi File

@@ -1,86 +0,0 @@
1
-[
2
-    {
3
-        "pk": 1,
4
-        "model": "catalogue.productattribute",
5
-        "fields": {
6
-            "code": "author",
7
-            "product_class": 1,
8
-            "option_group": null,
9
-            "required": false,
10
-            "type": "text",
11
-            "name": "Author"
12
-        }
13
-    },
14
-    {
15
-        "pk": 2, 
16
-        "model": "catalogue.productattribute", 
17
-        "fields": {
18
-            "code": "binding", 
19
-            "product_class": 1, 
20
-            "option_group": null,
21
-            "required": false, 
22
-            "type": "text", 
23
-            "name": "Binding"
24
-        }
25
-    }, 
26
-    {
27
-        "pk": 3, 
28
-        "model": "catalogue.productattribute", 
29
-        "fields": {
30
-            "code": "language", 
31
-            "product_class": 1, 
32
-            "option_group": null,
33
-            "required": false, 
34
-            "type": "text", 
35
-            "name": "Language"
36
-        }
37
-    }, 
38
-    {
39
-        "pk": 4, 
40
-        "model": "catalogue.productattribute", 
41
-        "fields": {
42
-            "code": "number_of_pages", 
43
-            "product_class": 1, 
44
-            "option_group": null,
45
-            "required": false, 
46
-            "type": "integer", 
47
-            "name": "Number of pages"
48
-        }
49
-    }, 
50
-    {
51
-        "pk": 5,
52
-        "model": "catalogue.productattribute",
53
-        "fields": {
54
-            "code": "publication_date",
55
-            "product_class": 1,
56
-            "option_group": null,
57
-            "required": false,
58
-            "type": "date",
59
-            "name": "Publication Date"
60
-        }
61
-    },
62
-    {
63
-        "pk": 6, 
64
-        "model": "catalogue.productattribute", 
65
-        "fields": {
66
-            "code": "publisher", 
67
-            "product_class": 1, 
68
-            "option_group": null,
69
-            "required": false, 
70
-            "type": "text", 
71
-            "name": "Publisher"
72
-        }
73
-    }, 
74
-    {
75
-        "pk": 7,
76
-        "model": "catalogue.productattribute",
77
-        "fields": {
78
-            "code": "weight",
79
-            "product_class": 1,
80
-            "option_group": null,
81
-            "required": false,
82
-            "type": "integer",
83
-            "name": "Weight"
84
-        }
85
-    }
86
-]

+ 0
- 13
sites/us/fixtures/product-classes.json Vedi File

@@ -1,13 +0,0 @@
1
-[
2
-    {
3
-        "pk": 1, 
4
-        "model": "catalogue.productclass", 
5
-        "fields": {
6
-            "track_stock": true, 
7
-            "options": [], 
8
-            "requires_shipping": true, 
9
-            "name": "Books", 
10
-            "slug": "books"
11
-        }
12
-    } 
13
-]

+ 0
- 10
sites/us/manage.py Vedi File

@@ -1,10 +0,0 @@
1
-#!/usr/bin/env python
2
-import os
3
-import sys
4
-
5
-if __name__ == "__main__":
6
-    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
7
-
8
-    from django.core.management import execute_from_command_line
9
-
10
-    execute_from_command_line(sys.argv)

+ 0
- 365
sites/us/settings.py Vedi File

@@ -1,365 +0,0 @@
1
-import os
2
-
3
-# Path helper
4
-location = lambda x: os.path.join(
5
-    os.path.dirname(os.path.realpath(__file__)), x)
6
-
7
-USE_TZ = True
8
-
9
-DEBUG = True
10
-TEMPLATE_DEBUG = True
11
-SQL_DEBUG = True
12
-
13
-EMAIL_SUBJECT_PREFIX = '[Oscar US sandbox] '
14
-EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
15
-
16
-# Use a Sqlite database by default
17
-DATABASES = {
18
-    'default': {
19
-        'ENGINE': 'django.db.backends.sqlite3',
20
-        'NAME': location('db.sqlite'),
21
-        'USER': '',
22
-        'PASSWORD': '',
23
-        'HOST': '',
24
-        'PORT': '',
25
-        'ATOMIC_REQUESTS': True
26
-    }
27
-}
28
-
29
-CACHES = {
30
-    'default': {
31
-        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
32
-    }
33
-}
34
-
35
-
36
-# Local time zone for this installation. Choices can be found here:
37
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
38
-# although not all choices may be available on all operating systems.
39
-# On Unix systems, a value of None will cause Django to use the same
40
-# timezone as the operating system.
41
-# If running in a Windows environment this must be set to the same as your
42
-# system time zone.
43
-TIME_ZONE = 'Europe/London'
44
-
45
-# Language code for this installation. All choices can be found here:
46
-# http://www.i18nguy.com/unicode/language-identifiers.html
47
-LANGUAGE_CODE = 'en-gb'
48
-
49
-# Includes all languages that have >50% coverage in Transifex
50
-# Taken from Django's default setting for LANGUAGES
51
-gettext_noop = lambda s: s
52
-LANGUAGES = (
53
-    ('en-us', gettext_noop('American English')),
54
-)
55
-
56
-SITE_ID = 1
57
-
58
-# If you set this to False, Django will make some optimizations so as not
59
-# to load the internationalization machinery.
60
-USE_I18N = True
61
-
62
-# If you set this to False, Django will not format dates, numbers and
63
-# calendars according to the current locale
64
-USE_L10N = True
65
-
66
-# Absolute path to the directory that holds media.
67
-# Example: "/home/media/media.lawrence.com/"
68
-MEDIA_ROOT = location("public/media")
69
-
70
-# URL that handles the media served from MEDIA_ROOT. Make sure to use a
71
-# trailing slash if there is a path component (optional in other cases).
72
-# Examples: "http://media.lawrence.com", "http://example.com/media/"
73
-MEDIA_URL = '/media/'
74
-
75
-# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
76
-# trailing slash.
77
-# Examples: "http://foo.com/media/", "/media/".
78
-#ADMIN_MEDIA_PREFIX = '/media/admin/'
79
-
80
-STATIC_URL = '/static/'
81
-STATIC_ROOT = location('public/static')
82
-STATICFILES_DIRS = (
83
-    location('static/'),
84
-)
85
-STATICFILES_FINDERS = (
86
-    'django.contrib.staticfiles.finders.FileSystemFinder',
87
-    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
88
-)
89
-
90
-# Make this unique, and don't share it with anybody.
91
-SECRET_KEY = '$)a6n&o80u!6y5t-+jrd3)3!%vh&shg$wqpjpxc!ar&p#!)n1a'
92
-
93
-# List of callables that know how to import templates from various sources.
94
-TEMPLATE_LOADERS = (
95
-    'django.template.loaders.filesystem.Loader',
96
-    'django.template.loaders.app_directories.Loader',
97
-    # needed by django-treebeard for admin (and potentially other libs)
98
-    'django.template.loaders.eggs.Loader',
99
-)
100
-
101
-TEMPLATE_CONTEXT_PROCESSORS = (
102
-    "django.contrib.auth.context_processors.auth",
103
-    "django.core.context_processors.request",
104
-    "django.core.context_processors.debug",
105
-    "django.core.context_processors.i18n",
106
-    "django.core.context_processors.media",
107
-    "django.core.context_processors.static",
108
-    "django.contrib.messages.context_processors.messages",
109
-    # Oscar specific
110
-    'oscar.apps.search.context_processors.search_form',
111
-    'oscar.apps.promotions.context_processors.promotions',
112
-    'oscar.apps.checkout.context_processors.checkout',
113
-    'oscar.core.context_processors.metadata',
114
-    'oscar.apps.customer.notifications.context_processors.notifications',
115
-)
116
-
117
-MIDDLEWARE_CLASSES = (
118
-    'debug_toolbar.middleware.DebugToolbarMiddleware',
119
-    'django.contrib.sessions.middleware.SessionMiddleware',
120
-    'django.middleware.csrf.CsrfViewMiddleware',
121
-    'django.contrib.auth.middleware.AuthenticationMiddleware',
122
-    'django.contrib.messages.middleware.MessageMiddleware',
123
-    'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
124
-    # Allow languages to be selected
125
-    'django.middleware.locale.LocaleMiddleware',
126
-    'django.middleware.common.CommonMiddleware',
127
-    # Ensure a valid basket is added to the request instance for every request
128
-    'oscar.apps.basket.middleware.BasketMiddleware',
129
-    # Enable the ProfileMiddleware, then add ?cprofile to any
130
-    # URL path to print out profile details
131
-    # 'oscar.profiling.middleware.ProfileMiddleware',
132
-)
133
-
134
-ROOT_URLCONF = 'urls'
135
-
136
-# Add another path to Oscar's templates.  This allows templates to be
137
-# customised easily.
138
-from oscar import OSCAR_MAIN_TEMPLATE_DIR
139
-TEMPLATE_DIRS = (
140
-    location('templates'),
141
-    OSCAR_MAIN_TEMPLATE_DIR,
142
-)
143
-
144
-# A sample logging configuration. The only tangible logging
145
-# performed by this configuration is to send an email to
146
-# the site admins on every HTTP 500 error.
147
-# See http://docs.djangoproject.com/en/dev/topics/logging for
148
-# more details on how to customize your logging configuration.
149
-LOGGING = {
150
-    'version': 1,
151
-    'disable_existing_loggers': True,
152
-    'formatters': {
153
-        'verbose': {
154
-            'format': '%(levelname)s %(asctime)s %(module)s %(message)s',
155
-        },
156
-        'simple': {
157
-            'format': '[%(asctime)s] %(message)s'
158
-        },
159
-    },
160
-    'filters': {
161
-        'require_debug_false': {
162
-            '()': 'django.utils.log.RequireDebugFalse'
163
-        }
164
-    },
165
-    'handlers': {
166
-        'null': {
167
-            'level': 'DEBUG',
168
-            'class': 'logging.NullHandler',
169
-        },
170
-        'console': {
171
-            'level': 'DEBUG',
172
-            'class': 'logging.StreamHandler',
173
-            'formatter': 'verbose'
174
-        },
175
-        'checkout_file': {
176
-            'level': 'INFO',
177
-            'class': 'oscar.core.logging.handlers.EnvFileHandler',
178
-            'filename': 'checkout.log',
179
-            'formatter': 'verbose'
180
-        },
181
-        'gateway_file': {
182
-            'level': 'INFO',
183
-            'class': 'oscar.core.logging.handlers.EnvFileHandler',
184
-            'filename': 'gateway.log',
185
-            'formatter': 'simple'
186
-        },
187
-        'error_file': {
188
-            'level': 'INFO',
189
-            'class': 'oscar.core.logging.handlers.EnvFileHandler',
190
-            'filename': 'errors.log',
191
-            'formatter': 'verbose'
192
-        },
193
-        'sorl_file': {
194
-            'level': 'INFO',
195
-            'class': 'oscar.core.logging.handlers.EnvFileHandler',
196
-            'filename': 'sorl.log',
197
-            'formatter': 'verbose'
198
-        },
199
-        'mail_admins': {
200
-            'level': 'ERROR',
201
-            'class': 'django.utils.log.AdminEmailHandler',
202
-            'filters': ['require_debug_false'],
203
-        },
204
-    },
205
-    'loggers': {
206
-        # Django loggers
207
-        'django': {
208
-            'handlers': ['null'],
209
-            'propagate': True,
210
-            'level': 'INFO',
211
-        },
212
-        'django.request': {
213
-            'handlers': ['mail_admins', 'error_file'],
214
-            'level': 'ERROR',
215
-            'propagate': False,
216
-        },
217
-        'django.db.backends': {
218
-            'handlers': ['null'],
219
-            'propagate': False,
220
-            'level': 'DEBUG',
221
-        },
222
-        # Oscar core loggers
223
-        'oscar.checkout': {
224
-            'handlers': ['console', 'checkout_file'],
225
-            'propagate': False,
226
-            'level': 'INFO',
227
-        },
228
-        'oscar.catalogue.import': {
229
-            'handlers': ['console'],
230
-            'propagate': False,
231
-            'level': 'INFO',
232
-        },
233
-        'oscar.alerts': {
234
-            'handlers': ['null'],
235
-            'propagate': False,
236
-            'level': 'INFO',
237
-        },
238
-        # Sandbox logging
239
-        'gateway': {
240
-            'handlers': ['gateway_file'],
241
-            'propagate': True,
242
-            'level': 'INFO',
243
-        },
244
-        # Third party
245
-        'sorl.thumbnail': {
246
-            'handlers': ['sorl_file'],
247
-            'propagate': True,
248
-            'level': 'INFO',
249
-        },
250
-        # Suppress output of this debug toolbar panel
251
-        'template_timings_panel': {
252
-            'handlers': ['null'],
253
-            'level': 'DEBUG',
254
-            'propagate': False,
255
-        }
256
-    }
257
-}
258
-
259
-
260
-INSTALLED_APPS = [
261
-    'django.contrib.auth',
262
-    'django.contrib.contenttypes',
263
-    'django.contrib.sessions',
264
-    'django.contrib.sites',
265
-    'django.contrib.messages',
266
-    'django.contrib.admin',
267
-    'django.contrib.flatpages',
268
-    'django.contrib.staticfiles',
269
-    'django.contrib.sitemaps',
270
-    'django_extensions',
271
-    # Debug toolbar + extensions
272
-    'debug_toolbar',
273
-    'template_timings_panel',
274
-    'widget_tweaks',
275
-]
276
-from oscar import get_core_apps
277
-INSTALLED_APPS = INSTALLED_APPS + get_core_apps(
278
-    ['apps.partner', 'apps.checkout', 'apps.shipping'])
279
-
280
-# Add Oscar's custom auth backend so users can sign in using their email
281
-# address.
282
-AUTHENTICATION_BACKENDS = (
283
-    'oscar.apps.customer.auth_backends.EmailBackend',
284
-    'django.contrib.auth.backends.ModelBackend',
285
-)
286
-
287
-LOGIN_REDIRECT_URL = '/'
288
-APPEND_SLASH = True
289
-
290
-# Haystack settings
291
-HAYSTACK_CONNECTIONS = {
292
-    'default': {
293
-        'ENGINE': 'haystack.backends.whoosh_backend.WhooshEngine',
294
-        'PATH': location('whoosh_index'),
295
-    },
296
-}
297
-
298
-# =============
299
-# Debug Toolbar
300
-# =============
301
-
302
-# Implicit setup can often lead to problems with circular imports, so we
303
-# explicitly wire up the toolbar
304
-DEBUG_TOOLBAR_PATCH_SETTINGS = False
305
-DEBUG_TOOLBAR_PANELS = [
306
-    'debug_toolbar.panels.versions.VersionsPanel',
307
-    'debug_toolbar.panels.timer.TimerPanel',
308
-    'debug_toolbar.panels.settings.SettingsPanel',
309
-    'debug_toolbar.panels.headers.HeadersPanel',
310
-    'debug_toolbar.panels.request.RequestPanel',
311
-    'debug_toolbar.panels.sql.SQLPanel',
312
-    'debug_toolbar.panels.staticfiles.StaticFilesPanel',
313
-    'debug_toolbar.panels.templates.TemplatesPanel',
314
-    'template_timings_panel.panels.TemplateTimings.TemplateTimings',
315
-    'debug_toolbar.panels.cache.CachePanel',
316
-    'debug_toolbar.panels.signals.SignalsPanel',
317
-    'debug_toolbar.panels.logging.LoggingPanel',
318
-    'debug_toolbar.panels.redirects.RedirectsPanel',
319
-]
320
-INTERNAL_IPS = ['127.0.0.1', '::1']
321
-
322
-# ==============
323
-# Oscar settings
324
-# ==============
325
-
326
-from oscar.defaults import *  # noqa
327
-
328
-# Meta
329
-# ====
330
-
331
-OSCAR_SHOP_TAGLINE = 'US Sandbox'
332
-OSCAR_DEFAULT_CURRENCY = 'USD'
333
-OSCAR_ALLOW_ANON_CHECKOUT = True
334
-
335
-# LESS/CSS
336
-# ========
337
-
338
-# We default to using CSS files, rather than the LESS files that generate them.
339
-# If you want to develop Oscar's CSS, then set USE_LESS=True to enable the
340
-# on-the-fly less processor.
341
-USE_LESS = False
342
-
343
-# Logging
344
-# =======
345
-
346
-LOG_ROOT = location('logs')
347
-# Ensure log root exists
348
-if not os.path.exists(LOG_ROOT):
349
-    os.mkdir(LOG_ROOT)
350
-
351
-# Sorl
352
-# ====
353
-
354
-THUMBNAIL_DEBUG = True
355
-THUMBNAIL_KEY_PREFIX = 'oscar-us-sandbox'
356
-
357
-SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
358
-
359
-TEST_RUNNER = 'django.test.runner.DiscoverRunner'
360
-
361
-# Try and import local settings which can be used to override any of the above.
362
-try:
363
-    from settings_local import *  # noqa
364
-except ImportError:
365
-    pass

+ 0
- 0
sites/us/static/.gitignore Vedi File


+ 0
- 31
sites/us/urls.py Vedi File

@@ -1,31 +0,0 @@
1
-from django.conf.urls import include, url
2
-from django.conf import settings
3
-from django.conf.urls.i18n import i18n_patterns
4
-from django.contrib import admin
5
-from django.conf.urls.static import static
6
-
7
-from oscar.app import application
8
-
9
-
10
-admin.autodiscover()
11
-
12
-urlpatterns = [
13
-    # Include admin as convenience. It's unsupported and only included
14
-    # for developers.
15
-    url(r'^admin/', include(admin.site.urls)),
16
-    # i18n URLS need to live outside of i18n_patterns scope of Oscar.
17
-    url(r'^i18n/', include('django.conf.urls.i18n')),
18
-]
19
-
20
-# Prefix Oscar URLs with language codes
21
-urlpatterns += i18n_patterns('', url(r'', include(application.urls)))
22
-
23
-if settings.DEBUG:
24
-    import debug_toolbar
25
-
26
-    # Server statics and uploaded media
27
-    urlpatterns += static(settings.MEDIA_URL,
28
-                          document_root=settings.MEDIA_ROOT)
29
-    urlpatterns += [
30
-        url(r'^__debug__/', include(debug_toolbar.urls)),
31
-    ]

Loading…
Annulla
Salva