I finally installed django oscar and I can run the server, but I don't know how to start building my page. Moreover, I don't know what url would be my home or index, I tried to enter to http://127.0.0.1:8000 and I got the following error:
Failed lookup for key [basket] in "<WSGIRequest: GET '/'>"
| Request Method: | GET |
|---|---|
| Request URL: | http://127.0.0.1:8000/ |
| Django Version: | 1.11.12 |
| Exception Type: | VariableDoesNotExist |
| Exception Value: | Failed lookup for key [basket] in "<WSGIRequest: GET '/'>" |
| Exception Location: | /home/scripts/oscar/shop/lib/python3.6/site-packages/django/template/base.py in _resolve_lookup, line 903 |
| Python Executable: | /home/scripts/oscar/shop/bin/python |
| Python Version: | 3.6.3 |
In template /home/scripts/oscar/shop/lib/python3.6/site-packages/oscar/templates/oscar/partials/mini_basket.html, error at line 9
| 1 | {% load currency_filters %} |
|---|---|
| 2 | {% load i18n %} |
| 3 |
|
| 4 | <div class="basket-mini pull-right hidden-xs"> |
| 5 | <strong>{% trans "Basket total:" %}</strong> |
| 6 | {% if request.basket.is_tax_known %} |
| 7 | {{ request.basket.total_incl_tax|currency:request.basket.currency }} |
| 8 | {% else %} |
| 9 | {{ request.basket.total_excl_tax|currency:request.basket.currency }} |
| 10 | {% endif %} |
| 11 |
|
| 12 | <span class="btn-group"> |
| 13 | <a class="btn btn-default" href="{% url 'basket:summary' %}">{% trans "View basket" %}</a> |
| 14 | <button class="btn btn-default dropdown-toggle" data-toggle="dropdown"> |
| 15 | <span class="caret"></span> |
| 16 | </button> |
| 17 | <ul class="dropdown-menu pull-right"> |
| 18 | <li>{% include "basket/partials/basket_quick.html" %}</li> |
| 19 | </ul> |
When I made a new category, I tried to enter to the urld and got the following error:
| Request Method: | GET |
|---|---|
| Request URL: | http://127.0.0.1:8000/test/pruebal/ |
Using the URLconf defined in frobshop.urls,
Django tried these URL patterns, in this order:
The current path, test/pruebal/, didn't match any of these.
Next, my urls.py and settings.py to understand my problem:
My urls.py:
from django.conf.urls import include, url
from django.contrib import admin
from oscar.app import application
urlpatterns = [
url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^admin/', include(admin.site.urls)),
url(r'', include(application.urls)),
]
My settings.py
import os
from oscar.defaults import *
from oscar import OSCAR_MAIN_TEMPLATE_DIR
from oscar import get_core_apps
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'u4qr6u*af63b3t#+0dkxar@cx4ok8dx4wu4&o_p@$!8nlh8mdg'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.flatpages',
'compressor',
'widget_tweaks',
'django.contrib.sites',
] + get_core_apps()
SITE_ID = 1
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'frobshop.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
OSCAR_MAIN_TEMPLATE_DIR
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.i18n',
'django.contrib.messages.context_processors.messages',
'oscar.apps.search.context_processors.search_form',
'oscar.apps.promotions.context_processors.promotions',
'oscar.apps.checkout.context_processors.checkout',
'oscar.apps.customer.notifications.context_processors.notifications',
'oscar.core.context_processors.metadata',
],
},
},
]
WSGI_APPLICATION = 'frobshop.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'db.sqlite3',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
'ATOMIC_REQUESTS': True,
}
}
# Password validation
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
AUTHENTICATION_BACKENDS = (
'oscar.apps.customer.auth_backends.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
)
OSCAR_INITIAL_ORDER_STATUS = 'Pending'
OSCAR_INITIAL_LINE_STATUS = 'Pending'
OSCAR_ORDER_STATUS_PIPELINE = {
'Pending': ('Being processed', 'Cancelled',),
'Being processed': ('Processed', 'Cancelled',),
'Cancelled': (),
}
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
'URL': 'http://127.0.0.1:8000/solr/',
'INCLUDE_SPELLING': True,
},
}
# Internationalization
# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_ROOT = 'static'
STATIC_URL = '/static/'
MEDIA_ROOT = 'media'
MEDIA_URL = '/media/'
If do you need more information please ask me.
'oscar.apps.basket.middleware.BasketMiddleware',
--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/9e093d7d-be1d-458d-95a1-2e2d3f4de32a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
The Django admin should work if you follow the URL config outlined here: https://django-oscar.readthedocs.io/en/releases-1.6/internals/getting_started.html#urlsOscar does not in any way modify the templates of Django's admin, so my best guess is that you just haven't configured the admin URLs correctly.
--
https://github.com/django-oscar/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-oscar.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/5f016e03-7afe-4ccf-99fe-2aa542c1a2b9%40googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/django-oscar/0c90593a-8cac-4328-a416-40a8d54014c4%40googlegroups.com.