If you call stuff from inside ./manage.py shell, then the settings are
already loaded. Maybe just import the function from the path and run
it that way.

For example:

load_products.py
#####
def run():
    do_all_the_loading()
    ....
#####

Then at the terminal say:
./manage.py shell
from load_products import run
run()

That should clear up the settings issues.

Alex

On Thu, Nov 18, 2010 at 1:18 PM, Jeff Cook <[email protected]> wrote:
> When I try to run a modified version of the script included a bit
> earlier, I get complaints about DJANGO_SETTINGS not being found. If I
> update the env to include something like (from memory, don't have the
> machine/errors in front of me right now)
> DJANGO_SETTINGS=satchmo_store.settings.store_settings, I get
> complaints that the settings module does not contain some important
> satchmo thing. Anyone know the way around this? Let me know if these
> errors are too vague and I can include the real messages, I am just in
> a hurry and want to ping and see if anyone knows an easy fix for these
> kinds of errors.
>
> Thanks in advance.
>
> From
> Jeff
>
> On Thu, Nov 11, 2010 at 7:35 AM, Paul Walsh <[email protected]> wrote:
>> Hi Everyone,
>>
>> Thanks for the help! Sebastian - thanks for putting together a script
>> - I'll grab it now and have a look at it.
>>
>> On Nov 11, 12:49 pm, Sebastian Zwack <[email protected]>
>> wrote:
>>> Ok then have a look here:http://djangosnippets.org/snippets/2255/
>>>
>>> This is, of course, just a quick and dirty solution which needs to be
>>> adjusted to your excel file.
>>> I'm still working on it and will probably be adding parent/child
>>> categories and product options.
>>>
>>> Alex: Right, I never even tried csv when I read that. Also xlwt is
>>> pretty cool and straight forward.
>>>
>>> Hope that helps
>>> Sebastian
>>>
>>> On Nov 10, 9:00 pm, Christopher Wilcox <[email protected]> wrote:
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> > Hi there,
>>>
>>> > I would also be interested in your script which imports spreadsheet data
>>> > into Satchmo.
>>>
>>> > Would it be possible to share your script with me as well?
>>>
>>> > Cheers,
>>> > -Chris
>>>
>>> > On Wed, Nov 10, 2010 at 11:53 AM, Sebastian Zwack <
>>>
>>> > [email protected]> wrote:
>>> > > My answer below had a little delay because this was my first post
>>> > > which had to be verified.
>>>
>>> > > So basically I wrote a import script like you suggested. I used xlrd
>>> > > (http://www.python-excel.org/) instead of the csv module as it handles
>>> > > unicode out of the box. The Products and Categories show up correctly
>>> > > so I guess it's working.
>>>
>>> > > Paul, if you want me to send the script just let me know.
>>>
>>> > > Regards
>>> > > Sebastian
>>>
>>> > > On Nov 9, 3:11 pm, Alex Robbins <[email protected]> wrote:
>>> > > > I don't think satchmo has anything specifically for this use case.
>>> > > > However, you could use python's csv module.
>>>
>>> > > >http://docs.python.org/library/csv.html#csv.DictReader
>>>
>>> > > > Basically, the script would look like this:
>>>
>>> > > > from csv import DictReader
>>> > > > from product.models import Product
>>>
>>> > > > reader = DictReader(open('products.csv'))
>>> > > > for line in reader:
>>> > > >     Product.objects.create(
>>> > > >         #Setup the mapping between csv columns and satchmo product
>>> > > > attributes here
>>> > > >         title=line['title'],
>>> > > >         slug=line['slug_field]'
>>> > > >         ...
>>> > > >     )
>>>
>>> > > > You'd probably want some error control and stuff like that, but that
>>> > > > is the basic idea.
>>>
>>> > > > Hope that helps,
>>> > > > Alex
>>>
>>> > > > On Mon, Nov 8, 2010 at 1:44 AM, Paul Walsh <[email protected]> 
>>> > > > wrote:
>>> > > > > Hi,
>>>
>>> > > > > I am a new Satchmo user (and a very very novice Django beginner) -
>>> > > > > something that wasn't clear to me:
>>>
>>> > > > > Is there a core module or an available extension to import data via
>>> > > > > CSV? I saw the product_feeds extension module but it only seems to
>>> > > > > deal with export.
>>>
>>> > > > > If anyone can point me in the right direction that would be great!
>>>
>>> > > > > Thanks,
>>>
>>> > > > > Paul.
>>>
>>> > > > > --
>>> > > > > You received this message because you are subscribed to the Google
>>> > > Groups "Satchmo users" group.
>>> > > > > To post to this group, send email to [email protected].
>>> > > > > To unsubscribe from this group, send email to
>>> > > [email protected]<satchmo-users%2bunsubscr...@goog
>>> > >  legroups.com>
>>> > > .
>>> > > > > For more options, visit this group athttp://
>>> > > groups.google.com/group/satchmo-users?hl=en.
>>>
>>> > > --
>>> > > You received this message because you are subscribed to the Google 
>>> > > Groups
>>> > > "Satchmo users" group.
>>> > > To post to this group, send email to [email protected].
>>> > > To unsubscribe from this group, send email to
>>> > > [email protected]<satchmo-users%2bunsubscr...@goog
>>> > >  legroups.com>
>>> > > .
>>> > > For more options, visit this group at
>>> > >http://groups.google.com/group/satchmo-users?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Satchmo users" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to 
>> [email protected].
>> For more options, visit this group at 
>> http://groups.google.com/group/satchmo-users?hl=en.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Satchmo users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/satchmo-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/satchmo-users?hl=en.

Reply via email to