Thanks nin.. - I'll be needing that tip - I can see where you have to set
the tab delimiter in the product_db script.
But I still can't get it - when I export a csv file, in the size and colour
column headings, I get this: <django.utils.functional.__proxy__ object at
0x2c9a190>
And when I import, I get an error that refers to line 101 in product_db.py :
def _product_from_row(row):
product, created = Product.objects.get_or_create(title=row[TITLE])
product.content = row[CONTENT]
product.description = row[DESCRIPTION]
# TODO: set the 2 below from spreadsheet.
product.status = CONTENT_STATUS_PUBLISHED
product.available = True
# TODO: allow arbitrary level/number of categories.
product.available is boolean and product.status is IntegerField, so I've
tried putting '1' and 'True' there.
But what should I put in the column headers ?
Or is this not the problem at all?
On Wednesday, August 6, 2014 6:58:17 AM UTC+10, [email protected] wrote:
>
> Yes the source expects comma delimited but my data contains commas so I
> had to change it to accept tab delimited.
>
> On Tuesday, August 5, 2014 8:16:56 AM UTC-5, Kenneth Bolton wrote:
>>
>> You have got this.
>>
>> According to the source
>> <https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/management/commands/product_db.py#L146>,
>>
>> the file needs to be comma-delimited, not tab-delimited.
>>
>> On Tue, Aug 5, 2014 at 8:56 AM, Stevo <[email protected]> wrote:
>>
>>>
>>> I ran that product_db command with --export and it coughed up a .csv
>>> file full of magic ponies. I tried to make my upload file the same, but
>>> when I ran the command with --import, I got this:
>>>
>>> (mezzcart)hobbo5424@hobbo5424-Inspiron-N4050 ~/mezzcart/proj1 $ python
>>> manage.py product_db --import produpload3.csv
>>> /home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/mezzanine/utils/conf.py:92:
>>>
>>> UserWarning: mezzanine.pages.context_processors.page is required in the
>>> TEMPLATE_CONTEXT_PROCESSORS setting. Adding it now, but you should update
>>> settings.py to explicitly include it.
>>> "explicitly include it." % cp)
>>> Importing ..
>>> {'Title\tContent\tDescription\tCategory\tSub-Category\tSKU\tImage\tNumber
>>> in Stock\tUnit Price\tSale Price\tSale Start Date\tSale Start Time\tSale
>>> End Date\tSale End Time': 'Old Boot\t<p>This brown leather foot covering
>>> will keep your feet warm</p>\t<p>Light tan in colour and buffed to
>>> perfection</p>\tShop\t\t13\tproduct/red.png\t2\t50\t5\t\t\t\t'}
>>> Traceback (most recent call last):
>>> File "manage.py", line 29, in <module>
>>> execute_from_command_line(sys.argv)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>
>>> line 399, in execute_from_command_line
>>> utility.execute()
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>>
>>> line 392, in execute
>>> self.fetch_command(subcommand).run_from_argv(self.argv)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/django/core/management/base.py",
>>>
>>> line 242, in run_from_argv
>>> self.execute(*args, **options.__dict__)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/django/core/management/base.py",
>>>
>>> line 285, in execute
>>> output = self.handle(*args, **options)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/cartridge/shop/management/commands/product_db.py",
>>>
>>> line 94, in handle
>>> import_products(csv_file)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/cartridge/shop/management/commands/product_db.py",
>>>
>>> line 149, in import_products
>>> product = _product_from_row(row)
>>> File
>>> "/home/hobbo5424/mezzcart/local/lib/python2.7/site-packages/cartridge/shop/management/commands/product_db.py",
>>>
>>> line 100, in _product_from_row
>>> product, created = Product.objects.get_or_create(title=row[TITLE])
>>> KeyError: u'Title'
>>>
>>> This is the same error I got when I tried to import it the first time
>>> before I did the export, so I don't think it's a fault in the text file. I
>>> keep reading nin's answer, but there's no customisation and I made the
>>> column headers the same as those from the export output.
>>>
>>> So what's my problem? And what's the limit on dumb questions? C'mon we
>>> can do this!!!!
>>>
>>> Best Regards,
>>>
>>>
>>>
>>> On Tuesday, August 5, 2014 1:25:53 PM UTC+10, Stevo wrote:
>>>
>>>> Ahhh now I get it - thank you! And thanks for those tute links -
>>>> exactly what I need right now. The help this group has given is awesome.
>>>> Regards to all!
>>>>
>>>> On Tuesday, August 5, 2014 1:53:24 AM UTC+10, [email protected] wrote:
>>>>
>>>>> Stevo,
>>>>>
>>>>> From your mezzanine project directory,
>>>>>
>>>>> ./manage.py product_db --import <datafile>
>>>>>
>>>>> where datafile is a tab delimited text file. If you have customized
>>>>> the product table, you need to do same to product_db and make sure the
>>>>> column names the same as the text file with your datafile...
>>>>>
>>>>> It's best to test it inside virtualenv.
>>>>>
>>>>> On Monday, August 4, 2014 7:43:56 AM UTC-5, Stevo wrote:
>>>>>>
>>>>>> Hi Ken, I think you got that right, coz when I tried again my error
>>>>>> was different:
>>>>>>
>>>>>> File "/home/hobbo5424/mezzcart/local/lib/python2.7/site-
>>>>>> packages/django/conf/__init__.py", line 47, in _setup
>>>>>> % (desc, ENVIRONMENT_VARIABLE))
>>>>>> django.core.exceptions.ImproperlyConfigured: Requested setting
>>>>>> INSTALLED_APPS, but settings are not configured. You must either define
>>>>>> the
>>>>>> environment variable DJANGO_SETTINGS_MODULE or call settings.configure()
>>>>>> before accessing settings.
>>>>>>
>>>>>> If you could suggest a way to set it up properly, I'd be happy to
>>>>>> start over again - I haven't done any real work on the site yet. At this
>>>>>> stage, I just need to prove it can be done (by me at least).
>>>>>> What is supposed to happen when you run product_db.py? I can't see
>>>>>> where or how it would find a .csv file to upload.
>>>>>> Martin suggested "playing around with Cartridge api within a shell to
>>>>>> play around with the product database." I don't know how to do that
>>>>>> either.
>>>>>> Sorry to ask dumb questions, but Ryan said to keep trying and not
>>>>>> give up.
>>>>>> Cheers and thanks!
>>>>>>
>>>>>>
>>>>>> On Sunday, August 3, 2014 10:20:41 PM UTC+10, Kenneth Bolton wrote:
>>>>>>>
>>>>>>> sounds like you are running the script possibly with the wrong
>>>>>>> python, e.g. without your virtualenv activated.
>>>>>>>
>>>>>>> ken
>>>>>>>
>>>>>>>
>>>>>>> On Sun, Aug 3, 2014 at 6:57 AM, Stevo <[email protected]> wrote:
>>>>>>>
>>>>>>>> Thanks Ryan! - I tried to run the script from:
>>>>>>>> myproject/lib/python2.7/site-packages/cartridge/shop/
>>>>>>>> management/commands/product_db.py
>>>>>>>> but got an ImportError: No module name mezzanine.conf
>>>>>>>> I couldn't find anything in the Cartridge docs or in Mezzanine. So
>>>>>>>> is it in Django documentation?
>>>>>>>> Please, could you give me a couple more hints and/or tell me where
>>>>>>>> to go for more info on what to do?
>>>>>>>> I passed my python MOOC so I've got plenty of time on my hands now.
>>>>>>>> Haha!
>>>>>>>> Regards, Stevo
>>>>>>>>
>>>>>>>>
>>>>>>>> On Saturday, August 2, 2014 12:54:26 AM UTC+10, Ryan Sadwick wrote:
>>>>>>>>>
>>>>>>>>> I recently made a script that calls Amazon's product api and
>>>>>>>>> inserts into cartridge for an affiliate mash up site. I based the
>>>>>>>>> script
>>>>>>>>> off of what Stephen linked earlier and the mezz/cartirdge chart:
>>>>>>>>> http://cartridge.jupo.org/_images/graph.png. The most products
>>>>>>>>> I've inserted at one time has been around 100 since I'm hand picking
>>>>>>>>> the
>>>>>>>>> products and I loop through a list of item numbers that call the
>>>>>>>>> script to
>>>>>>>>> insert into cartridge.
>>>>>>>>>
>>>>>>>>> I didn't run into any problems, everything works - ratings,
>>>>>>>>> images, categories. I'd suggestion playing around with Cartridge api
>>>>>>>>> within a shell to play around with the product database.
>>>>>>>>>
>>>>>>>>> I'd suggest to keep at it and don't give up.
>>>>>>>>>
>>>>>>>>> Ryan
>>>>>>>>>
>>>>>>>>> On Wednesday, July 30, 2014 9:35:35 PM UTC-4, Stevo wrote:
>>>>>>>>>>
>>>>>>>>>> My biggest product feed is JSON and has 20k skus and gets updated
>>>>>>>>>> every 2 weeks. Other files are .csv, and only 3-4k skus, updated
>>>>>>>>>> every 2
>>>>>>>>>> months or so.
>>>>>>>>>> My main needs are: a) quoting tool to guide/train/remind the user
>>>>>>>>>> on the process and options in quoting complex product bundles b)
>>>>>>>>>> large
>>>>>>>>>> number of products with lots of attributes c) speed for about 20
>>>>>>>>>> users,
>>>>>>>>>> and d) easy coding to suit my high-level noobosity.
>>>>>>>>>> All I've tried so far is doing Dr Chuck's Python Course
>>>>>>>>>> <https://www.coursera.org/course/pythonlearn>, the Django tute
>>>>>>>>>> <https://docs.djangoproject.com/en/1.7/intro/tutorial01/>, Ross
>>>>>>>>>> Laird's tutes
>>>>>>>>>> <http://www.rosslaird.com/blog/first-steps-with-mezzanine/> and
>>>>>>>>>> installing Mezzanine <http://mezzanine.jupo.org/> and trying out
>>>>>>>>>> python-docx <https://python-docx.readthedocs.org/en/latest/> (How
>>>>>>>>>> cool is that gizmo?)
>>>>>>>>>> Like Mike, I love Mezzanine "out-of-the-box" plus its
>>>>>>>>>> not-insurmountable learning curve. I've had a look at OpenERP,
>>>>>>>>>> Magento,
>>>>>>>>>> SugarCRM and vTiger and a few others. They all do a great job, but
>>>>>>>>>> the
>>>>>>>>>> complexity of all that functionality is a problem for a web-admin
>>>>>>>>>> person in
>>>>>>>>>> a team of one, like me. So maybe it's better to do a bit of coding
>>>>>>>>>> to get
>>>>>>>>>> one app to do more, rather than manage three apps from the admin
>>>>>>>>>> interface
>>>>>>>>>> and try to get them to talk to each other.
>>>>>>>>>> My thinking is to use Mezzanine as a kind of "intranet-hub" to
>>>>>>>>>> other apps, like the quoting tool. Or actually use Mezzanine and
>>>>>>>>>> Cartridge
>>>>>>>>>> to do the quoting tool itself. So I was just hoping for some advice
>>>>>>>>>> before
>>>>>>>>>> I get started. So if you think it not a dumb idea, I'll try Sam's
>>>>>>>>>> Way first
>>>>>>>>>> and report back when I've got some results.
>>>>>>>>>> Best regards Ken et al, and many thanks for the prompt advice.
>>>>>>>>>> Stevo.
>>>>>>>>>>
>>>>>>>>>> On Wednesday, July 30, 2014 11:43:29 PM UTC+10, Kenneth Bolton
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>> What have you tried? What form do you currently have those "at
>>>>>>>>>>> least 20,000 products" in?
>>>>>>>>>>>
>>>>>>>>>>> The management command Stephen wrote about still works, afaik.
>>>>>>>>>>> And Sam's technique is a tried-and-true method of bulk-inserting
>>>>>>>>>>> complex
>>>>>>>>>>> data into Django already in use within Cartridge.
>>>>>>>>>>>
>>>>>>>>>>> ken
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Jul 30, 2014 at 8:36 AM, Stevo <[email protected]>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Is there any chance of an update on this issue? I'd really love
>>>>>>>>>>>> to use Mezzanine rather than Magento, but I have to load up at
>>>>>>>>>>>> least 20,000
>>>>>>>>>>>> products. I was hoping to use Cartridge as the foundation to allow
>>>>>>>>>>>> users to
>>>>>>>>>>>> do quite complex quotes and proposals and output them using
>>>>>>>>>>>> python-docx. Or
>>>>>>>>>>>> is this out of scope for Mezzanine? Any advice appreciated.
>>>>>>>>>>>> Regards.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On Monday, February 25, 2013 2:26:26 PM UTC+11, Martin Hickey
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am non-programmer, but I have launched a number of Mezzanine
>>>>>>>>>>>>> sites. I love the framework and am looking forward to learning
>>>>>>>>>>>>> more.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am beginning to play around with a concept that would
>>>>>>>>>>>>> require Cartridge. I have gone through the documentation, but I
>>>>>>>>>>>>> am sure
>>>>>>>>>>>>> that it is possible I missed it. Is there a way to bulk upload
>>>>>>>>>>>>> products
>>>>>>>>>>>>> into Cartridge. I have considered integrating something like
>>>>>>>>>>>>> django-feedmapper, but sure would love to avoid the time involved
>>>>>>>>>>>>> in a
>>>>>>>>>>>>> custom integration. Can you let me know if this is my best bet at
>>>>>>>>>>>>> this
>>>>>>>>>>>>> point?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>> Google Groups "Mezzanine Users" group.
>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from
>>>>>>>>>>>> it, send an email to [email protected].
>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "Mezzanine Users" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Mezzanine Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.