I had this exact problem with `OrderPayment`.

It only occurred when importing the `Order` model class in my own
module (which was last in the `INSTALLED_APPS` settings, and only when
running apache+wsgi in my deployment environment.

Your modification of payment/models.py to load `OrderPayment` lazily
fixed the problem.

On Jan 16, 4:24 pm, Jakob H <[email protected]> wrote:
> Hi,
>
> Thanks for the feedback. I tried Hynek's method, but it didn't help.
> The only module that wasn't loaded was 'tax.modules.no' but the
> provided code snipped didn't help from what I could see.
>
> What seems to have fixed it for now at least was the following
> modification to satchmo/apps/payment/models.py:
>
> 1. Comment out "from satchmo_store.shop.modelsimportOrderPayment"
> from imports at top of the file (line 15).
> 2. Do lazy loading of OrderPayment on line 46:
>
> orderpayment = models.ForeignKey('OrderPayment', unique=True,
>         related_name="creditcards")
>
> Other comments:
>
> 1) In my satchmo.log file I see the following:
>
> SettingNotSet: SHIPPING.MODULES
> SettingNotSet: PAYMENT_PAYPAL.CREDITCHOICES
>
> Not entirely sure what they refer to or if they are related in any
> way.
>
> 2) I never see the error when running runserver on my local machine.
>
> 3) On my local machine running Apache through WSGI, when I run the
> WSGI script (./django.wsgi) I don't get theimporterror
>
> 4) However, on my deployment server (shared hosting) when I run my
> WSGI script (./django.wsgi) I get theimporterror every time (without
> my above-mentioned 'fix')
>
> I do not know what the difference is between my local machine (running
> Apache) and my shared hosting service that causes the difference in
> results. It's the same code, and I've tried to replicate the version
> of every library that I know I use and use the same version of
> Python.
>
> I'm not really an experienced Python developer so this is all I know
> for now. Anyway, it seems to be the cause of a very specific issue of
> my deployment configuration, but I don't know what. And, at least the
> above-mentioned fix has solved it for me for now.
>
> Again, thanks for your help,
> Jakob
>
> On Jan 13, 12:43 pm, John-Scott Atlakson
>
>
>
>
>
>
>
> <[email protected]> wrote:
> > Hi Jakob,
>
> > This rearranging of imports solved a (separate?) issue I was seeing where
> > OrderTaxDetail could not be imported. This had the mysterious effect of
> > eliminating the large number of OrderPaymentimporterrors, evenerrorsI
> > was seeing in sites using an unmodified Satchmo in a separate virtualenv.
>
> > I think Chris M was suggesting that you try Hynek's strategy mentioned
> > above.
>
> > One simple thing would be to comment out admin.autodiscover() and see if the
> > problem goes away. That doesn't tell us much, but if this is a live site
> > that you need to get back up in a rush, this may be a stop gap.
>
> > I may have to take part of this conversation over to the modwsgi group, but
> > there is definitely something specific about Satchmo and/or some of its
> > depencies (keyed-cache, threaded-multihost, etc) since I do not have this
> > problem with any other non-Satchmo projects (even on the same server using
> > the same virtualenv, just no satchmo in INSTALLED_APPS).
>
> > Cheers,
> > John-Scott
>
> > On Thu, Jan 13, 2011 at 11:03 AM, Jakob H <[email protected]>wrote:
>
> > > Hi,
>
> > > Not yet, but I will try this tonight. So, the change I will try is:
>
> > > 1. Move class definition of OrderTaxDetail above class definition of
> > > Order
> > > 2. Put the FK model reference (Order) within single quotation marks
> > > ('Order') to make it load lazily (did not know you could do that)
>
> > > Does this seem correctly understood?
>
> > > I will try it and let you know.
> > > Cheers,
> > > Jakob
>
> > > On Jan 13, 10:34 am, Chris Moffitt <[email protected]> wrote:
> > > > Did you try the solution that was posted earlier in this thread? I
> > > haven't
> > > > tried it yet to see if it fixes it for me.
>
> > > > -Chris
>
> > > > On Thu, Jan 13, 2011 at 9:15 AM, Jakob H <[email protected]>
> > > wrote:
> > > > > Hi,
>
> > > > > I now get this error on basically every request to the website.
> > > > > However, I'm not sure it is specifically Satchmo related, but I really
> > > > > need to get this fixed.
>
> > > > > The problem does not seem to occur on the runserver on my local
> > > > > machine, but does happen every time on my shared host deployment
> > > > > server using WSGI.
>
> > > > > Here is my traceback:http://dpaste.com/313255/.
>
> > > > > I have Python 2.6.1 on my local machine and Python 2.6.2 on my
> > > > > deployment server if that matters.
>
> > > > > Cheers,
> > > > > Jakob
>
> > > > > On Jan 12, 10:20 pm, John-Scott <[email protected]> wrote:
> > > > > > Thanks for your thoughtful and thorough reply, Hynek.
>
> > > > > > Unfortunately I have been swamped by other projects for the moment
> > > and
> > > > > > haven't had a spare moment to rigorously troubleshoot (fortunately
> > > the
> > > > > >errorsare rare and as mentioned below do not seem to be triggered by
> > > > > human
> > > > > > visitors).
>
> > > > > > As mentioned in my other thread [1], my issues have* mostly
> > > *vanished. I
> > > > > > still occasionally see animporterror, although much less
> > > frequently.
> > > > > For
> > > > > > instance, I had to restart Apache and memcached recently and the
> > > first
> > > > > > requests to my 3 Satchmo sites each generated a single error email
> > > with
> > > > > the
> > > > > >importerror as the cause. After that, everything was fine. I've also
> > > > > seen
> > > > > > morerandomerrorswhere searchbots hit a completely invalid url on
> > > my
> > > > > sites
> > > > > > (scratching my head where they've come up with .aspx and .htm urls 
> > > > > > on
> > > a
> > > > > site
> > > > > > that has only been Django based and has only had Django-style
> > > 'pretty'
> > > > > > urls). Don't know that it's cause/effect...sadly the majority of
> > > traffic
> > > > > is
> > > > > > probably from searchbots to begin with, but the error messages 
> > > > > > always
> > > > > have
> > > > > > googlebot, bingbot or Yahoo! Slurp (gross) as the user agent and the
> > > > > > majority of the time they are hitting urls that have never been
> > > valid.
>
> > > > > > Again, haven't hide the time to do another deep dive, but thought 
> > > > > > I'd
> > > > > toss
> > > > > > these anecdotes onto the pile.
>
> > > > > > Cheers,
> > > > > > John-Scott
>
> > > > > > [1]
> > > > >https://groups.google.com/d/topic/satchmo-users/4nMkBFw7oGQ/discussion
>
> > > > > --
> > > > > 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%2Bunsubscribe@goog
> > > > >  ­legroups.com>
> > > <satchmo-users%2Bunsubscribe@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]<satchmo-users%2Bunsubscribe@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.

Reply via email to