Re: django css: general query on CDNs and crispy forms

2016-02-24 Thread Adailton (Dhelbegor)
you have a problem here:

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myproject.myapp', ###Missed the point ( , )
'crispy_forms',   ###Registered
 )



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b1cdab7e-5a61-48f0-9296-cf78a9b5f3ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting django.db.utils.IntegrityError When migrating data from SQLite to postgreSQL

2016-02-24 Thread vaibhav jain

Please can someone help me to fix this issue 


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9e22e0e2-b47f-4eaf-a247-0d1c8ce7e707%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Asif Saifuddin
What is your server configuration and system usage statistics?

On Wednesday, February 24, 2016 at 10:59:28 AM UTC+6, Web Architect wrote:
>
> Hi,
>
> We have an ecommerce platform based on Django. We are using uwsgi to run 
> the app. The issue the CPU usage is hitting the roof (sometimes going 
> beyond 100%) for some scenarios. I would like to debug the platform on 
> Production to see where the CPU consumption is happening. We have used 
> Cache all over the place (including templates) as well - hence, the DB 
> queries would be quite limited. 
>
> I would refrain from using Django-debug toolbar as it slows down the 
> platform further, increases the CPU usage and also need to turn the DEBUG 
> on. Is there any other tool or way to debug the platform? Would appreciate 
> any recommendations/suggestions. 
>
> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
> Would appreciate if anyone could throw some light on this.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/69176a56-5604-4b3e-9887-9ebedf55dbb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


tutorial?

2016-02-24 Thread Mitesh Prajapati
I'm new to Django/Python world. 

I want references(book/tutorials) to learn "how to build REST APIs with 
Django" using ORM?


Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52916436-1e95-4af0-9193-4455db9df0f2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: tutorial?

2016-02-24 Thread Rafael E. Ferrero
look for django-rest-framework


Rafael E. Ferrero

2016-02-24 4:28 GMT-03:00 Mitesh Prajapati :

> I'm new to Django/Python world.
>
> I want references(book/tutorials) to learn "how to build REST APIs with
> Django" using ORM?
>
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/52916436-1e95-4af0-9193-4455db9df0f2%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJJc_8UNqW4AZtDzn0XUePk_apksoTj1nNq4eFXd-jzPj_mQmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Avraham Serour
> sometimes going beyond 100%

how??

You can use django-debug-toolbar on your development machine, check the
logs for the pages that take the longest to process and the one that are
the most requested and start with those, of course your CPU won't be high
but you should check and compare if there were improvements after changes.

Do you know already if the CPU usage spike is caused by django and not
another software? do you have other stuff in the same server? database?
elasticsearch? mongodb? celery workers?

were specifically are you using cache? I'm not familiar with the technical
term "all over the place"

> does the Django ORM increase the CPU usage?

using the ORM increase the CPU usage if you compare to not using it, the
fastest code is the one that does't run

Avraham


On Wed, Feb 24, 2016 at 9:10 AM, Asif Saifuddin  wrote:

> What is your server configuration and system usage statistics?
>
> On Wednesday, February 24, 2016 at 10:59:28 AM UTC+6, Web Architect wrote:
>>
>> Hi,
>>
>> We have an ecommerce platform based on Django. We are using uwsgi to run
>> the app. The issue the CPU usage is hitting the roof (sometimes going
>> beyond 100%) for some scenarios. I would like to debug the platform on
>> Production to see where the CPU consumption is happening. We have used
>> Cache all over the place (including templates) as well - hence, the DB
>> queries would be quite limited.
>>
>> I would refrain from using Django-debug toolbar as it slows down the
>> platform further, increases the CPU usage and also need to turn the DEBUG
>> on. Is there any other tool or way to debug the platform? Would appreciate
>> any recommendations/suggestions.
>>
>> Also, does the Django ORM increase the CPU usage? Does it block the CPU?
>> Would appreciate if anyone could throw some light on this.
>>
>> Thanks.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/69176a56-5604-4b3e-9887-9ebedf55dbb4%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tJtGdFCfxbv8uXyz-NE4NUwx_PTA3ZSqBcSwtZgAD1epw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Javier Guerra Giraldez
On 24 February 2016 at 13:18, Avraham Serour  wrote:
>> sometimes going beyond 100%
>
> how??


if it's what top reports, 100% refers to a whole core.  a multiforking
server (like uWSGI) can easily go well beyond that.

and that's not a bad thing

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoT0KnSKcFJ9wM03p2bWUxK1M3bQSW0oJNL_Zik-zvp7ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Will Harris
Hey Web Architect, I guess you never got that DB dump running in 
development? ;-)

Why don't you run some profiling middleware to see if you can some traces 
of the production system? Or how about New Relic or some such? That's 
pretty good at helping to identify problems spots in your stack.

Finally, you will really need to get your production setup running in a 
development environment if you are ever to have a hope of experimenting 
with different solutions. You need to understand what user actions are 
causing the load to spike, and reproduce that on similar infrastructure in 
a controlled environment where you can instrument your code to see exactly 
what's going on.

On Wednesday, February 24, 2016 at 5:59:28 AM UTC+1, Web Architect wrote:
>
> Hi,
>
> We have an ecommerce platform based on Django. We are using uwsgi to run 
> the app. The issue the CPU usage is hitting the roof (sometimes going 
> beyond 100%) for some scenarios. I would like to debug the platform on 
> Production to see where the CPU consumption is happening. We have used 
> Cache all over the place (including templates) as well - hence, the DB 
> queries would be quite limited. 
>
> I would refrain from using Django-debug toolbar as it slows down the 
> platform further, increases the CPU usage and also need to turn the DEBUG 
> on. Is there any other tool or way to debug the platform? Would appreciate 
> any recommendations/suggestions. 
>
> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
> Would appreciate if anyone could throw some light on this.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aea85fe6-393a-46a6-af21-014673caa4ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-tinymce not rendering in IE11

2016-02-24 Thread frocco
Hello,

Works fine in Chrome or Firefox.
Does not render using IE11.

did pip install django-tinymce

Can someone help me with this?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6434f908-f43d-4e81-8578-7d4e4b90fb09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-24 Thread Malik Rumi
Sorry to have dropped out for a few days there. James, when I said I only
have this one I should clarify. I had 90 records I wanted to put into one
model, and 1 record to put into another. The 1 record is linked to by a fk
from the other 90. For whatever reason, I was able to put the single record
fixture in without issue. Once I started having trouble with the others,
one of the many things I tried was taking all uuid's out to see if that
helped, and of course it didn't. So at one time the only uuid in the
fixture was the fk link to the model with only a single record in it. That
didn't work either.

All my pks at this moment are uuids. I read the SO link. I hope this does
not come across as too naive, but how would I check this as that person
did? Is it as simple as asking the shell what the uuid of x is, or is there
more to it because it might report back a uuid even though there is some
other 'ghost' integer floating around as well?

On Fri, Feb 19, 2016 at 1:36 PM, James Schneider 
wrote:

> The only uuid currently in this fixture is the one I got from Django when
>> I put another model (only one row) in with a fixture (no date field) and it
>> worked. I needed the uuid of that object to put into the foreign key of the
>> model I am having trouble with now.
>>
>>
>>
> So I was sniffing around the Internet for ideas, and I came across this
> SO:
> http://stackoverflow.com/questions/32445546/django-uuidfield-modelfield-causes-error-in-django-admin-badly-formed-hexadecim
>
> You mentioned that this is the only UUID in your fixture (which seems
> strange). Do you have a mixture of UUID's and integer PK's? It's possible
> that the UUID errors are actually resulting from an integer being passed to
> uuid.UUID() rather than one of your real UUID's.
>
> -James
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Q4zybgExDyY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2Be%2BciX%3Dz0KEvJJdMF7%3D3MKrWsuvhO6P%2B6%2BRso_QYM4Y6%3D4gsA%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBzJ_M%3Dz94whvuLsUD6xOz%3DCQLMDQwtAgC8iGB%3DZOoH5Kg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-24 Thread Malik Rumi
I am pursuing the debug option now to see what I can learn.

On Fri, Feb 19, 2016 at 5:29 PM, Michal Petrucha <
michal.petru...@konk.org> wrote:

> On Fri, Feb 19, 2016 at 10:20:42AM -0600, Malik Rumi wrote:
> > In [1]: import uuid
> >
> > In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74')
> > Out[2]: UUID('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> > BUT
> >
> > In [3]: uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> ---
> > AttributeErrorTraceback (most recent call
> last)
> >  in ()
> > > 1 uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> > AttributeError: 'module' object has no attribute 'UUID4'
> >
> >
> > So uuid.UUID4() [or 3 or whatever] can only be used a certain way, as in
> > Michael's example?
>
> There's no such thing as UUID4 in the Python uuid module -- there's
> UUID (which is the class representing UUIDs), and there's the function
> uuid4 (note that it's lowercase, it takes no arguments, and it will
> return an instance of UUID).
>
> > The remaining question for me, then, is *what is the proper format *for a
> > uuid in a json fixture, or any other document I am trying to mass import
> > into Django?
> >
> > 61877565-5fe5-4175-9f2b-d24704df0b74 - (apparently not)
> >
> > '61877565-5fe5-4175-9f2b-d24704df0b74'
> >
> > ('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> > UUID('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> > urn:uuid('61877565-5fe5-4175-9f2b-d24704df0b74')
> >
> > some other variation I haven't come up with yet?
> >
> > Here is a portion of my json document:
> >
> > [{"model": "essell.Code", "fields": { "uuid":
> > "48189959-be4c-4f10-819a-f1657061b3cd", "arrow": "Amendment II",
> > "shorttitle": "", "popularname": "Keep & Bear Arms", "acronym": "",
> > "offcite": "", "brokenarrow": "", "slug": "amendment-ii-keep-bear-arms",
> > "codetext": "A well regulated Militia, being necessary to the security
> of a
> > free State, the right of the people to keep and bear Arms, shall not be
> > infringed.", "effdate": "1792-03-13", "sunsetdate": "", "sunsetcause":
> > "''", "postdate": "2016-02-05 13:06:53.20548-06", "crossref": "''",
> > "codekind": "Article", "codekindsortseq": "1", "codelevel":
> "Constitution",
> > "codelevelsortseq": "1", "siblingrank": "11", "childof_id": "",
> > "jurisdiction_id": "e6e11b06-ea3b-4e98-a31f-9a83447ad884"} }, {"model"
> > 
> >
> > As you can see, the uuid is double quoted, but so are all the keys and
> > values. This is normal json format as I understand it. So should the uuid
> > be single quoted inside the double quotes? i.e.
> >
> > "'61877565-5fe5-4175-9f2b-d24704df0b74'"
> >
> > How do I get this done? Thanks.
>
> The two UUIDs in that JSON snippet look correct at a first (and
> second) glance. Have you tried using a debugger, or just a
> quick-and-dirty print statement to see what value is being passed into
> uuid.UUID that makes it raise an exception?
>
> My guess would be that the JSON file contains a value somewhere that
> is not a correct UUID, but I may be wrong, of course.
>
> Regards,
>
> Michal
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/Q4zybgExDyY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20160219232920.GF880%40konk.org
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oByNpxOM1DKAWZorUn_6EoV67Ez3G3k0xe-%2BxGN-7xa29A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Home Page

2016-02-24 Thread Malik Rumi
> I'm not sure what you're looking for here. Designing a home page is not a
django topic. Using django to deliver a homepage is the same as delivering
any other page

Please don't take offense, Bob, I appreciate you taking the time to
respond. I could not disagree with you more. Every web site has a home
page. And by definition, a home page is DIFFERENT from all other pages. But
the docs say nothing about any of that. Search them for 'home page' and see
what you get. Django sets you up with a series of apps which, taken
together, form your project. But in which of these apps does the home page
go? Does it matter? Why or why not? Should you make a separate app for the
home page? If so, why don't they tell us to put it in the app that is
created with startproject?

>> where to put the url

>I don't understand  what you mean by that. please explain
I know that the url is r'^$. But if I knew what app to put it in, then I
would know where to put this home page url. But what if the views and
templates related to your home and other static pages (like About Us) have
nothing to do with the views and templates of the rest of you project -
aside, maybe, from the very basic common html?

This is why people like jorrit787 and I struggle with the home page in
Django, and why we would like a little guidance and some wisdom about best
practices.

>>And how to handle a complex home page with a lot of changing content -
like on a newspaper, where Django was created?

>Seems to me that's not a django issue.
Again, with all due respect, I disagree. Why do we have filters like
truncate? Isn't that so you can put a teaser on the home page and then link
it to somewhere deeper in your site? Don't a lot of non-blog sites also
have rapidly changing content? Member sites, fan sites, etc? Of course we
can put an article on the home page, and the next day swap it out for a new
one, but that's the most obvious way to do it. Is there a better way? What
is the technology, coding, views, template set up and admin that best
accommodate that kind of site? But we get no guidance on these things. And
even if you think this is for designers and not developers, you have to
remember that a lot of us are doing both, and even if we aren't, the
designers and owners are going to ask us to put this together for them,
aren't they?

To the uninitiated, these are not small questions. And when you then try to
configure your urls, it becomes an even bigger problem. And I think that
the fact that you and other more experienced Django users don't see this as
a problem is itself a problem.

> And second, where (other than trial and error) do I find that kind of
documentation / support?
Trust me, I've googled this plenty, and the pickings are slim.

On Tue, Feb 23, 2016 at 9:39 AM, Bob Gailer  wrote:

>
> On Feb 23, 2016 7:59 AM, "Malik Rumi"  wrote:
> >
> > Why is there so little information in the docs
>
> Documentation evolves. User input helps that process. Perhaps you can make
> a contribution as you learn.
>
> about how to build a home page
>
> I'm not sure what you're looking for here. Designing a home page is not a
> django topic. Using django to deliver a homepage is the same as delivering
> any other page
>
> where to put the url
>
> I don't understand  what you mean by that. please explain
>
> whether or not to build a separate app around it, or why not to put it in
> the folder with settings in it,
>
> If your home page is a portal to several apps then it seems to me you
> would have an app for the home page
>
> And how to handle a complex home page with a lot of changing content -
> like on a newspaper, where Django was created?
>
> Seems to me that's not a django issue.
> >
> > And second, where (other than trial and error) do I find that kind of
> documentation / support?
>
> Google CMS?
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/EMtRahO3EYI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP1rxO4_xrKa%2BtdZ4VoHVbwxuvj628D%3DgURg%3DqFP-8R8c9umTQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com

Alternative Amazon S3?

2016-02-24 Thread setivolkylany
What Alternative Amazon S3 for serve media(uploaded) on website (Heroku 
hosting)?
I need only storage for media files because Heroku deleting my files

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e448c947-c0c5-4ff1-ba1c-a2582e2117bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Nikolas Stevenson-Molnar
Just to be clear: is is the uwsgi process(es) consuming the CPU? I ask 
because you mention DB queries, which wouldn't impact the CPU of uwsgi 
(you'd see that reflected in the database process).

On Tuesday, February 23, 2016 at 8:59:28 PM UTC-8, Web Architect wrote:
>
> Hi,
>
> We have an ecommerce platform based on Django. We are using uwsgi to run 
> the app. The issue the CPU usage is hitting the roof (sometimes going 
> beyond 100%) for some scenarios. I would like to debug the platform on 
> Production to see where the CPU consumption is happening. We have used 
> Cache all over the place (including templates) as well - hence, the DB 
> queries would be quite limited. 
>
> I would refrain from using Django-debug toolbar as it slows down the 
> platform further, increases the CPU usage and also need to turn the DEBUG 
> on. Is there any other tool or way to debug the platform? Would appreciate 
> any recommendations/suggestions. 
>
> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
> Would appreciate if anyone could throw some light on this.
>
> Thanks.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03b2a004-584e-4b79-99d6-5d429d760e0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: context dictionary

2016-02-24 Thread Malik Rumi
1. is { 5:five, 6:six} and {4:four) two dictionaries, or three?

2. Suppose I had a really long, or large, context, where the key is one of
the 50 states and the value is the date of their admission to the Union (of
the United States, of course). If that doesn't work, make it nations and
the date they joined the UN. Is there a way to automate the creation of
such a complex, or long, context? Yes, of course the data will be wildly
different depending on the needs of the site, but is there some common
'framework' for doing so? Do people do it by hand, come up with some
function that gets x from A and put it into {} as value 1, and then goes
back and pick up some other context data, maybe from a different table, so
it isn't a simple for loop? Or should I just use dict()?

On Tue, Feb 23, 2016 at 9:43 AM, Andreas Kuhne 
wrote:

> True, didn't know that it was active in that way nowadays. To Malik: Don't
> use user as a key in the dictionary.
>
> Regards,
>
> Andréas
>
> 2016-02-23 16:01 GMT+01:00 :
>
>> Wouldn't including the name 'user' in your context dictionary override
>> the authenticated user object in your template? Might make for some
>> unexpected behavior.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/5e3a7134-d7a6-4385-863f-c25437922127%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/1tVDUBrPRLQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CALXYUbnOJ%2B9HXFePmnrRCbLo4wokVsh5cz%2BaMaHvMQnEWhx9OQ%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBwT6NWT%2BE%3DVa5N9JhTzPKCmu5YVnbKb1ukibrz%3Diq7%2Bfw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Home Page

2016-02-24 Thread Rafael E. Ferrero
Malik, this is an example of a homepage in a site already in production.
Look this site www.python.org.ar, this homepage have the urls.py in this
github repository
 in line
32. You can find the view here
 in
line 16

Hope you can find them useful to learn.

Regards!!



Rafael E. Ferrero

2016-02-24 16:57 GMT-03:00 Malik Rumi :

> > I'm not sure what you're looking for here. Designing a home page is not
> a django topic. Using django to deliver a homepage is the same as
> delivering any other page
>
> Please don't take offense, Bob, I appreciate you taking the time to
> respond. I could not disagree with you more. Every web site has a home
> page. And by definition, a home page is DIFFERENT from all other pages. But
> the docs say nothing about any of that. Search them for 'home page' and see
> what you get. Django sets you up with a series of apps which, taken
> together, form your project. But in which of these apps does the home page
> go? Does it matter? Why or why not? Should you make a separate app for the
> home page? If so, why don't they tell us to put it in the app that is
> created with startproject?
>
> >> where to put the url
>
> >I don't understand  what you mean by that. please explain
> I know that the url is r'^$. But if I knew what app to put it in, then I
> would know where to put this home page url. But what if the views and
> templates related to your home and other static pages (like About Us) have
> nothing to do with the views and templates of the rest of you project -
> aside, maybe, from the very basic common html?
>
> This is why people like jorrit787 and I struggle with the home page in
> Django, and why we would like a little guidance and some wisdom about best
> practices.
>
> >>And how to handle a complex home page with a lot of changing content -
> like on a newspaper, where Django was created?
>
> >Seems to me that's not a django issue.
> Again, with all due respect, I disagree. Why do we have filters like
> truncate? Isn't that so you can put a teaser on the home page and then link
> it to somewhere deeper in your site? Don't a lot of non-blog sites also
> have rapidly changing content? Member sites, fan sites, etc? Of course we
> can put an article on the home page, and the next day swap it out for a new
> one, but that's the most obvious way to do it. Is there a better way? What
> is the technology, coding, views, template set up and admin that best
> accommodate that kind of site? But we get no guidance on these things. And
> even if you think this is for designers and not developers, you have to
> remember that a lot of us are doing both, and even if we aren't, the
> designers and owners are going to ask us to put this together for them,
> aren't they?
>
> To the uninitiated, these are not small questions. And when you then try
> to configure your urls, it becomes an even bigger problem. And I think that
> the fact that you and other more experienced Django users don't see this as
> a problem is itself a problem.
>
> > And second, where (other than trial and error) do I find that kind of
> documentation / support?
> Trust me, I've googled this plenty, and the pickings are slim.
>
> On Tue, Feb 23, 2016 at 9:39 AM, Bob Gailer  wrote:
>
>>
>> On Feb 23, 2016 7:59 AM, "Malik Rumi"  wrote:
>> >
>> > Why is there so little information in the docs
>>
>> Documentation evolves. User input helps that process. Perhaps you can
>> make a contribution as you learn.
>>
>> about how to build a home page
>>
>> I'm not sure what you're looking for here. Designing a home page is not a
>> django topic. Using django to deliver a homepage is the same as delivering
>> any other page
>>
>> where to put the url
>>
>> I don't understand  what you mean by that. please explain
>>
>> whether or not to build a separate app around it, or why not to put it in
>> the folder with settings in it,
>>
>> If your home page is a portal to several apps then it seems to me you
>> would have an app for the home page
>>
>> And how to handle a complex home page with a lot of changing content -
>> like on a newspaper, where Django was created?
>>
>> Seems to me that's not a django issue.
>> >
>> > And second, where (other than trial and error) do I find that kind of
>> documentation / support?
>>
>> Google CMS?
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/EMtRahO3EYI/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/djang

Re: context dictionary

2016-02-24 Thread Vijay Khemlani
Django 'is' a framework, therefore you have the flexibility to create your
context as you see fit. You could call an external API, query your
database, obtain results from ElasticSearch, parse another webpage, or
anything that suits the needs of your particular project.

It completely depends on the domain and scope of your project.

On Wed, Feb 24, 2016 at 5:19 PM, Malik Rumi  wrote:

> 1. is { 5:five, 6:six} and {4:four) two dictionaries, or three?
>
> 2. Suppose I had a really long, or large, context, where the key is one of
> the 50 states and the value is the date of their admission to the Union (of
> the United States, of course). If that doesn't work, make it nations and
> the date they joined the UN. Is there a way to automate the creation of
> such a complex, or long, context? Yes, of course the data will be wildly
> different depending on the needs of the site, but is there some common
> 'framework' for doing so? Do people do it by hand, come up with some
> function that gets x from A and put it into {} as value 1, and then goes
> back and pick up some other context data, maybe from a different table, so
> it isn't a simple for loop? Or should I just use dict()?
>
> On Tue, Feb 23, 2016 at 9:43 AM, Andreas Kuhne  > wrote:
>
>> True, didn't know that it was active in that way nowadays. To Malik:
>> Don't use user as a key in the dictionary.
>>
>> Regards,
>>
>> Andréas
>>
>> 2016-02-23 16:01 GMT+01:00 :
>>
>>> Wouldn't including the name 'user' in your context dictionary override
>>> the authenticated user object in your template? Might make for some
>>> unexpected behavior.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/5e3a7134-d7a6-4385-863f-c25437922127%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/1tVDUBrPRLQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALXYUbnOJ%2B9HXFePmnrRCbLo4wokVsh5cz%2BaMaHvMQnEWhx9OQ%40mail.gmail.com
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAKd6oBwT6NWT%2BE%3DVa5N9JhTzPKCmu5YVnbKb1ukibrz%3Diq7%2Bfw%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei2STVHGMB_ZhDotH_ntdBVacnsA92VT%3DBZVK8T3uhp26g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: null datetime field and json fixtures

2016-02-24 Thread James Schneider
On Wed, Feb 24, 2016 at 11:26 AM, Malik Rumi  wrote:

> I am pursuing the debug option now to see what I can learn.
>
>
>

Have you looked at enabling tracebacks (--traceback) and increasing the
verbosity of the loaddata command (-v {0,1,2,3}, --verbosity {0,1,2,3})?

$ python manage.py help loaddata
usage: manage.py loaddata [-h] [--version] [-v {0,1,2,3}]
  [--settings SETTINGS] [--pythonpath PYTHONPATH]
  [--traceback] [--no-color] [--database DATABASE]
  [--app APP_LABEL] [--ignorenonexistent]
  fixture [fixture ...]

Installs the named fixture(s) in the database.

positional arguments:
  fixture   Fixture labels.

optional arguments:
  -h, --helpshow this help message and exit
  --version show program's version number and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
Verbosity level; 0=minimal output, 1=normal output,
2=verbose output, 3=very verbose output
  --settings SETTINGS   The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided,
the
DJANGO_SETTINGS_MODULE environment variable will be
used.
  --pythonpath PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
  --traceback   Raise on CommandError exceptions
  --no-colorDon't colorize the command output.
  --database DATABASE   Nominates a specific database to load fixtures into.
Defaults to the "default" database.
  --app APP_LABEL   Only look for fixtures in the specified app.
  --ignorenonexistent, -i
Ignores entries in the serialized data for fields
that
do not currently exist on the model.


-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVUtK1LtfpfsNBRF1chO_wxG_pabr8F3wZRZVR6G0SwqQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Home Page

2016-02-24 Thread Andreas Kuhne
Malik,

I find that in many of your questions you are thinking a bit too hard.

If you want to have a view for the default page (home page) on a website,
just create an app that will handle those pages. In one project that I am
currently working on, we created an app called website. In that app we have
the default page and a lot of the static pages that we have. We also put
the base.html template that we use as a base for all of our HTML pages.
What you choose to call the app is up to you. All you have to do is add an
app that will have the default page url in it.

Regarding serving complex home pages with a lot of changing content, that
is also a design issue. Your other question regarding filling the context
before redering the template is realy about the same thing. You put in the
data that you want to render on the template and you do that in a view. It
doesn't matter if that view is the default page or a poll list (like the
example at https://docs.djangoproject.com/en/1.9/intro/tutorial03/) - you
fill the context with the information you need (from your database, from
another webserver) and you render it in the template. That way you can
create as dynamic pages as you like.

Regards,

Andréas

2016-02-24 20:57 GMT+01:00 Malik Rumi :

> > I'm not sure what you're looking for here. Designing a home page is not
> a django topic. Using django to deliver a homepage is the same as
> delivering any other page
>
> Please don't take offense, Bob, I appreciate you taking the time to
> respond. I could not disagree with you more. Every web site has a home
> page. And by definition, a home page is DIFFERENT from all other pages. But
> the docs say nothing about any of that. Search them for 'home page' and see
> what you get. Django sets you up with a series of apps which, taken
> together, form your project. But in which of these apps does the home page
> go? Does it matter? Why or why not? Should you make a separate app for the
> home page? If so, why don't they tell us to put it in the app that is
> created with startproject?
>
> >> where to put the url
>
> >I don't understand  what you mean by that. please explain
> I know that the url is r'^$. But if I knew what app to put it in, then I
> would know where to put this home page url. But what if the views and
> templates related to your home and other static pages (like About Us) have
> nothing to do with the views and templates of the rest of you project -
> aside, maybe, from the very basic common html?
>
> This is why people like jorrit787 and I struggle with the home page in
> Django, and why we would like a little guidance and some wisdom about best
> practices.
>
> >>And how to handle a complex home page with a lot of changing content -
> like on a newspaper, where Django was created?
>
> >Seems to me that's not a django issue.
> Again, with all due respect, I disagree. Why do we have filters like
> truncate? Isn't that so you can put a teaser on the home page and then link
> it to somewhere deeper in your site? Don't a lot of non-blog sites also
> have rapidly changing content? Member sites, fan sites, etc? Of course we
> can put an article on the home page, and the next day swap it out for a new
> one, but that's the most obvious way to do it. Is there a better way? What
> is the technology, coding, views, template set up and admin that best
> accommodate that kind of site? But we get no guidance on these things. And
> even if you think this is for designers and not developers, you have to
> remember that a lot of us are doing both, and even if we aren't, the
> designers and owners are going to ask us to put this together for them,
> aren't they?
>
> To the uninitiated, these are not small questions. And when you then try
> to configure your urls, it becomes an even bigger problem. And I think that
> the fact that you and other more experienced Django users don't see this as
> a problem is itself a problem.
>
> > And second, where (other than trial and error) do I find that kind of
> documentation / support?
> Trust me, I've googled this plenty, and the pickings are slim.
>
> On Tue, Feb 23, 2016 at 9:39 AM, Bob Gailer  wrote:
>
>>
>> On Feb 23, 2016 7:59 AM, "Malik Rumi"  wrote:
>> >
>> > Why is there so little information in the docs
>>
>> Documentation evolves. User input helps that process. Perhaps you can
>> make a contribution as you learn.
>>
>> about how to build a home page
>>
>> I'm not sure what you're looking for here. Designing a home page is not a
>> django topic. Using django to deliver a homepage is the same as delivering
>> any other page
>>
>> where to put the url
>>
>> I don't understand  what you mean by that. please explain
>>
>> whether or not to build a separate app around it, or why not to put it in
>> the folder with settings in it,
>>
>> If your home page is a portal to several apps then it seems to me you
>> would have an app for the home page
>>
>> And how to handle a complex home page with a lot of changing content -
>> like

Re: tutorial?

2016-02-24 Thread Tanuka Dutta
http://www.django-rest-framework.org/

- Tanuka

On Wednesday, 24 February 2016 17:48:17 UTC+5:30, Mitesh Prajapati wrote:
>
> I'm new to Django/Python world. 
>
> I want references(book/tutorials) to learn "how to build REST APIs with 
> Django" using ORM?
>
>
> Thanks in advance!
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/93889add-8181-44c5-9e24-1491fc50b83e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Web Architect
Hi Asif,

The OS is CentOS 6 Linux - HW is a dual core processor. Running Django with 
uwsgi. uwsgi is configured with 4 processes and 2 threads (no logic behind 
the numbers but trying to find the optimal combination). I just ran top and 
was checking the CPU usage. Mostly two instances of uwsgi is running and 
one is spiking beyond 100% cpu usage. 

Thanks,
Pinakee

On Wednesday, February 24, 2016 at 5:48:17 PM UTC+5:30, Asif Saifuddin 
wrote:
>
> What is your server configuration and system usage statistics?
>
> On Wednesday, February 24, 2016 at 10:59:28 AM UTC+6, Web Architect wrote:
>>
>> Hi,
>>
>> We have an ecommerce platform based on Django. We are using uwsgi to run 
>> the app. The issue the CPU usage is hitting the roof (sometimes going 
>> beyond 100%) for some scenarios. I would like to debug the platform on 
>> Production to see where the CPU consumption is happening. We have used 
>> Cache all over the place (including templates) as well - hence, the DB 
>> queries would be quite limited. 
>>
>> I would refrain from using Django-debug toolbar as it slows down the 
>> platform further, increases the CPU usage and also need to turn the DEBUG 
>> on. Is there any other tool or way to debug the platform? Would appreciate 
>> any recommendations/suggestions. 
>>
>> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
>> Would appreciate if anyone could throw some light on this.
>>
>> Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ca866790-5ece-44f1-b8cb-37865689a818%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Web Architect
Hi Avraham,

Please find my comments inline.

On Wednesday, February 24, 2016 at 6:49:29 PM UTC+5:30, Avraham Serour 
wrote:
>
> > sometimes going beyond 100%
>
> how??
>
> That's what I am trying to figure out :)
 

> You can use django-debug-toolbar on your development machine, check the 
> logs for the pages that take the longest to process and the one that are 
> the most requested and start with those, of course your CPU won't be high 
> but you should check and compare if there were improvements after changes.
>

I have done that on our development machine. There aren't much heavy 
calculation being done in any of the views. Only thing is MySQL access. But 
we have template based caching which is obviously reducing the DB queries 
for the cached period.

>
> Do you know already if the CPU usage spike is caused by django and not 
> another software? do you have other stuff in the same server? database? 
> elasticsearch? mongodb? celery workers?
>
We are using Solr but with top, won't that show as CPU consumption by java? 
We do not have celery. Since it's ecommerce platform, its image intensive 
where we are using sorl thumbnail to generate thumbnails dynamically. But 
 Sorl caches the thumbnails. Hence Image processing could have been CPU 
intensive but thats also being cached.


> were specifically are you using cache? I'm not familiar with the technical 
> term "all over the place"
>

Mostly in templates. I think that should help (won't be needed in views I 
presume).  Also, caching the DB results.  

>
> > does the Django ORM increase the CPU usage?
>
> using the ORM increase the CPU usage if you compare to not using it, the 
> fastest code is the one that does't run
>
> Avraham
>
>
> On Wed, Feb 24, 2016 at 9:10 AM, Asif Saifuddin  > wrote:
>
>> What is your server configuration and system usage statistics?
>>
>> On Wednesday, February 24, 2016 at 10:59:28 AM UTC+6, Web Architect wrote:
>>>
>>> Hi,
>>>
>>> We have an ecommerce platform based on Django. We are using uwsgi to run 
>>> the app. The issue the CPU usage is hitting the roof (sometimes going 
>>> beyond 100%) for some scenarios. I would like to debug the platform on 
>>> Production to see where the CPU consumption is happening. We have used 
>>> Cache all over the place (including templates) as well - hence, the DB 
>>> queries would be quite limited. 
>>>
>>> I would refrain from using Django-debug toolbar as it slows down the 
>>> platform further, increases the CPU usage and also need to turn the DEBUG 
>>> on. Is there any other tool or way to debug the platform? Would appreciate 
>>> any recommendations/suggestions. 
>>>
>>> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
>>> Would appreciate if anyone could throw some light on this.
>>>
>>> Thanks.
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/69176a56-5604-4b3e-9887-9ebedf55dbb4%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a28fe32c-b0d2-4ff7-8fa8-580d19e4eafe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Web Architect
Hi Javier, 

I am new to uwsgi. The CPU usage is what top is reporting. Is there a way 
to optimise uwsgi?

Thanks.

On Wednesday, February 24, 2016 at 7:06:34 PM UTC+5:30, Javier Guerra wrote:
>
> On 24 February 2016 at 13:18, Avraham Serour  > wrote: 
> >> sometimes going beyond 100% 
> > 
> > how?? 
>
>
> if it's what top reports, 100% refers to a whole core.  a multiforking 
> server (like uWSGI) can easily go well beyond that. 
>
> and that's not a bad thing 
>
> -- 
> Javier 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/276a9765-fd6d-45ec-8f2e-b04efc118316%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Web Architect
Hi Will,

In fact thats what I am doing currently. Also, trying to run the load as 
per the production (similar RPS etc based on reports from ngxtop). But 
unfortunately not able to generate the CPU usage spike on development 
(similar to production).

Thanks.

On Wednesday, February 24, 2016 at 7:10:22 PM UTC+5:30, Will Harris wrote:
>
> Hey Web Architect, I guess you never got that DB dump running in 
> development? ;-)
>
> Why don't you run some profiling middleware to see if you can some traces 
> of the production system? Or how about New Relic or some such? That's 
> pretty good at helping to identify problems spots in your stack.
>
> Finally, you will really need to get your production setup running in a 
> development environment if you are ever to have a hope of experimenting 
> with different solutions. You need to understand what user actions are 
> causing the load to spike, and reproduce that on similar infrastructure in 
> a controlled environment where you can instrument your code to see exactly 
> what's going on.
>
> On Wednesday, February 24, 2016 at 5:59:28 AM UTC+1, Web Architect wrote:
>>
>> Hi,
>>
>> We have an ecommerce platform based on Django. We are using uwsgi to run 
>> the app. The issue the CPU usage is hitting the roof (sometimes going 
>> beyond 100%) for some scenarios. I would like to debug the platform on 
>> Production to see where the CPU consumption is happening. We have used 
>> Cache all over the place (including templates) as well - hence, the DB 
>> queries would be quite limited. 
>>
>> I would refrain from using Django-debug toolbar as it slows down the 
>> platform further, increases the CPU usage and also need to turn the DEBUG 
>> on. Is there any other tool or way to debug the platform? Would appreciate 
>> any recommendations/suggestions. 
>>
>> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
>> Would appreciate if anyone could throw some light on this.
>>
>> Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c8704db5-24af-4622-b944-2472acd90e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging DJango app on production for High CPU Usage

2016-02-24 Thread Web Architect
Hi Nikolas,

I am new to uwsgi. Top is showing CPU consumption by uwsgi. Following is my 
uwsgi configuration:

master=True

socket=:7090

max-requests=5000

processes = 4

threads = 2

enable-threads = true

#harakiri = 30 (not sure if using this would be a good idea)

stats = 127.0.0.1:9191

HW is a dual core processor with CentOS 6 linux. I am not sure if there is 
a better way to configure uwsgi. uwsgitop is showing only one worker 
process being heavily used and that is the one spiking to 100% + cpu usage. 

Thanks.


On Thursday, February 25, 2016 at 1:47:43 AM UTC+5:30, Nikolas 
Stevenson-Molnar wrote:
>
> Just to be clear: is is the uwsgi process(es) consuming the CPU? I ask 
> because you mention DB queries, which wouldn't impact the CPU of uwsgi 
> (you'd see that reflected in the database process).
>
> On Tuesday, February 23, 2016 at 8:59:28 PM UTC-8, Web Architect wrote:
>>
>> Hi,
>>
>> We have an ecommerce platform based on Django. We are using uwsgi to run 
>> the app. The issue the CPU usage is hitting the roof (sometimes going 
>> beyond 100%) for some scenarios. I would like to debug the platform on 
>> Production to see where the CPU consumption is happening. We have used 
>> Cache all over the place (including templates) as well - hence, the DB 
>> queries would be quite limited. 
>>
>> I would refrain from using Django-debug toolbar as it slows down the 
>> platform further, increases the CPU usage and also need to turn the DEBUG 
>> on. Is there any other tool or way to debug the platform? Would appreciate 
>> any recommendations/suggestions. 
>>
>> Also, does the Django ORM increase the CPU usage? Does it block the CPU? 
>> Would appreciate if anyone could throw some light on this.
>>
>> Thanks.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f3ddf458-1b3c-4e3f-8726-2ed494ace71d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.