how to make serializers work with db.Model

2009-04-07 Thread Coonay

Background: code on google app engine using django framework,

 i persist data into  google data store(which is not a dbms),there is
an error of "django AttributeError:object has no attribute
'_meta'"  when  reading the queryset and decoding the queryset  using
djago json  serializers.

As you know , the  appengine_helper_for_django project can fit this
gap ,but its performance is very disappointed ,which always take near
1 second to finish its job.so there are 3 options :
1:optimize the helper(but it seems that project is not kind of active)
2:patch the django serializers
3:search a existed module which take cpu time blow 200MS

At present ,i prefer the option 2 and option 3,but i need your help to
get started .thanks you so much
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: wsgi.WSGIHandler:how to get a WebOb Request at first place

2009-04-06 Thread Coonay



On Apr 7, 12:54 pm, Graham Dumpleton 
wrote:
> On Apr 7, 2:33 pm, Coonay  wrote:
>
> > i want to get a WebOb Request ASAP when the WSGIHandler is called,such
> > as retrieve the SERVER_NAME and SERVER_PORT meta information from the
> > request,my stupid idea is in the line 261 of wsgi.py that add
> > following :
>
> >         server_name =  request.META['SERVER_NAME']
> >         if ( server_name is not None and server_name.startswith
> > ('localhost') ):
> >             settings.DEBUG = True
>
> > Could you tell me how to get a  WebOb Request at first place
> > correctlly?

Hi, Graham :


"Django creates an HttpRequest object that contains metadata about the
request. Then Django loads the appropriate view, passing the
HttpRequest as the first argument to the view function"

My question is  how to get the  http request object at first
place,then i can retrieve the meta
information  such as SERVER_NAME and SERVER_PORT from the request.

>
> If your intention is that different clients, based on how they connect
> to the server, ie., FQDN vs localhost, will conditionally determine
> whether debug is enabled or not, then do note that this scheme will


WSGIHandler  is instantiated per every http request,so i think it's
thread-safed,
why do u think it will fail?

> fail miserably if a multithreaded hosting mechanism is used. Your code
> is also not addressing how one would reset the value after a request
> even if a single threaded hosting mechanism was used.
>
> How about explain better what it is you want to achieve from doing
> this. Certain hosting mechanisms could achieve a separation without
> such a hack, but the question is why you would want to do it in the
> first place.
>
> Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



wsgi.WSGIHandler:how to get a WebOb Request at first place

2009-04-06 Thread Coonay

i want to get a WebOb Request ASAP when the WSGIHandler is called,such
as retrieve the SERVER_NAME and SERVER_PORT meta information from the
request,my stupid idea is in the line 261 of wsgi.py that add
following :

server_name =  request.META['SERVER_NAME']
if ( server_name is not None and server_name.startswith
('localhost') ):
settings.DEBUG = True


Could you tell me how to get a  WebOb Request at first place
correctlly?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: http 404 is replaced by http 500----------Django-1.0.2-final

2009-04-05 Thread Coonay



On Mar 14, 12:30 pm, Malcolm Tredinnick 
wrote:
> On Fri, 2009-03-13 at 21:27 -0700, Flank wrote:
> > in order to use django/conf/urls/defaults.py, handler404, i did 2
> > things:
> > 1:change DEBUG = False in settings.py
> > 2:create a 404.html template in the root of the template directory
>
> > when i request a page that won't find ,such 
> > ashttp://localhost/page_don_exist.html.a
> > http 500 error is reported,
>

expected:404 error
but a 500 error returned

INFO 2009-04-05 10:44:55,687 mail_stub.py]
MailService.SendToAdmins
INFO 2009-04-05 10:44:55,687 mail_stub.py]   From: r...@localhost
INFO 2009-04-05 10:44:55,687 mail_stub.py]   Subject: [Django]
Error (EXTER
AL IP): /dud8djdd7udududdu
INFO 2009-04-05 10:44:55,687 mail_stub.py]   Body:
INFO 2009-04-05 10:44:55,687 mail_stub.py] Content-type: text/
plain
INFO 2009-04-05 10:44:55,687 mail_stub.py] Data length: 2080
ERROR2009-04-05 10:44:55,687 main.py] Exception in request:
ImportError: No
module named auth.models
Traceback (most recent call last):
  File "D:\workspace\coonay\django\core\handlers\base.py", line 113,
in get_res
onse
    return callback(request, **param_dict)
  File "D:\python\coonay\src\django\views\defaults.py", line 79, in
page_not_fo
nd
return http.HttpResponseNotFound(t.render(RequestContext(request,
{'request
path': request.path})))
  File "D:\workspace\coonay\django\template\context.py", line 105, in
__init__
self.update(processor(request))
  File "D:\python\coonay\src\django\core\context_processors.py", line
23, in au
h
from django.contrib.auth.models import AnonymousUser
ImportError: No module named auth.models
INFO 2009-04-05 10:44:55,703 dev_appserver.py] "GET /
dud8djdd7udududdu HTTP
1.1" 500 -

> What does the traceback say? It will provide the clues as to what is
> going wrong.
>
> Regards,
> Malcolm

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: http 404 is replaced by http 500----------Django-1.0.2-final

2009-04-05 Thread Coonay

sory, there is a miss of the contrib.auth in my enviroment,which is
deleted by me when i setup,
now ,404 error can be return normally.

thank you all

On Mar 15, 8:21 am, Fergus  wrote:
> On 14 Mar, 04:30, Malcolm Tredinnick  wrote:
>
> > On Fri, 2009-03-13 at 21:27 -0700, Flank wrote:
> > > in order to use django/conf/urls/defaults.py, handler404, i did 2
> > > things:
> > > 1:change DEBUG = False in settings.py
> > > 2:create a 404.html template in the root of the template directory
>
> > > when i request a page that won't find ,such 
> > > ashttp://localhost/page_don_exist.html.a
> > > http 500 error is reported,
>
> As you've got DEBUG off, you won't see the traceback on screen. You
> need to make sure you've set ADMINS correctly, as in this case you
> normally get sent an email detailing what went wrong - as you'd see on-
> screen if DEBUG were True.
> 
>
> You might also want to check Django can send email successfully. There
> are a few settings you might need to tweak.
> 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: http 404 is replaced by http 500----------Django-1.0.2-final

2009-04-05 Thread Coonay



On Mar 15, 8:21 am, Fergus  wrote:
> On 14 Mar, 04:30, Malcolm Tredinnick  wrote:
>
> > On Fri, 2009-03-13 at 21:27 -0700, Flank wrote:
> > > in order to use django/conf/urls/defaults.py, handler404, i did 2
> > > things:
> > > 1:change DEBUG = False in settings.py
> > > 2:create a 404.html template in the root of the template directory
>
> > > when i request a page that won't find ,such 
> > > ashttp://localhost/page_don_exist.html.a
> > > http 500 error is reported,
>

Yes ,i cann't see the debug on screen, but in the console
> As you've got DEBUG off, you won't see the traceback on screen. You

the expected error should be page-not-found error/404,not 500 error,
a 500 eroor will trig django send a mail to the admin,
> need to make sure you've set ADMINS correctly, as in this case you
> normally get sent an email detailing what went wrong - as you'd see on-
> screen if DEBUG were True.
> 
>
> You might also want to check Django can send email successfully. There
> are a few settings you might need to tweak.
> 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---