Is it possible that you are running with different versions of python
between the runserver and nginx/gunicorn versions of your website?
I've noticed before in other work that e.g. Python 2.7 has slightly
different precision on floats than Python 2.6...
But yeah, weird problem.
On 25/05/2015 3:45 AM, vikraw wrote:
The staged server have the locale correctly set ( see at end of my
message the settings).
Steps on my Staged server - Amazon Ec2 - Ubuntu 14
- stopped supervisor and nginx on my staged machine
- switched my staged machine to run using - python manage runserver
0.0.0.0:8000
- put "printf value" statement in the "currency" filter under
shop_tags.py
now when i browse (using windows machine) the site running on ec2
machine I have NO issues with the Product prices, Cart total etc..Both
the Browser and the printf values match
However, when I switch the machine to nginx and start browsing from
windows machine, i start getting the incorrect prices (alternate
between correct and wrong) when
- I press the different products or go back and forth from cart to
product pages
- Switching between incorrect price and correct prices happens
everytime when I goto my payment processor and click the back button
again to website (neglecting browser warnings that page has expired).
BUT this doesn't happens when site running from "python manage runserver"
ex: Rs.249 is displayed as Rs.250 and Rs.349 as Rs.350. clicking the
same link toggles between those 2 values
Help is greatly appreciated as i am near completion and can't figure
this ambiguous behavior.
My development is on Local Machine a Ubuntu 12.01LTS and I was testing
using "python manage runserver" on 127.0.0.0:8000... This is working
as expected
locale command on ubuntu-14 amazon-ec2
LANG=en_IN
LANGUAGE=en_IN:en
LC_CTYPE="en_IN"
LC_NUMERIC="en_IN"
LC_TIME="en_IN"
LC_COLLATE="en_IN"
LC_MONETARY="en_IN"
LC_MESSAGES="en_IN"
LC_PAPER="en_IN"
LC_NAME="en_IN"
LC_ADDRESS="en_IN"
LC_TELEPHONE="en_IN"
LC_MEASUREMENT="en_IN"
LC_IDENTIFICATION="en_IN"
LC_ALL=
The currencies symbol is correctly shown on the browser. However, i
the prices change sometimes alternately and sometimes randomly.
Correct price is 249. it switches between 249 and 250 when i click the
same page or cart button. the cart total is updated
On Saturday, May 23, 2015 at 10:59:37 PM UTC+5:30, Stephen McDonald
wrote:
It looks like you're calculating the correct value being stored in
the DB, and only getting the error on output. Each currency value
gets passed through the "currency" template tag, which is where
the problem likely is. It also deals with machine specific locale
settings, which will vary per machine - also making it a likely
candidate for the error.
Here's the source for it -
https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/templatetags/shop_tags.py#L17-L41
<https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/templatetags/shop_tags.py#L17-L41>
Have you consistently defined (and installed) the correct locale?
(defined with the SHOP_CURRENCY_LOCALE setting).
Can you debug what happens in the "currency" template tag on your
deployed machine? That might entail adding some logging to it,
making a copy of it in your own project, printing out values while
manually running it in a terminal, whatever works for you.
On Sat, May 23, 2015 at 3:26 AM, vikraw <[email protected]
<javascript:>> wrote:
Hi
Almost near launching a site. But running into Price rounding
issues today when I fab deployed to AWS ec2 instance. Never
had those issues before on ec2.
My Development environment is working great with no issues.
However on deployed machine -Prices are getting rounded off in
various places ex: 249 was rounded off to 250 in cart.html, as
well as HTML invoice, PDF invoice.
Unit Price was displaying correctly as 249 But "Total Price"
was showing 250
Also, facing rounding off issues in PDF invoice and View
Invoice in browser.
The amounts are accurate in email invoice though. Even the
amounts sent to payment gateway are correct. When the account
user goes to history of orders, the amounts are correctly
displayed in the columns. Only issues are cart, html invoice,
pdf templates.
I have a tax_handler where i calculate tax as follows -
TAX_RATE = 0.05
tax_total = Decimal(amount_to_tax) *
Decimal(str(settings.TAX_RATE))
See attached files - 366.45 is the correct amount being shown
in Order-History page, but invoice is generated or 370.
--
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]
<javascript:>.
For more options, visit https://groups.google.com/d/optout
<https://groups.google.com/d/optout>.
--
Stephen McDonald
http://jupo.org
--
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]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
*Danny Sag*
Chairperson
Round World Events SA, Inc
City of Small Gods Terry Pratchett Fan Club - http://cityofsmallgods.org.au
*Nullus Anxietas VI - The Australian Discworld Convention* -
http://ausdwcon.org
"The Discworld Grand Tour" - Adelaide SA, August 4-6, 2017
--
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.