我正在尝试使用django-oscar import_oscar_catalogue类的修改版本从CSV导入一堆产品,并在第一次遇到产品(由标题定义)时,创建一个规范的父产品,然后为所有未来遭遇会在该父产品下创建子产品.
这似乎有效,但规范产品不反映子产品的组合库存水平,也不显示该产品的正确属性.它确实将它们正确地列为django仪表板中的变体.
如何使用正确的库存记录以编程方式在产品中创建此子/父关系?
相关代码:
def _create_item(self, upc, title, product_class, other_product_attributes):
product_class, __ \
= ProductClass.objects.get_or_create(name=product_class)
try:
parent = Product.objects.get(title=title)
item = Product()
item.parent = parent
except Product.DoesNotExist:
# Here is where I think it might need to be changed
# Maybe pitem = ParentProduct() or something?
pitem = Product()
pitem.upc = upc
pitem.title = title
pitem.other_product_attributes = other_product_attributes
# Here parent item is saved to db
pitem.save()
# Create item because no parent was found
item = …Run Code Online (Sandbox Code Playgroud) 我想将支付网关与奥斯卡集成.我已经集成了oscar-paypal它工作正常.我应该遵循oscar-paypal并尝试模仿吗? 本文档 没有给出起始信息但不完全?
我需要这个.创建订单,更改购物篮状态,付款,发送电子邮件以及oscar-paypal正在执行的许多其他步骤.
我正在和PyCharm一起开展Django项目.不幸的是,PyCharm无法解析我想在模板中使用的模板标签.
{% load staticfiles %}
Run Code Online (Sandbox Code Playgroud)
该项目通过vagrant在Ubuntu VM中运行.运行配置知道我在VM中使用的virtualenv(远程解释器设置).
我的设置如下:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'django_extensions']
INSTALLED_APPS += get_core_apps(['myapp.dashboard')
STATICFILES_FINDERS = (
'compressor.finders.CompressorFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
STATIC_URL = '/static/'
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
STATICFILES_DIRS = (
os.path.join(BASE_DIR, '../../../../myfolder/static'),
)
Run Code Online (Sandbox Code Playgroud)
我仍然收到警告Unresolved library 'staticfiles'.它也显示了与其他模板标签相同的行为.动态创造是否STATICFILES_DIRS可以成为问题?我该怎么解决这个问题?
嗨,我的Django oscar项目实现了Django oscar.我能够实现我的自定义API,我用它来查看类别并显示它们.现在API的问题是类别的子类别在我的API视图中显示为类别,我希望它们在一个数组中,表明它们是子类别.我的分类代码如下
customapi序列化器类
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('id', 'numchild', 'name', 'description', 'image', 'slug')
Run Code Online (Sandbox Code Playgroud)
查看
class CategoryList(generics.ListAPIView):
queryset = Category.objects.all()
serializer_class = CategorySerializer
class CategoryDetail(generics.RetrieveAPIView):
queryset = Category.objects.all()
serializer_class = CategorySerializer
Run Code Online (Sandbox Code Playgroud)
customapi/urls.py
url(r'^caty/$', CategoryList.as_view(), name='category-list'),
url(r'^caty/(?P<category_slug>[\w-]+(/[\w-]+)*)_(?P<pk>\d+)/$',
CategoryDetail.as_view(), name='category'),
Run Code Online (Sandbox Code Playgroud)
JSON
[
{
"id": 2,
"path": "0001",
"depth": 1,
"numchild": 4,
"name": "Clothes",
"description": "<p>Beautiful Clothes</p>",
"image": null,
"slug": "clothes"
},
{
"id": 8,
"path": "00010001",
"depth": 2,
"numchild": 0,
"name": "c",
"description": "",
"image": null,
"slug": …Run Code Online (Sandbox Code Playgroud) 我正在研究django-oscar项目以创建自定义电子商务应用程序.
当我使用python manage.py runserver命令运行我的项目时,我收到此错误"
from django.contrib.gis.geos import GEOSException, GEOSGeometry, fromstr
ImportError: cannot import name GEOSException"
Run Code Online (Sandbox Code Playgroud)
如何安装GEOS?
嗨,大家好我试图从Django的奥斯卡教程http://django-oscar.readthedocs.org/en/latest/internals/getting_started.html但我得到一个
'staticfiles' is not a valid tag library: Template library staticfiles not found, tried django.templatetags.staticfiles,django.contrib.flatpages.templatetags.staticfiles,compressor.templatetags.staticfiles,oscar.templatetags.staticfiles,haystack.templatetags.staticfiles,treebeard.templatetags.staticfiles,sorl.thumbnail.templatetags.staticfiles
Run Code Online (Sandbox Code Playgroud)
有任何想法吗??
追溯:
Environment:
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.flatpages',
'south',
'compressor',
'oscar',
'oscar.apps.analytics',
'oscar.apps.order',
'oscar.apps.checkout',
'oscar.apps.shipping',
'oscar.apps.catalogue',
'oscar.apps.catalogue.reviews',
'oscar.apps.basket',
'oscar.apps.payment',
'oscar.apps.offer',
'oscar.apps.address',
'oscar.apps.partner',
'oscar.apps.customer',
'oscar.apps.promotions',
'oscar.apps.search',
'oscar.apps.voucher',
'oscar.apps.dashboard',
'oscar.apps.dashboard.reports',
'oscar.apps.dashboard.users',
'oscar.apps.dashboard.orders',
'oscar.apps.dashboard.promotions',
'oscar.apps.dashboard.catalogue',
'oscar.apps.dashboard.offers',
'oscar.apps.dashboard.ranges',
'oscar.apps.dashboard.vouchers',
'oscar.apps.dashboard.communications',
'haystack',
'treebeard',
'sorl.thumbnail']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')
Template …Run Code Online (Sandbox Code Playgroud) 我有兴趣将django-cms用于内容管理,将django oscar用于电子商务.
有人可以给我一些方向,最好是已经成功结合两者的人:
[A]该结构应该是一个基础奥斯卡站点,修改奥斯卡模板以插入必要的占位符以允许cms等...,
要么
[B]结构应该是基础django-cms站点,奥斯卡是由插件等处理的......
我的直觉是它应该是[A],但如果我错了,请纠正我.
任何其他建议将不胜感激,因为网上很少,我写信给奥斯卡的作者没有回应.我知道这个链接,它不涉及实现,只比较兼容性.
我在example.com的网站上部署了django-oscar的示例应用程序沙箱.我想将其移至example.com:8000并在example.com网址上运行另一个项目.我成功完成了第二部分,当你进入example.com时,你可以看到更新的django项目启动并运行,但问题是,第一个django项目是django-oscar的沙箱,不会正确响应.
当您输入example.com:8000时,您会看到当前的调试日志:
no such column: django_content_type.name
Request Method: GET
Request URL: http://example.com:8000/fa/
Django Version: 1.7.8
Exception Type: OperationalError
Exception Value:
no such column: django_content_type.name
Exception Location: /usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in execute, line 485
Python Executable: /usr/bin/python
Python Version: 2.7.3
Python Path:
['/var/www/setak/setakenv/setakmain/django-oscar/sites/sandbox',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
Run Code Online (Sandbox Code Playgroud)
现在我用Google搜索了这个错误,但我没有得到任何有价值的结果.
还有,当我跑
sudo python manage.py migrate
Run Code Online (Sandbox Code Playgroud)
发生以下情况,我也找不到任何正确的解决方案:
Operations to perform:
Synchronize unmigrated apps: reports_dashboard, treebeard, oscar, communications_dashboard, reviews_dashboard, debug_toolbar, widget_tweaks, offers_dashboard, catalogue_dashboard, sitemaps, compressor, …Run Code Online (Sandbox Code Playgroud) 我需要确保Apache Solr与我的django-oscar应用程序一起安装,并且已经使用这些指令和.ebextensions配置文件来自动安装Solr并重建索引.
这是.ebextensions/03_solr.config
container_commands:
01_install_solr:
command: "wget http://archive.apache.org/dist/lucene/solr/4.7.2/solr-4.7.2.tgz &&
tar xzf solr-4.7.2.tgz &&
cd solr-4.7.2.example/solr/collection1 &&
mv conf conf.original &&
ln -s /opt/python/current/app/deploy/solr conf &&
cd ../.. &&
java -jar start.jar"
02_rebuild_index:
command: "python manage.py rebuild_index --noinput"
Run Code Online (Sandbox Code Playgroud)
我需要在此处添加/更新以使solr自动安装
eb deploy
Run Code Online (Sandbox Code Playgroud)
?
更新:将bash更改为单个命令.看起来这个过程正在完成,但在执行java -jar start.jar时,.ebextensions/03_solr.config任务执行了
org.eclipse.jetty.server.AbstractConnector - Started SocketConnector@0.0.0.0:8983
Run Code Online (Sandbox Code Playgroud)
这个过程应该是一个后台进程,因为它正在导致部署挂起,并在不部署新应用程序的情况下超时.根据这篇SO帖子,在部署新的应用程序版本之后开始延迟工作需要一些工作.有什么建议?澄清:
跑过
java -jar start.jar
Run Code Online (Sandbox Code Playgroud)
命令作为EB的非阻塞后台进程?
我正在使用 django-oscar 框架开发一个购物网站,实际上我正在使用他们的沙箱网站。我想在结帐流程中添加付款功能,但问题是,我完全困惑了!
我已阅读此链接:“Oscar 的支付集成文档”
我得到了大局的信息。我还在结账应用程序中阅读了文件views.py,但我有一些在网上找不到的问题。
我的问题是我应该重写或创建哪些方法/类来处理以下过程:
用户请求付款后,我应该向银行发送请求并向他们提供所需的参数(代码中的 pay_request_parameters )
然后,他们会发送一个 ID,确认我的访问权限,然后我应该将该 ID 发布到一个地址并将用户重定向到银行的网页。
用户成功向银行付款后,他们会通过我在第一步中提供的回调网址来通知我。
有了这些信息,我应该验证付款是否成功,如果成功,我应该要求银行结算,然后将钱汇给我。
现在我的代码执行了前两个步骤,但我不知道如何在沙箱中重定向后处理该过程。这是我的代码:
from oscar.apps.checkout import views
from oscar.apps.payment import models
from oscar.apps.payment.exceptions import *
import requests
import datetime
mellat_services_url = 'https://bpm.shaparak.ir/pgwchannel/services/pgw?wsdl'
start_pay_url = 'https://bpm.shaparak.ir/pgwchannel/startpay.mellat'
terminal_id = 'xxx'
username = 'xxx'
password = 'xxx'
# Subclass the core Oscar view so we can customise
class PaymentDetailsView(views.PaymentDetailsView):
def handle_payment(self, order_number, total, **kwargs):
# Talk to payment gateway. If unsuccessful/error, raise a
# PaymentError exception which we …Run Code Online (Sandbox Code Playgroud) django ×10
django-oscar ×10
python ×6
python-2.7 ×2
apache ×1
django-cms ×1
pycharm ×1
solr ×1