RE: Unable to storing unicode data using django

2013-04-12 Thread Anshum Verma
  Utf8 is default support in django unless you are explicitly typecasting
to str. Please provide details of traceback and code snippets to debug this.


Sent from my Windows Phone
 --
From: sastry mln 
Sent: 12-04-2013 17:29
To: django-users@googlegroups.com
Subject: Unable to storing unicode data using django

Hi All,
  I have a mysqldb with utf8 charset and utf8_general_ci collation. The
tables are also explicity defined to use the same charset/collation
  I have a django model with CharField.
  I want to store unicode characters (hindi language chars)
  when i tested the model form django admin shell, I got error saying that
the character is unrecognised.

  I read the unicode section of the documenation, but i did not understand
clearly.

  can someone please post a snippet about how to let the web application
allow unicode data entry using  (A) from django shell (b) From the data
entry screen created through the modelAdmin forms

regards
mln

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Unable to storing unicode data using django

2013-04-13 Thread Anshum Verma
  This seems to be coming from MySQL . Can you check what is the default
charset for the Book table in mysql and also that of the individual
columns. You can share the output of show create table from mysql.

Regards,
Anshum

Sent from my Windows Phone
 --
From: mln sastry 
Sent: ‎13-‎04-‎2013 11:07
To: Anshum Verma 
Cc: django-users@googlegroups.com
Subject: Re: Unable to storing unicode data using django



Hi Anshum,
  Thank you for responding.
  I defined a Book model as shown below and tried to save it from the admin
shell.
  I am using python2.7.3 , django1.5, and python mysql driver 1.2.3.
  I am not sure if my model data type is wrong or if any qualifier is
missing. Please help.

  I got this error:Warning: Incorrect string value:
'\xE0\xA4\xB6\xE0\xA5\x8D...' for column 'bookName' at row 1"

class *Book*(models.Model):

bookId = models.AutoField(primary_key=True)

bookName = models.TextField(max_length=200,null=False,)

bookShortName = models.CharField(max_length=10,null=True,)

isDeleted = models.NullBooleanField  (null=True,)



gita4 = Book(bookName= "श्रीमद्भगवद्गीता",bookShortName="गीता"
,isDeleted=False)

gita4.save()

Traceback (most recent call last):

  File "", line 1, in 

  File "C:\py\lib\site-packages\django\db\models\base.py", line 546, in save

force_update=force_update, update_fields=update_fields)

  File "C:\py\lib\site-packages\django\db\models\base.py", line 650, in
save_base

result = manager._insert([self], fields=fields, return_id=update_pk,
using=using, raw=raw)

  File "C:\py\lib\site-packages\django\db\models\manager.py", line 215, in
_insert

return insert_query(self.model, objs, fields, **kwargs)

  File "C:\py\lib\site-packages\django\db\models\query.py", line 1661, in
insert_query

return query.get_compiler(using=using).execute_sql(return_id)

  File "C:\py\lib\site-packages\django\db\models\sql\compiler.py", line
937, in execute_sql

cursor.execute(sql, params)

  File "C:\py\lib\site-packages\django\db\backends\util.py", line 41, in
execute

return self.cursor.execute(sql, params)

  File "C:\py\lib\site-packages\django\db\backends\mysql\base.py", line
120, in execute

return self.cursor.execute(query, args)

  File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 204, in execute

if not self._defer_warnings: self._warning_check()

  File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 117, in
_warning_check

warn(w[-1], self.Warning, 3)

Warning: Incorrect string value: '\xE0\xA4\xB6\xE0\xA5\x8D...' for column
'bookName' at row 1


On Fri, Apr 12, 2013 at 9:26 PM, Anshum Verma wrote:

>  Utf8 is default support in django unless you are explicitly typecasting
> to str. Please provide details of traceback and code snippets to debug this.
>
>
> Sent from my Windows Phone
>  --
> From: sastry mln 
> Sent: ‎12-‎04-‎2013 17:29
> To: django-users@googlegroups.com
> Subject: Unable to storing unicode data using django
>
> Hi All,
>   I have a mysqldb with utf8 charset and utf8_general_ci collation. The
> tables are also explicity defined to use the same charset/collation
>   I have a django model with CharField.
>   I want to store unicode characters (hindi language chars)
>   when i tested the model form django admin shell, I got error saying that
> the character is unrecognised.
>
>   I read the unicode section of the documenation, but i did not understand
> clearly.
>
>   can someone please post a snippet about how to let the web application
> allow unicode data entry using  (A) from django shell (b) From the data
> entry screen created through the modelAdmin forms
>
> regards
> mln
>
> --
> 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?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




RE: Unable to storing unicode data using django

2013-04-13 Thread Anshum Verma
  The issue is when you alter table all the columns switch to original
charset which is usually latin1. If you run the command show create table
mybooks you will be able to see that.

Sent from my Windows Phone
 --
From: mln sastry 
Sent: ‎13-‎04-‎2013 20:14
To: Anshum Verma 
Cc: django-users@googlegroups.com
Subject: Re: Unable to storing unicode data using django

Hi Anshum,

 At first I modified the db charset with below commands. It did not help.
ALTER DATABASE mybooks DEFAULT CHARACTER SET = 'utf8' DEFAULT COLLATE =
'utf8_general_ci'
ALTER TABLE   book  DEFAULT CHARACTER SET = 'utf8' COLLATE =
'utf8_general_ci'

 It worked after I tried this
 ALTER TABLE   book   *CONVERT TO CHARACTER SET* 'utf8' *COLLATE *
'utf8_general_ci'






On Sat, Apr 13, 2013 at 9:07 PM, Anshum Verma wrote:

>  This seems to be coming from MySQL . Can you check what is the default
> charset for the Book table in mysql and also that of the individual
> columns. You can share the output of show create table from mysql.
>
> Regards,
> Anshum
>
>
> Sent from my Windows Phone
>  ------
> From: mln sastry 
> Sent: ‎13-‎04-‎2013 11:07
> To: Anshum Verma 
> Cc: django-users@googlegroups.com
> Subject: Re: Unable to storing unicode data using django
>
>
>
> Hi Anshum,
>   Thank you for responding.
>   I defined a Book model as shown below and tried to save it from the
> admin shell.
>I am using python2.7.3 , django1.5, and python mysql driver 1.2.3.
>   I am not sure if my model data type is wrong or if any qualifier is
> missing. Please help.
>
>   I got this error:Warning: Incorrect string value:
> '\xE0\xA4\xB6\xE0\xA5\x8D...' for column 'bookName' at row 1"
>
> class *Book*(models.Model):
>
> bookId = models.AutoField(primary_key=True)
>
> bookName = models.TextField(max_length=200,null=False,)
>
> bookShortName = models.CharField(max_length=10,null=True,)
>
> isDeleted = models.NullBooleanField  (null=True,)
>
>
>
> gita4 = Book(bookName= "श्रीमद्भगवद्गीता",bookShortName="गीता"
> ,isDeleted=False)
>
> gita4.save()
>
> Traceback (most recent call last):
>
>   File "", line 1, in 
>
>   File "C:\py\lib\site-packages\django\db\models\base.py", line 546, in
> save
>
> force_update=force_update, update_fields=update_fields)
>
>   File "C:\py\lib\site-packages\django\db\models\base.py", line 650, in
> save_base
>
> result = manager._insert([self], fields=fields, return_id=update_pk,
> using=using, raw=raw)
>
>   File "C:\py\lib\site-packages\django\db\models\manager.py", line 215, in
> _insert
>
> return insert_query(self.model, objs, fields, **kwargs)
>
>   File "C:\py\lib\site-packages\django\db\models\query.py", line 1661, in
> insert_query
>
> return query.get_compiler(using=using).execute_sql(return_id)
>
>   File "C:\py\lib\site-packages\django\db\models\sql\compiler.py", line
> 937, in execute_sql
>
> cursor.execute(sql, params)
>
>   File "C:\py\lib\site-packages\django\db\backends\util.py", line 41, in
> execute
>
> return self.cursor.execute(sql, params)
>
>   File "C:\py\lib\site-packages\django\db\backends\mysql\base.py", line
> 120, in execute
>
> return self.cursor.execute(query, args)
>
>   File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 204, in execute
>
> if not self._defer_warnings: self._warning_check()
>
>   File "C:\py\lib\site-packages\MySQLdb\cursors.py", line 117, in
> _warning_check
>
> warn(w[-1], self.Warning, 3)
>
> Warning: Incorrect string value: '\xE0\xA4\xB6\xE0\xA5\x8D...' for column
> 'bookName' at row 1
>
>
> On Fri, Apr 12, 2013 at 9:26 PM, Anshum Verma wrote:
>
>>  Utf8 is default support in django unless you are explicitly typecasting
>> to str. Please provide details of traceback and code snippets to debug this.
>>
>>
>> Sent from my Windows Phone
>>  --
>> From: sastry mln 
>> Sent: ‎12-‎04-‎2013 17:29
>> To: django-users@googlegroups.com
>> Subject: Unable to storing unicode data using django
>>
>> Hi All,
>>   I have a mysqldb with utf8 charset and utf8_general_ci collation. The
>> tables are also explicity defined to use the same charset/collation
>>   I have a django model with CharField.
>>   I want to store unicode characters (hindi language chars)
>>   when i tested the model form django admin shell, I got error saying
>

RE: Unable to locate django-admin.py

2013-06-08 Thread Anshum Verma
  Hi,
It seems like a problem with your system PATH variable. Can you try
/usr/sbin/django-admin.py.

Regards,
Anshum
Sent from my Windows Phone
 --
From: Satinderjit Singh 
Sent: 08-06-2013 20:07
To: django-users@googlegroups.com
Subject: Unable to locate django-admin.py

I am beginner and trying to get start new project according to manual
I had installed the latest version of Django and currently using ubuntu
13.04 .
When i try to run django-admin.py startproject mysite

Terminal shows this error:
~$ django-admin.py startproject mysite
django-admin.py: command not found

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Chat application

2014-06-19 Thread Anshum Verma
I would suggest you to use Twisted along with Django. Django could serve as
MVC framework and twisted could take control of connection protocol.
On Jun 19, 2014 4:17 AM, "Pedro"  wrote:

> Hello,
>
> i'm working in a mobile app that depends of a Django server (to manage
> user data and stuff).
> This mobile app is about a social network with users interacting. It
> should have a chat system, where two or more users can send and receive
> messages and photos.
>
> I'm thinking in the best way to implement the communication and the model
> on the server. My first idea is to use a simple model with rooms and
> messages (each message belong to a room). To send messages from a client to
> the server, i think i could use http requests, like GETs and POSTs, where i
> would implement syncronization methods and stuff.
>
> Is this the best approach to solve this problem on Django?
>
>
> --
> Pedro Alves
>
> *Mestrando em Ciência da Computação*
> *Universidade Estadual de Campinas*
>
> --
> 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/CACW_pa0Dfom4Eydop5qedMMP5fbuBx-yZAUgDrhDApfewDFWbQ%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/CAMPe4x1g-WKZhbbq_Eo_p--DBZq5hqHU3i1ETM0Bwx-fFeQ4sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.