Re: Django and Long Polling

2014-03-22 Thread Venkatraman S
Why not use (async)callbacks?

-V


On Sun, Mar 23, 2014 at 1:11 AM, Robin Lery  wrote:

> Hello,
> I need to implement long polling in my application to retrieve the events.
> But I have no idea how to do it. I know the concept of long polling, i.e to
> leave the connection open, until an event occurs. But how do I do implement
> this in my project. If you could give me a simple long polling example of
> client side and the views i guess, I would really appreciate.
>
> Thank you!
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B4-nGpvKHcMg-mMRbf7%2BVceCAkRwipt_8NvojEw43ALhC2YBw%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN7tdFQKUvNQ69NA_K58R1tz2R_HW2eE%2BvwrFr-7hqVRUDO8tg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Incorrect SQL

2014-03-22 Thread Ramiro Morales
On Sat, Mar 22, 2014 at 7:48 PM, egon.frer...@gmx.de
 wrote:
> With django 1.6.2, python3 and MySQL manage.py inspectdb brings this error:
>
> django.db.utils.ProgrammingError: (1064, "You have an error in your SQL
> syntax; check the manual that corresponds to your MySQL server version for
> the right syntax to use near '%s AND table_schema = DATABASE()\n
> AND character_maximum_length IS' at line 2")
>
> I put some print statements in
> - django/db/backends/mysql/introspection.py line 43
> - django/db/utils.py line 111, 125, 151, 154, 165, 202
> - django/db/backends/util.py line 47
>
> The output with traceback shows in line 22 (from line 43 introspections.py)
> the table_name auth_group
> and then from util line 47 the sql statement in which the table_name  should
> be inserted.
>
> But that doesn't happened. The executed sql statement contains still %s and
> not the table name.
>
> Any idea?

It's weird.

Can you modify the execute() method in
django/db/backends/mysql/base.py to verify the args argument actually
contains  your 'auth_user' table name?

Also, what's the origin of the python-MySQLdb driver you are using?
AFAIK there isn't a 1.2.3 version compatible with Python 3.x. See
https://docs.djangoproject.com/en/1.6/ref/databases/#python-3

-- 
Ramiro Morales
@ramiromorales

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO7PdF-RfkDO-feDNZoQNLYhyNSRvDk42zNfkja_9fgJ45y9EQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Incorrect SQL

2014-03-22 Thread egon.frer...@gmx.de
With django 1.6.2, python3 and MySQL manage.py inspectdb brings this error:

django.db.utils.ProgrammingError: (1064, "You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for 
the right syntax to use near '%s AND table_schema = 
DATABASE()\nAND character_maximum_length IS' at line 2")

I put some print statements in 
- django/db/backends/mysql/introspection.py line 43
- django/db/utils.py line 111, 125, 151, 154, 165, 202
- django/db/backends/util.py line 47

The output with traceback shows in line 22 (from line 43 introspections.py) 
the table_name auth_group
and then from util line 47 the sql statement in which the table_name  
should be inserted.

But that doesn't happened. The executed sql statement contains still %s and 
not the table name.

Any idea?

Egon

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ccd3b238-cd0b-4c76-9406-9963887aaebf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
util 151
util 154
util165  {'default': {'ENGINE': 'django.db.backends.mysql', 'PORT': '3306', 
'NAME': 'x', 'HOST': 'xxx', 'PASSWORD': 'xxx', 'USER': 'xxx'}}
utils load_backend 111
client 8
util 202 
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Remove `managed = False` lines for those models you wish to give write DB 
access
# Feel free to rename the models, but don't rename db_table values or field 
names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom 
[appname]'
# into your database.
from __future__ import unicode_literals

from django.db import models

util 47  SHOW TABLES
class AuthGroup(models.Model):
mysql/introsp. 43  auth_group
util 47  
SELECT column_name, character_maximum_length FROM 
information_schema.columns
WHERE table_name = %s AND table_schema = DATABASE()
AND character_maximum_length IS NOT NULL
Traceback (most recent call last):
  File "/usr/local/lib/python3.3/site-packages/django/db/backends/util.py", 
line 54, in execute
return self.cursor.execute(sql, params)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/mysql/base.py", line 
125, in execute
return self.cursor.execute(query, args)
  File 
"/usr/local/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-linux-x86_64.egg/MySQLdb/cursors.py",
 line 184, in execute
self.errorhandler(self, exc, value)
  File 
"/usr/local/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-linux-x86_64.egg/MySQLdb/connections.py",
 line 37, in defaulterrorhandler
raise errorvalue
  File 
"/usr/local/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-linux-x86_64.egg/MySQLdb/cursors.py",
 line 171, in execute
r = self._query(query)
  File 
"/usr/local/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-linux-x86_64.egg/MySQLdb/cursors.py",
 line 330, in _query
rowcount = self._do_query(q)
  File 
"/usr/local/lib/python3.3/site-packages/MySQL_python-1.2.3-py3.3-linux-x86_64.egg/MySQLdb/cursors.py",
 line 294, in _do_query
db.query(q)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL 
syntax; check the manual that corresponds to your MySQL server version for the 
right syntax to use near '%s AND table_schema = DATABASE()\nAND 
character_maximum_length IS' at line 2")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manageMySQL.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 399, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 242, in run_from_argv
self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 285, in execute
output = self.handle(*args, **options)
  File "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 415, in handle
return self.handle_noargs(**options)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/commands/inspectdb.py",
 line 27, in handle_noargs
for line in 

Django and Long Polling

2014-03-22 Thread Robin Lery
Hello,
I need to implement long polling in my application to retrieve the events.
But I have no idea how to do it. I know the concept of long polling, i.e to
leave the connection open, until an event occurs. But how do I do implement
this in my project. If you could give me a simple long polling example of
client side and the views i guess, I would really appreciate.

Thank you!

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGpvKHcMg-mMRbf7%2BVceCAkRwipt_8NvojEw43ALhC2YBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: loaddata not looking for natural keys

2014-03-22 Thread bobhaugen
Oh, and I am using Django 1.4.5.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fb182402-7ec4-473c-9866-3ad5678fa742%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


loaddata not looking for natural keys

2014-03-22 Thread bobhaugen
loaddata error message:

File 
"/home/bob/.virtualenvs/vn2/lib/python2.6/site-packages/django/core/serializers/json.py",
 
line 47, in Deserializer
raise DeserializationError(e)
DeserializationError: [u"'Cash Contribution' value must be an integer."]


Here's how I dumped the data:

./manage.py dumpdata valueaccounting.AgentType  valueaccounting.Facet 
valueaccounting.FacetValue valueaccounting.ProcessPattern 
valueaccounting.PatternFacetValue  valueaccounting.Project --natural 
--indent=4 > starters.json


Then I did syncdb and migrate.

Then I tried loaddata:

./manage.py loaddata starters.json


Here's the offending json:

{
"pk": 22, 
"model": "valueaccounting.patternfacetvalue", 
"fields": {
"facet_value": 4, 
"pattern": 9, 
"event_type": "Cash Contribution"
}
}, 


Here's the relevant natural key code:

class EventTypeManager(models.Manager):

def get_by_natural_key(self, name):
return self.get(name=name)

class EventType(models.Model):
[...]
objects = EventTypeManager()

def natural_key(self):
return (self.name)


So what am I missing?  (I put a pdb trace in the get_by_natural_key method, 
never got called.) 

I am stumped. But I expect it is some stupid mistake that I can't see...

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4023a879-c7e5-458e-8235-72a517102572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Harjot Mann
On Sat, Mar 22, 2014 at 8:38 PM, Satinderpal Singh
 wrote:
> I wonder you didn't remember the problem related to automation software.:)


No it's not the automation problem. I caught you right :P
BTW, the problem is solved as I posted the mail, it was simple as we
do in other fields to get rid of validations that is blank=True and
null=True.

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhAFujYzLtdRFKpe32bAetxhXg-DWFumMTi1%3D0YiXCZxTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Satinderpal Singh
On Mar 22, 2014 8:27 PM, "Harjot Mann"  wrote:
>
> On Sat, Mar 22, 2014 at 8:19 PM, Satinderpal Singh
>  wrote:
> > And the same problem is still there:)
> > Please show me the code.
>
> Sorry didn't get you.
> Are you facing the same problem or do you want to say something else?
>
I wonder you didn't remember the problem related to automation software.:)

--
Satinderpal Singh

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BiK19KNiovRCy9zSUyjFB8zTPSG8WwQjQCJbnFBf1XT-ma7PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: submit buttons in django

2014-03-22 Thread Satinderpal Singh
On Mar 20, 2014 9:19 AM, "Harjot Mann"  wrote:
>
> I have a form in my app and after entering data into that form I
> submit that form
but I want an another submit button like "Submit and
> Add Event", so that after clicking on it it can redirect to an another
> form. Please help me that how can I do this?
>
What you exactly wish to do, as you submit the first form, it saves the
data to database, you simply need another button, which can redirect to the
same form, or to any another form.

But if you need not to submit the data from first form and wishes to
redirect the other form then you have to follow another approach.

--
Satinderpal Singh

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BiK19KvBfb5bwpoAr30i1Ww%3DRKmiJGKFzmR2ESOQLyEcXAfpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Harjot Mann
On Sat, Mar 22, 2014 at 8:19 PM, Satinderpal Singh
 wrote:
> And the same problem is still there:)
> Please show me the code.

Sorry didn't get you.
Are you facing the same problem or do you want to say something else?

-- 
Harjot Kaur Mann
Blog: http://harjotmann.wordpress.com/
Daily Dairy: http://harjotmann.wordpress.com/daily-diary/

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAB0GQhC0O_%3DjAsoUg_nEE1tatbyv%3DevFKZq-a98TjhQoCZodzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key attribute in django

2014-03-22 Thread Satinderpal Singh
On Mar 20, 2014 9:28 AM, "Harjot Mann"  wrote:
>
> I have a field in my form that is related with foreign key to another
> form and when I am filling a form that is required field but sometimes
> I need to leave it blaink, how can I do this?
>
And the same problem is still there:)
Please show me the code.

--
Satinderpal Singh

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BiK19KwefHF6PCHNkHKZSt5-XotsKvhmM6xoHEb9jmGb1dL-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deployment in Django

2014-03-22 Thread Amim Knabben
Probably the ones you read there...

If you aren't new on Linux, install the env on Virtualenv (go for
virtualenvwrapper, it will give you some hackable shortcuts), I like
PostgreSQL most, for static/media stuff normally I use Nginx, and for WSGI
Gunicorn, the guys from New Relic have an awesome monitoring tool for free
(without history).

The answer for your first question can be: try Gondor.io or Heroku. But if
you have spare time grab some beers and go with Vagrant, Chef and a bunch
of Fabric lines.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAODc%2BXYh%3D_4Q1UntN9hdRJhB4jfwtUL-EuQ3f_xoYyY5bjb6VQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deployment in Django

2014-03-22 Thread Ariel E. Isidro
After git, pythonanywhere is a simple way to deploy and publish.
On Mar 22, 2014 9:02 PM, "Kamal Kaur"  wrote:

> On Sat, Mar 22, 2014 at 2:50 PM, Aryak Sengupta 
> wrote:
> > But what is the simplest and the easiest way to go about deployment?
> >
> > P.S. I am new to Django.
>
> Starting with a small app, following a good tutorial is not a bad
> idea! And the simplest, it lets you start from basics. Make sure you
> use git right from the first step. Will be beneficial. First try
> exploring about it.
>
> Something I just found:
>
> http://stackoverflow.com/questions/5467916/what-is-a-good-tutorial-for-django-other-than-the-django-documentation
>
> --
> Kamaljeet Kaur
>
> kamalkaur188.wordpress.com
> facebook.com/kaur.188
>
> --
> 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 http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAP8Q%2BxgcW0x%2BkfTdhN67cJuD5Fw12W5ACieY2ZMpPRuLO8md-w%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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECOjiaefgAy44qv5B0%3DtFXpGuJDhammFnCzHu_3qsDCLaB7%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Deployment in Django

2014-03-22 Thread Kamal Kaur
On Sat, Mar 22, 2014 at 2:50 PM, Aryak Sengupta  wrote:
> But what is the simplest and the easiest way to go about deployment?
>
> P.S. I am new to Django.

Starting with a small app, following a good tutorial is not a bad
idea! And the simplest, it lets you start from basics. Make sure you
use git right from the first step. Will be beneficial. First try
exploring about it.

Something I just found:
http://stackoverflow.com/questions/5467916/what-is-a-good-tutorial-for-django-other-than-the-django-documentation

-- 
Kamaljeet Kaur

kamalkaur188.wordpress.com
facebook.com/kaur.188

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAP8Q%2BxgcW0x%2BkfTdhN67cJuD5Fw12W5ACieY2ZMpPRuLO8md-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Deployment in Django

2014-03-22 Thread Aryak Sengupta
What is the simplest way to go about Django deployment?
So far, I have found stuffs like pythonanywhere and Django's own deployment
tutorial

But what is the simplest and the easiest way to go about deployment?

P.S. I am new to Django.

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALTbq1x4RD%3D0LFxVYxT7vb_EtxysRju1iH7uh42O_yTpPqL0hg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


wsgi does not work as intended even it works fine when python manage.py runserver 0.0.0.0:8000

2014-03-22 Thread Jun Tanaka
Hello,

wsgi does not work as usually even it works fine when python manage.py 
runserver 0.0.0.0:8000 
I use django version 1.3

I have two issues here.
1. how to add projectname inside of the url
2.static is not connected right


153.xx.x.x.x:8000/simple_project
this works.

But not when
153.xx.x.x.x/projectname/simple_project
The layout is not shown correctly because static file is not read. 


django.wsgi as follows

import os, sys
sys.path.append('/var/www/django')

os.environ['DJANGO_SETTINGS_MODULE'] = 'projectname.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
>>>

static in settings.py
>>>
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
"/var/www/django/projectname/static",
)
>>>

urls.py
>
urlpatterns = patterns('',
(r'^simple_project/add/(?P\w*)$', 'simple_project.views.index'),
)
>>>


Anyone who know a solution please giver me an advise. 

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0542beb5-dfeb-47f8-abba-f1b5aa8e9262%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.