Closed jrief closed 8 years ago
Great job, Jacob. Thanks for your hard work and for sharing this. The documentation is very well written and understandable. However I was not able to deploy a demo shop based on this documentation. I have the feeling this might be due to a repository mixup in addition to a version mismatch.
For example, here you state that you released "0.9.0rc1" and reference the https://github.com/awesto/django-shop repository. However that repository does not appear to have a "0.9.0rc1" tag whereas the https://github.com/jrief/django-shop/ has.
Based on the documentation located at https://github.com/jrief/django-shop/ I run the below sequence of commands, which resulted in the error: ImportError: No module named 'money_maker'
Here are the commands executed on Ubuntu 14.04.3:
$ git clone https://github.com/jrief/django-shop
$ git checkout tags/0.9.0rc1
$ virtualenv shoptutorial
$ source shoptutorial/bin/activate
(shoptutorial)$ cd django-shop
(shoptutorial)$ pip install -r requirements/demo.txt
(shoptutorial)$ pip install -e .
(shoptutorial)$ sudo npm install
(shoptutorial)$ bower install
(shoptutorial)$ wget http://downloads.awesto.com/django-shop-workdir.tar.gz
(shoptutorial)$ tar zxf django-shop-workdir.tar.gz
(shoptutorial)$ cd example
(shoptutorial)$ ./manage.py migrate
While running ./manage.py migrate
the below error is thrown:
(shoptutorial) vagrant@vagrant:~/django-shop/example$ ./manage.py migrate
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/core/management/__init__.py", line 328, in execute
django.setup()
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/home/vagrant/shoptutorial/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/vagrant/django-shop/example/myshop/models/__init__.py", line 7, in <module>
from shop.models.defaults.cart import Cart
File "/home/vagrant/django-shop/shop/models/defaults/cart.py", line 5, in <module>
from shop.models.cart import BaseCart
File "/home/vagrant/django-shop/shop/models/cart.py", line 12, in <module>
from shop.money import Money
File "/home/vagrant/django-shop/shop/money/__init__.py", line 2, in <module>
from money_maker import MoneyMaker, AbstractMoney
ImportError: No module named 'money_maker'
Thanks for reporting. Deploying such a big project the first time, is always a hassle. Can we chat tomorrow and try to find a fix?
Yes, let's chat tomorrow to find a fix.
I had a closer look this morning and I was not able to locate a money_maker module in the django-shop
repository and neither in the Internet. The django-shop/shop/money/__init__.py
contains the from money_maker import MoneyMaker, AbstractMoney
reference, which fails due to the money_maker
module missing on the system.
Since I could not find a money_maker
module in the Internet, am I right to assume that the money_maker
module is supposed to be shipped as part of the django-shop
?
Thank you for the test and the report, Hagen.
The money_maker
module lives in shop/money
: https://github.com/awesto/django-shop/blob/master/shop/money/money_maker.py
But maybe there is a packaging or import path problem. I can have a look at the problem this evening, but maybe Jacob will beat me to it :)
Ups, how could I miss this. I can confirm the money_maker.py
is there but Python cannot find it.
I probably missed a dot, please try with
from .money_maker import MoneyMaker, AbstractMoney
presumably I have the curdir in my Python path and you don't
Yes, with from .money_maker import MoneyMaker, AbstractMoney
the money_maker
module was found!
However it then could not locate from iso4217 import CURRENCIES
contained in the money_maker.py
. I then edited the money_maker.py
to changed it to from .iso4217 import CURRENCIES
but then I got the below error:
(shoptutorial) vagrant@vagrant:~/django-shop/example$ ./manage.py migrate
/home/vagrant/django-shop/shop/models/order.py:95: RemovedInDjango19Warning: import_by_path() has been deprecated. Use import_string() instead.
bases = tuple(import_by_path(mc) for mc in shop_settings.ORDER_WORKFLOWS) + bases
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute()
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/core/management/__init__.py", line 328, in execute
django.setup()
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/home/vagrant/shoptutorial/lib/python3.4/site-packages/django/apps/config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "/home/vagrant/shoptutorial/lib/python3.4/importlib/__init__.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/vagrant/django-shop/example/myshop/models/__init__.py", line 9, in <module>
from shop.models.defaults.order import Order
File "/home/vagrant/django-shop/shop/models/defaults/order.py", line 9, in <module>
class Order(order.BaseOrder):
File "/home/vagrant/django-shop/shop/models/order.py", line 105, in __new__
attrs['_auto_transitions'].update(cls.add_to_auto_transitions(b))
File "/home/vagrant/django-shop/shop/models/order.py", line 112, in add_to_auto_transitions
for name, method in base.__dict__.iteritems():
AttributeError: 'mappingproxy' object has no attribute 'iteritems'
We need better tests/CI to catch such errors early :) I will take a look ASAP.
I can confirm that commit https://github.com/jrief/django-shop/commit/12e246b356dbc1bc5bbdc8f056e3cb109c617997 has resolved it.
The subsequently encountered issue (i.e. AttributeError: 'mappingproxy' object has no attribute 'iteritems'
) is due to Python version incompatibility and has been filed with issue https://github.com/jrief/django-shop/issues/50.
Whoever intends to build a webshop in the near future, please check this out: https://github.com/awesto/django-shop
For me its specially important to ask for help about a topic no interpreter can test for me:
Is the documentation understandable?
Cheers, Jacob