Debugging DJango app on production for High CPU Usage

2016-02-23 Thread Web Architect
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

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

2016-02-23 Thread Mario Gudelj
You're missing a comma after my app inside installed_apps. You can load bootstrap from cdn inside head, before your custom style sheet. Not a problem there. Pip install crispy forms. They'll end up in your site-packages folder. No need to download it and put it inside your project. Run

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

2016-02-23 Thread Lee Hinde
On Feb 23, 2016, at 5:27 PM, clarksonchri...@gmail.com wrote: > > Should i download bootstrap properly or do the CDNs suffice? Your call; but if you want to have a plan B, here’s an example: http://www.hanselman.com/blog/CDNsFailButYourScriptsDontHaveToFallbackFromCDNToLocalJQuery.aspx

django css: general query on CDNs and crispy forms

2016-02-23 Thread clarksonchris81
I have set up a page and have implemented bootstrap using the CDN code that is recommended to access the online bootstrap server: for the CSS: https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css;

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Bernardo Garcia
Hi James. Thanks for your attention and the stackoverflow reference I try setup the headers in my nginx configuration file but I don't get success My /etc/nginx/sites-enabled/myproject file I had so: server { server_name yourdomainorip.com; access_log off; location / {

Re: mathematical function and django connect

2016-02-23 Thread James Schneider
On Mon, Feb 22, 2016 at 12:08 PM, Xristos Xristoou wrote: > the problem in the html form we need to change second input to > take multiple values,for example first input take a number > and the second input take many numbers..if the first number = 2 then take > second input

Re: Relations one-to-many on django

2016-02-23 Thread Vijay Khemlani
Each product is only associated with one category, so you can only do produto.categoria If you want to iterate over all categories, and then through the products of each category, you could do {% for categoria in categorias %} {% for produto in categoria.produto_set.all %} do comething with

Re: Relations one-to-many on django

2016-02-23 Thread James Schneider
> > I try to use >> >> {% if categorias %} >> >> {% for categoria in produto.categoria_set() %} At no time can parentheses be used when referencing variables. The correct way to write this tag would be {% for categoria in produto.categoria_set

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread James Schneider
On Tue, Feb 23, 2016 at 6:03 AM, Bernardo Garcia wrote: > Hi everyone Djangonauts > :) > > Currently I am exposing a Django application (for the momento is just > thier users schema) with Django Rest Framework and happen that each > serialized model, in the url attribute, I

Relations one-to-many on django

2016-02-23 Thread Douglas Bonafe
Hello everybody! I'm new on this forum and in django. I'm using Python 2.7 environment. I have the following models.py: class Categoria(models.Model): > > DEFAULT_CATHEGORY = 0 > nome = models.CharField(max_length=255, null=False, default='0') > > def __unicode__(self): >

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Bernardo Garcia
Felipe, give me a couple of minutes and I tell to you, but If you see my first post in this thread, the api links is related with the serializers.py file, in the urls.py files the router.register sentence and the views.py the ViewSet class In this post is detailed ...

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Avraham Serour
this seems to be the problem, honestly I don't have much experience with gunicorn, I've used uwsgi and never had such problems. I hope someone on this list with more experience with gunicorn can tell. I suggest you either look for some other django+gunicorn tutorials and see what they suggest or

Re: Accessing Request Object in Form Definition

2016-02-23 Thread Chris Kavanagh
Thank you so much, James. . .I greatly appreciate you taking the time to answer! On Tuesday, February 23, 2016 at 1:50:57 AM UTC-5, James Schneider wrote: > > On Mon, Feb 22, 2016 at 10:23 PM, Chris Kavanagh > wrote: > >> To possibly answer my own question, thinking out

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Fellipe Henrique
Sorry to reply your post, but.. how do you show all api link? there's any settings for these? I asking because, when I try on my api, show me 404 page... T.·.F.·.A.·. S+F *Fellipe Henrique P. Soares* e-mail: > echo "lkrrovknFmsgor4ius" | perl -pe \ 's/(.)/chr(ord($1)-2*3)/ge' *Fedora

Re: Home Page

2016-02-23 Thread Bob Gailer
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

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
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

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Bernardo Garcia
Avraham, so yes, efectively ... This is my gunicorn_config.py command = '/opt/uleague/bin/gunicorn' pythonpath = '/opt/uleague/pickapp' bind = '127.0.0.1:8000' workers = 3 I will should in the directive bind put the internal ip address of my machine? I have some doubts - The internal ip

Re: Home Page

2016-02-23 Thread jorrit787
I struggled with this as well. I usually end up creating a 'common' app for my homepage and project-wide templates and static files, but I don't know if that's considered a best practice. Alternatively you could put your homepage in your most used/most important app. -- You received this

Re: context dictionary

2016-02-23 Thread jorrit787
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

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Avraham Serour
are you using a config file for gunicorn? in the example it tells to use: bind = '127.0.0.1:8001' are you binding to 127.0.0.1 ? On Tue, Feb 23, 2016 at 4:33 PM, Bernardo Garcia wrote: > Hi Mr. Avraham Serour thanks for the attention > > In my amazon ec2 production server

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Bernardo Garcia
Hi Mr. Avraham Serour thanks for the attention In my amazon ec2 production server I am running my Django Application using nginx, and gunicorn accord to this tutorial https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-django-with-postgres-nginx-and-gunicorn python

Re: API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Avraham Serour
are you running django using manage.py runserver? On Tue, Feb 23, 2016 at 4:03 PM, Bernardo Garcia wrote: > Hi everyone Djangonauts > :) > > Currently I am exposing a Django application (for the momento is just > thier users schema) with Django Rest Framework and happen

API REST - Url's Serialized models don't work with the hostname of my production server - Django Rest Framework

2016-02-23 Thread Bernardo Garcia
Hi everyone Djangonauts :) Currently I am exposing a Django application (for the momento is just thier users schema) with Django Rest Framework and happen that each serialized model, in the url attribute, I have is the localhost machine address development and don't take the hostname of my

Re: Home Page

2016-02-23 Thread Sithembewena Lloyd Dube
Have you done the tutorial? Django is suitable for everything you listed, it's just that you need to learn how to implement those things in Django. This means you need to know how to use Django. I suggest you do the tutorial first. On Tue, Feb 23, 2016 at 2:59 PM, Malik Rumi

Re: context dictionary

2016-02-23 Thread Andreas Kuhne
Hi, All you have to do is add what you want to the dictionary that you need for your template. There isn't anything "magic" about the context. So for example, if you want to have a model called "user" in the template, you can add it by writing: context = {} context['user'] =

context dictionary

2016-02-23 Thread Malik Rumi
from the docs: Changed in Django 1.8: The context argument used to be called dictionary. That name is deprecated in Django 1.8 and will be removed in Django 1.10. https://docs.djangoproject.com/en/1.9/topics/http/shortcuts/#optional-arguments I've been fooling with Django since 1.6 and I

Home Page

2016-02-23 Thread Malik Rumi
Why is there so little information in the docs about how to build a home page, where to put the url, whether or not to build a separate app around it, why or why not to put it in the folder with settings in it, and how to handle a complex home page with a lot of changing content - like on a

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-23 Thread Larry Martell
I did this: # yum shell --enablerepo=remi > remove php-mysql > install php-mysqlnd > run Followed by this: yum install mysql-devel /usr/local/bin/pip2.7 install MySQL-python Now the MySQL server is down and will not come up. It fails with this: Fatal error: mysql.user table is damaged. Please

Re: Installing MySQLdb for python2.7 in RHEL 6

2016-02-23 Thread Larry Martell
This is a machine I have inherited and I really know nothing about it. I need to set up django on it, but I don't want to break anything. They use the Semantic Media Wiki, which uses PHP - If I do this could that break that? On Tue, Feb 23, 2016 at 2:12 AM, Kelvin Wong wrote: