【发布时间】:2019-07-09 11:48:49
【问题描述】:
我正在尝试对结帐应用程序中的 mixin.py 文件进行小幅修改(具体来说,尝试注释掉 OrderPlacementMixin 中的行,该行会在成功订单后自动发送电子邮件,如 this stackoverflow post 中所述) .但是,我似乎无法让 oscar 认出我的叉子。我已经按照here 列举的步骤进行操作,但没有运气。
这是我已经完成的步骤
1)在项目根目录下创建custom_apps目录,里面有一个空的__init__.py文件
2) 运行manage.py oscar_fork_app checkout custom_apps - 此命令生成checkout 目录以及多个文件。这是终端输出。我还附上了目录结构的照片
(venv) work@pc:~/MyProjects/oscar2_project/frobshop$ ./manage.py oscar_fork_app checkout custom_apps
Creating package custom_apps/checkout
Creating app config
Creating models.py
Replace the entry 'oscar.apps.checkout.apps.CheckoutConfig' with 'custom_apps.checkout.apps.CheckoutConfig' in INSTALLED_APPS
3) 我在settings.py 中的INSTALLED_APPS 中注释掉了'oscar.apps.checkout',并在INSTALLED_APPS` 列表的末尾插入了'custom_apps.checkout'
4) 我运行python manage.py runserver,我得到了异常oscar.core.exceptions.AppNotFoundError: Couldn't find an Oscar app to import checkout.calculators from。此时,我什至还没有尝试修改任何代码,但是,我的 fork 已经拒绝运行。
如果有人能指出我遗漏的任何步骤,我将不胜感激。我知道可以复制 oscar.apps.checkout 的所有内容,但我想避免这样做。
【问题讨论】:
标签: python django django-oscar