Re: memcached

2008-07-09 Thread gt7658b

The  previous information was not accurate. Actually it works fine
with firefox, but cause apache 500 error on IE.

On Jul 9, 9:28 pm, gt7658b <[EMAIL PROTECTED]> wrote:
> Thanks for the help, I was able to make it work. It was due to the
> fact that memcache.py was not under PYTHONPATH.
>
> There is still one puzzle. As suggested by you, CacheMiddleware should
> come before SessionMiddleware (also recommended by the django doc.).
> If I do that as follow, I will get an apache internal server error.
>
> //this order did not work
> MIDDLEWARE_CLASSES = (
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.cache.CacheMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.doc.XViewMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
> )
>
> //this works
> MIDDLEWARE_CLASSES = (
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.doc.XViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.middleware.cache.CacheMiddleware',
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
> )
>
> On Jul 9, 12:19 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote:
>
> > gt7658b wrote:
> > > Hello, I tried to use memcached as follow. BTW, memcached is running
> > > as seen from top command on server.
>
> > > CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
> > > # CACHE_BACKEND = 'dummy:///'
> > > CACHE_MIDDLEWARE_SECONDS = 60*30
> > > CACHE_MIDDLEWARE_KEY_PREFIX =''
> > > CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
>
> > > MIDDLEWARE_CLASSES = (
> > > 'django.contrib.sessions.middleware.SessionMiddleware',
> > > 'django.middleware.doc.XViewMiddleware',
> > > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > > 'django.middleware.cache.CacheMiddleware',
> > > 'django.middleware.common.CommonMiddleware',
> > > 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
> > > )
>
> > > However, I got 500 error. If I switch to CACHE_BACKEND = 'dummy:///',
> > > our web site worked just fine.
>
> > CacheMiddle ware should come before 
> > SessionMiddlewarehttp://www.djangoproject.com/documentation/cache/#order-of-middleware...
>
> > Is the 500 from Django builtin server or from some other server?
>
> > Do you have debugging and what not turned on? you should be getting more
> > info(traceback) than just a 500.
>
> > Have you read and understood the requirements for using memcached with
> > Djangohttp://www.djangoproject.com/documentation/cache/#memcached
>
> > Have you tried using python memcached libs by hand in Python shell or
> > writing little test scripts not using Django?
>
> > You have provided too little information for anyone to tell you what is
> > wrong.  But with the above information and a little investigation you
> > should be able to figure it out on your own :)
>
> > --
> > Norman J. Harman Jr.
> > Senior Web Specialist, Austin American-Statesman
> > ___
> > You've got fun!  Check out Austin360.com for all the entertainment
> > info you need to live it up in the big city!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: memcached

2008-07-09 Thread gt7658b

Thanks for the help, I was able to make it work. It was due to the
fact that memcache.py was not under PYTHONPATH.

There is still one puzzle. As suggested by you, CacheMiddleware should
come before SessionMiddleware (also recommended by the django doc.).
If I do that as follow, I will get an apache internal server error.

//this order did not work
MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)


//this works
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)



On Jul 9, 12:19 pm, "Norman Harman" <[EMAIL PROTECTED]> wrote:
> gt7658b wrote:
> > Hello, I tried to use memcached as follow. BTW, memcached is running
> > as seen from top command on server.
>
> > CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
> > # CACHE_BACKEND = 'dummy:///'
> > CACHE_MIDDLEWARE_SECONDS = 60*30
> > CACHE_MIDDLEWARE_KEY_PREFIX =''
> > CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True
>
> > MIDDLEWARE_CLASSES = (
> > 'django.contrib.sessions.middleware.SessionMiddleware',
> > 'django.middleware.doc.XViewMiddleware',
> > 'django.contrib.auth.middleware.AuthenticationMiddleware',
> > 'django.middleware.cache.CacheMiddleware',
> > 'django.middleware.common.CommonMiddleware',
> > 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
> > )
>
> > However, I got 500 error. If I switch to CACHE_BACKEND = 'dummy:///',
> > our web site worked just fine.
>
> CacheMiddle ware should come before 
> SessionMiddlewarehttp://www.djangoproject.com/documentation/cache/#order-of-middleware...
>
> Is the 500 from Django builtin server or from some other server?
>
> Do you have debugging and what not turned on? you should be getting more
> info(traceback) than just a 500.
>
> Have you read and understood the requirements for using memcached with
> Djangohttp://www.djangoproject.com/documentation/cache/#memcached
>
> Have you tried using python memcached libs by hand in Python shell or
> writing little test scripts not using Django?
>
> You have provided too little information for anyone to tell you what is
> wrong.  But with the above information and a little investigation you
> should be able to figure it out on your own :)
>
> --
> Norman J. Harman Jr.
> Senior Web Specialist, Austin American-Statesman
> ___
> You've got fun!  Check out Austin360.com for all the entertainment
> info you need to live it up in the big city!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



memcached

2008-07-08 Thread gt7658b

Hello, I tried to use memcached as follow. BTW, memcached is running
as seen from top command on server.

CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
# CACHE_BACKEND = 'dummy:///'
CACHE_MIDDLEWARE_SECONDS = 60*30
CACHE_MIDDLEWARE_KEY_PREFIX =''
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

However, I got 500 error. If I switch to CACHE_BACKEND = 'dummy:///',
our web site worked just fine.

I wonder if anyone has any clues about this issue.

Thanks,
Harry
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



memcached

2008-07-08 Thread gt7658b

Hello, I tried to use memcached as follow. BTW, memcached is running
as seen from top command on server.

CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
# CACHE_BACKEND = 'dummy:///'
CACHE_MIDDLEWARE_SECONDS = 60*30
CACHE_MIDDLEWARE_KEY_PREFIX =''
CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True

MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

However, I got 500 error. If I switch to CACHE_BACKEND = 'dummy:///',
our web site worked just fine.

I wonder if anyone has any clues about this issue.

Thanks,
Harry
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: two questions about data model

2007-09-15 Thread gt7658b

Thank you, guys.

for the charfield question, what I am trying to modify is the backend.
So I need to change django.contrib.admin.views.main.add_stage? and
also change_stage function?

I don't know how to change that function. Is there a way to do it
during model definition?

Thanks,
Harry


On Sep 15, 6:38 pm, r_f_d <[EMAIL PROTECTED]> wrote:
> for the charfield there is a max_length, but for what you are trying
> to do, you need to set this in the form widget.  Take a look at
> newforms documentation but to point you in the right direction you
> need to do something like:
> where f is your form
> f.base_fields['FIELDNAME'].widget.attrs = {'size' : 500}
> which will set the FIELDNAME input with 500 columns
>
> for the imagefile entered by it should be
> entered_by = models.ForeignKey(User, related_name = 'user_entered') or
> whatever you want to call it.
> -richard
>
> On Sep 15, 12:49 pm, Hai Dong <[EMAIL PROTECTED]> wrote:
>
> > Hello:
>
> > I am trying to control the html display size of a CharField using length
> > keyword. However, I got the following error when doing syncdb
>
> > __init__() got an unexpected keyword argument 'length'
>
> > I am using django svn release. I didn't find length keyword in django
> > document, but learned it from the django usergroup.
>
> > Another question is in my data model I have
> > entered_by = models.ForeignKey(User)
>
> > when doing syncdb I got the following where imagefile is a table name.
> > Accessor for field 'entered_by' clashes with related field
> > 'User.imagefile_set'. Add a related_name argument to the definition for
> > 'entered_by'.
>
> > Thanks,
> > Harry


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: multi level category table with parent_id field

2007-08-15 Thread gt7658b

Thanks, it worked.

On Aug 13, 1:31 am, Nicola Larosa <[EMAIL PROTECTED]> wrote:
> Hai Dong wrote:
> > I was wondering how to use django to achieve the following application.
> > Suppose my articles are organized in categories, subcategories, and
> > subsubcategories. Database wise it will be good to have a category table
> > with a parent_id referring to itself. I don't know how to achieve this
> > by django database model, and also the __unicode__(self) function.
>
> Try this:
>
> http://code.djangoproject.com/wiki/CookBookCategoryDataModelPostMagic
>
> --
> Nicola Larosa -http://www.tekNico.net/
>
> Being online demands a tremendous amount of discipline. You must shut
> out the world around you and focus exclusively on a glowing screen.
> You must sit in a chair for hours on end and will your body to remain
> still. You are at an altar, but you are both priest and supplicant.
>  -- Scott Jason Cohen, July 2000


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: a question about site framework

2007-08-01 Thread gt7658b

Kai:

I was worrying about how to use the django database api to do site
related queries. I mean how do I simply retrieve articles of a site
without having to use the custom query.

Harry

On Aug 1, 9:36 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> Hi Harry,
>
> On 8/2/07, gt7658b <[EMAIL PROTECTED]> wrote:
>
>
>
> > Kai:
>
> > Thanks for the suggestions. In this case, my Article will have
> > relationship with category, not directly withsite. Will I still be
> > able to take advantage of the functions ofsiteframework?
>
> I don't understand you (well, it's late.. maybe that's the reason).
> Your articles have a realtionship with a category and a
> category belongs to one-or-more sites. Isn't that what you
> wanted?
>
> Kai


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: a question about site framework

2007-08-01 Thread gt7658b

Kai:

Thanks for the suggestions. In this case, my Article will have
relationship with category, not directly with site. Will I still be
able to take advantage of the functions of site framework?

Harry

On Jul 31, 9:45 pm, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:
> ManyToManyField maybe is way better. Sorry, its late.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---