Error in Ecommerce in Edunext Ecommerce Plugin

Hi All,

I want to install Edunext Ecommerce extension into my code I wanted to use Payu as Payment gateway I am following this tutorial please guide me I am following this tutorials

I am using Nutmeg with Tutor

tutor config save
–set ‘ECOMMERCE_EXTRA_PIP_REQUIREMENTS=[“git+https://github.com/eduNEXT/ecommerce-extensions”]’

tutor images build ecommerce
-a ECOMMERCE_REPOSITORY=https://github.com/eduNEXT/edunext-ecommerce
-a ECOMMERCE_VERSION=master

ecommerce.xxxx.in is not working it is showing server internal error

File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py”, line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1054, “Unknown column ‘partner_partner.enable_sailthru’ in ‘field list’”)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “./manage.py”, line 11, in
execute_from_command_line(sys.argv)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/**init**.py”, line 381, in execute_from_command_line
utility.execute()
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/**init**.py”, line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 323, in run_from_argv
self.execute(*args, **cmd_options)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 364, in execute
output = self.handle(*args, **options)
File “/openedx/ecommerce/ecommerce/core/management/commands/create_or_update_site.py”, line 199, in handle
partner, partner_created = Partner.objects.get_or_create(code=partner_code)
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/manager.py”, line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py”, line 538, in get_or_create
return self.get(**kwargs), False
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py”, line 402, in get
num = len(clone)
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py”, line 256, in **len**
self._fetch_all()
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py”, line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/query.py”, line 55, in **iter**
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/openedx/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py”, line 1142, in execute_sql
cursor.execute(sql, params)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/openedx/venv/lib/python3.8/site-packages/django/db/utils.py”, line 89, in **exit**
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/openedx/venv/lib/python3.8/site-packages/django/db/backends/mysql/base.py”, line 71, in execute
return self.cursor.execute(query, args)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 209, in execute
res = self._query(query)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/cursors.py”, line 315, in _query
db.query(q)
File “/openedx/venv/lib/python3.8/site-packages/MySQLdb/connections.py”, line 239, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1054, “Unknown column ‘partner_partner.enable_sailthru’ in ‘field list’”)
Error: Command failed with status 1: docker-compose -f /home/manoj/.local/share/tutor/env/local/docker-compose.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local -f /home/manoj/.local/share/tutor/env/local/docker-compose.jobs.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.jobs.tmp.yml run --rm ecommerce-job sh -e -c ./manage.py migrate --noinput
./manage.py oscar_populate_countries --initial-only

Hello @manojkumarhr, I’m happy to learn that some of what we have done in the ecommerce extensions repo might be of use to someone in the community.

We wrote the code in that repository to support a very particular project and this project has not yet been migrated to nutmeg, so it is very likely that the code in the master branch of that repo will not work until several changes have been made. However the particulars of the error you are getting don’t seem to me to be originating at the edunext-extensions code, but more like regular ecommerce.

Since the error is happening during the command

oscar_populate_countries

I think it should be possible to run that without ecommerce-extensions and then you can enable ecommerce-extensions later once the command has been run. This should isolate the cause of the issue.

1 Like

Thank you very much for your nice words you have contributed to much to openedx Community i will be in your debt for my life time can you please guide me how i can add these 2 line and where we will find INSTALLED_APPS in setting or how we can add these setting please guide me

INSTALLED_APPS = (

‘ecommerce_extensions.apps.EcommerceExtensionsConfig’,
‘ecommerce_extensions.tenant.apps.TenantConfig’,
)

thank you very much for your contribution for this OpenEDX community

As I said before, this is done for a very specific project and for that, we use a customized fork of ecommerce where we add the changes.

You can see where we add them here: edunext-ecommerce/base.py at master · eduNEXT/edunext-ecommerce · GitHub

However I believe you must be very cautious and understand what you are missing if you create a fork of the code. It is very easy to get stuck in it.

Hi @felipemontoya ,

I am facing this issue after adding details in base.py

Apps specific to this project go here.

LOCAL_APPS = [
‘ecommerce.core’,
‘ecommerce.coupons’,
‘ecommerce.courses’,
‘ecommerce.invoice’,
‘ecommerce.bff’,
‘ecommerce.programs’,
‘ecommerce.referrals’,
‘ecommerce.theming’,
‘ecommerce.sailthru’,
‘ecommerce.enterprise’,
‘ecommerce.management’,
‘ecommerce_extensions.apps.EcommerceExtensionsConfig’,
‘ecommerce_extensions.tenant.apps.TenantConfig’,
]

See: Settings | Django documentation | Django

INSTALLED_APPS = DJANGO_APPS + LOCAL_APPS + OSCAR_APPS

Starting tutor_local_mysql_1 … done
Traceback (most recent call last):
File “./manage.py”, line 11, in
execute_from_command_line(sys.argv)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/init.py”, line 419, in execute_from_command_line
utility.execute()
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/init.py”, line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 354, in run_from_argv
self.execute(*args, **cmd_options)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 398, in execute
output = self.handle(*args, **options)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 89, in wrapped
res = handle_func(*args, **kwargs)
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/commands/migrate.py”, line 75, in handle
self.check(databases=[database])
File “/openedx/venv/lib/python3.8/site-packages/django/core/management/base.py”, line 419, in check
all_issues = checks.run_checks(
File “/openedx/venv/lib/python3.8/site-packages/django/core/checks/registry.py”, line 76, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File “/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py”, line 13, in check_url_config
return check_resolver(resolver)
File “/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py”, line 23, in check_resolver
return check_method()
File “/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 416, in check
for pattern in self.url_patterns:
File “/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py”, line 48, in get
res = instance.dict[self.name] = self.func(instance)
File “/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 602, in url_patterns
patterns = getattr(self.urlconf_module, “urlpatterns”, self.urlconf_module)
File “/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py”, line 48, in get
res = instance.dict[self.name] = self.func(instance)
File “/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py”, line 595, in urlconf_module
return import_module(self.urlconf_name)
File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1014, in _gcd_import
File “”, line 991, in _find_and_load
File “”, line 975, in _find_and_load_unlocked
File “”, line 671, in _load_unlocked
File “”, line 848, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/openedx/ecommerce/ecommerce/urls.py”, line 23, in
from ecommerce.extensions.urls import urlpatterns as extensions_patterns
File “/openedx/ecommerce/ecommerce/extensions/urls.py”, line 11, in
url(r’^payment/’, include(payment.urls[0])),
File “/openedx/venv/lib/python3.8/site-packages/oscar/core/application.py”, line 136, in urls
return self.get_urls(), self.label, self.namespace
File “/openedx/ecommerce/ecommerce/extensions/payment/apps.py”, line 17, in get_urls
from ecommerce.extensions.payment.urls import urlpatterns # pylint: disable=import-outside-toplevel
File “/openedx/ecommerce/ecommerce/extensions/payment/urls.py”, line 5, in
from ecommerce_extensions.urls import urlpatterns as url_extensions
File “/openedx/venv/lib/python3.8/site-packages/ecommerce_extensions/urls.py”, line 7, in
from ecommerce_extensions.payment import urls
File “/openedx/venv/lib/python3.8/site-packages/ecommerce_extensions/payment/urls.py”, line 4, in
from ecommerce_extensions.payment.views import edupay, fomopay, payu
File “/openedx/venv/lib/python3.8/site-packages/ecommerce_extensions/payment/views/edupay.py”, line 19, in
from ecommerce_extensions.payment.processors.edupay import EdnxPaymentProcessor, TransactionPending
File “/openedx/venv/lib/python3.8/site-packages/ecommerce_extensions/payment/processors/edupay.py”, line 18, in
from django.utils.decorators import classproperty
ImportError: cannot import name ‘classproperty’ from ‘django.utils.decorators’ (/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py)
Error: Command failed with status 1: docker-compose -f /home/manoj/.local/share/tutor/env/local/docker-compose.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.prod.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local -f /home/manoj/.local/share/tutor/env/local/docker-compose.jobs.yml -f /home/manoj/.local/share/tutor/env/local/docker-compose.jobs.tmp.yml run --rm ecommerce-job sh -e -c ./manage.py migrate --noinput
./manage.py oscar_populate_countries --initial-only

./manage.py create_or_update_site
–site-id=1
–site-domain=ecommerce.kupg.in:8130
–site-name=dev
–partner-code=dev
–partner-name=“Open edX - development”
–lms-url-root=“http://kupg.in:8000
–client-side-payment-processor=cybersource
–payment-processors=cybersource,paypal
–sso-client-id=“ecommerce-sso-dev”
–sso-client-secret=“eQLg3iik”
–backend-service-client-id=“ecommerce-dev”
–backend-service-client-secret=“2JdAOUHw”
–from-email=contact@kupg.in
–payment-support-email=contact@kupg.in
–payment-support-url=“http://kupg.in:8000/support
–discovery_api_url=http://discovery.kupg.in:8381/api/v1/
–enable-microfrontend-for-basket-page=true
–payment-microfrontend-url=“http://apps.kupg.in:1998/payment

Production site

./manage.py create_or_update_site
–site-id=2
–site-domain=ecommerce.kupg.in
–site-name=prod
–partner-code=openedx
–partner-name=“Open edX”
–lms-url-root=“https://kupg.in
–lms-public-url-root=“https://kupg.in
–client-side-payment-processor=cybersource
–payment-processors=cybersource,paypal
–sso-client-id=“ecommerce-sso”
–sso-client-secret=“eQLg3iik”
–backend-service-client-id=“ecommerce”
–backend-service-client-secret=“2JdAOUHw”
–from-email=contact@kupg.in
–payment-support-email=contact@kupg.in
–payment-support-url=“Sign in or Register | kupg
–discovery_api_url=https://discovery.kupg.in/api/v1/
–enable-microfrontend-for-basket-page=true
–payment-microfrontend-url=“Payment | edX

Now this looks like an error in the code. I would suggest you remove the file edupay.py. But that might not solve it. As I said at the begining this code is unsuported for nutmeg. It might be months before we attempt to fix it.