Re: How can i transmit an objects in list?

2012-06-14 Thread huseyin yilmaz
You are probably getting this error because when you generate your list 
from categories. you are adding sub categories as list. so your list will 
be like following

[cat1,cat2,cat3,[subcat1,subcat2],[subcat3,subcat4]]

I think you want to use

list.extend(BuildList(category.childrens.all()))
so you will have a one flat list.


list.append(category) repeated twice itlookslike to me that you don't 
actualy need an if statement here.

def BuildList(categories):
list = []
for category in categories:
list.append(category)
list.extend(BuildList(category.childrens.all()))
return list

this method would run same queries.
,

You have a for template tag in django . You can use it instead of your 
custom filter.

Lastly please check this https://github.com/django-mptt/django-mptt

this is great for categories. this is good for keeping trees in relational 
databases. when you query sub trees, it will do exactly one query every 
time.
and there is a generic category app too if you need.

https://github.com/callowayproject/django-categories

I hope that helps.







On Thursday, June 14, 2012 9:44:50 AM UTC+3, Dominis wrote:
>
> Hello. 
> I need a bit help with my code.
> I write a function for menu building, which should create a list of 
> objects, for designing it in html code.
> Code of function below:
>
>> def BuildList(categories):
>> list = []
>> for category in categories:
>> if len(category.childrens.all()):
>> list.append(category)
>> list.append(BuildList(category.childrens.all()))
>> else :
>> list.append(category)
>> return list
>>
>  
> I call this function for a list of categories, like this:
>
>> list = BuildList(Categories.objects.filter(parent = None))
>>
> My function work right, but in list i get not an objects, my values have 
> only name of a categories. I thought it happens couse in my Category model 
> in __unicode__  function i place a 'return self.name', and when i call my 
> categories in function - it return just name. :(
> What i should do for get full objects in my list? With full collection of 
> parameters.
> I suppose this question is easy, but i just start to learn python and 
> django.
> Thx for you time and answers.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/dDbJWAC6Xo8J.
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: django 1.4 : gunicorn can't find static files. settings option

2012-05-15 Thread huseyin yilmaz
For development, you could add this to main urls.py like this.
(r'^static/(?P.*)$', 'django.views.static.serve',
{'document_root': settings.STATIC_ROOT, 'show_indexes':True}),

But for production use your web server to serve static files.

At least this is how I solved it. I hope that helps.

On May 16, 5:56 am, Bolang  wrote:
> Hi,
> I just started to using django 1.4 with gunicorn 0.14.3
> With ./manage.py runserver , i can start django properly and django can
> find my files in static directory.
> Then i use gunicorn and then gunicorn can't find my files in static
> directory.
>
> I have tried these combination
> gunicorn myproject.wsgi:application --settings myproject.settings
> gunicorn myproject.wsgi:application --settings /absolute/path/to/settings.py
> ./manage.py run_gunicorn --settings=myproject.settings
>
> All of the commands can start django, but can't find my files in static
> directory
>
> I also found this issuehttps://github.com/benoitc/gunicorn/issues/322
> But, i can't find the solution from that page.
>
> Any kind of help will be appreciated
>
> Thanks

-- 
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: collectstatic missing on Linux

2012-01-09 Thread huseyin yilmaz
This is why linux is the best os. If anything goes wrong, you can
blame it on linux :)

1) make sure you are really using django1.4a in server (from django
import VERSION). maybe you installed multiple versions of django and
using the wrong one (you might have 1.2.x on system and 1.4a on
virtualenv and might be using the wrong one.)
2) check your settings.py file. You might have windows specific paths
on your settings.py file (PROJECT_ROOT)

I hope that helps.


On Jan 10, 1:22 am, Mike Dewhirst  wrote:
> The manage.py collectstatic subcommand doesn't exist on my Linux staging
> server but it does exist (and works) on my Win XP development machine.
> I'm using exactly the same settings.py on both machines.
>
> On Linux, in a Python interpreter I can do ...
>
>  >>>from django.contrib import staticfiles
>  >>>
>
> ... but when I type
>
> $/usr/bin/python /srv/www/proj/manage.py help
>
> ... it returns a list of available subcommands[1] without collectstatic
> in the list.
>
> Win XP 32-bit
> Python 2.7
> Django 1.4a
>
> Linux 64-bit
> Python 2.6
> Django 1.4a
>
> The application itself runs under Apache on the Linux staging server if
> I manually copy all the static files to the STATIC_ROOT directory.
>
> Any hints appreciated
>
> Thanks
>
> Mike
>
> [1]
> Available subcommands:
>    cleanup
>    compilemessages
>    createcachetable
>    dbshell
>    diffsettings
>    dumpdata
>    flush
>    inspectdb
>    loaddata
>    makemessages
>    reset
>    runfcgi
>    runserver
>    shell
>    sql
>    sqlall
>    sqlclear
>    sqlcustom
>    sqlflush
>    sqlindexes
>    sqlinitialdata
>    sqlreset
>    sqlsequencereset
>    startapp
>    startproject
>    syncdb
>    test
>    testserver
>    validate

-- 
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: Interface implementation in python

2012-01-04 Thread huseyin yilmaz
I Checked the zope.interface implementation. It seems like this one
does not do any validation at all. consider folowing code

from zope import interface


class IBase(interface.Interface):
def my_method(self):
pass


class Child():
interface.implements(IBase)

if __name__ == '__main__':
print IBase.implementedBy(Child)  # returns True


Here I implement a IBase Interface that has "my_method". Then I wrote
a Child class to use this interface but I don't have my_method inside
Child method. With abc implementation I at least have an error for
that design mistake. but I don't get this error in zope version.

On Jan 4, 2:49 pm, Thomas Weholt  wrote:
> He probably meant zope.interface :-)
>
> Regards,
> Thomas
>
>
>
>
>
>
>
>
>
> On Wed, Jan 4, 2012 at 1:47 PM, huseyin yilmaz  
> wrote:
> > Could you direct me to an example (or documentation). I could not find
> > any source about zone.interface.
>
> > On Jan 4, 2:17 pm, Donald Stufft  wrote:
> >> Why not use zone.interface
>
> >> On Wednesday, January 4, 2012 at 7:07 AM, huseyin yilmaz wrote:
> >> > Hi everybody,
>
> >> > I want to implement interface functionality in python. I wrote
> >> > following sample code
>
> >> >https://gist.github.com/1559689
>
> >> > Here I use an abc as an interface.
> >> > Couple of my models are implementing this interface and one of my
> >> > consumer model is using those models. In this implementation, I use my
> >> > abstract class to check if my models are implementing enough
> >> > functionality to make consumer model methods work (use_object method).
>
> >> > Since I used abc's here, I get an error as soon as I try to
> >> > instantiate a model object. (I do not need to invoke use_object method
> >> > for validation to work.)
>
> >> > Question 1) Is there a better way to implement this validation
> >> > functionality.
> >> > Question 2) In this implementation, Validation happens at object
> >> > instantiation time. Which means If I don't instantiate any object I
> >> > won't get any error, Is there a ( short ) way of getting this check on
> >> > code initialization? ( I am not dynamicly changing methods of my
> >> > models)
>
> >> > --
> >> > 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 
> >> > (mailto:django-users@googlegroups.com).
> >> > To unsubscribe from this group, send email to 
> >> > django-users+unsubscr...@googlegroups.com 
> >> > (mailto:django-users+unsubscr...@googlegroups.com).
> >> > For more options, visit this group 
> >> > athttp://groups.google.com/group/django-users?hl=en.
>
> > --
> > 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 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Mvh/Best regards,
> Thomas Weholthttp://www.weholt.org

-- 
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: Interface implementation in python

2012-01-04 Thread huseyin yilmaz
Could you direct me to an example (or documentation). I could not find
any source about zone.interface.

On Jan 4, 2:17 pm, Donald Stufft  wrote:
> Why not use zone.interface
>
>
>
>
>
>
>
> On Wednesday, January 4, 2012 at 7:07 AM, huseyin yilmaz wrote:
> > Hi everybody,
>
> > I want to implement interface functionality in python. I wrote
> > following sample code
>
> >https://gist.github.com/1559689
>
> > Here I use an abc as an interface.
> > Couple of my models are implementing this interface and one of my
> > consumer model is using those models. In this implementation, I use my
> > abstract class to check if my models are implementing enough
> > functionality to make consumer model methods work (use_object method).
>
> > Since I used abc's here, I get an error as soon as I try to
> > instantiate a model object. (I do not need to invoke use_object method
> > for validation to work.)
>
> > Question 1) Is there a better way to implement this validation
> > functionality.
> > Question 2) In this implementation, Validation happens at object
> > instantiation time. Which means If I don't instantiate any object I
> > won't get any error, Is there a ( short ) way of getting this check on
> > code initialization? ( I am not dynamicly changing methods of my
> > models)
>
> > --
> > 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 
> > (mailto:django-users@googlegroups.com).
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com 
> > (mailto:django-users+unsubscr...@googlegroups.com).
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.

-- 
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.



Interface implementation in python

2012-01-04 Thread huseyin yilmaz
Hi everybody,

 I want to implement interface functionality in python. I wrote
following sample code

https://gist.github.com/1559689

Here I use an abc as an interface.
Couple of my models are implementing this interface and one of my
consumer model is using those models. In this implementation, I use my
abstract class to check if my models are implementing enough
functionality to make consumer model methods work (use_object method).

Since I used abc's here, I get an error as soon as I try to
instantiate a model object. (I do not need to invoke use_object method
for validation to work.)

Question 1) Is there a better way to implement this validation
functionality.
Question 2) In this implementation, Validation happens at object
instantiation time. Which means If I don't instantiate any object I
won't get any error, Is there a ( short ) way of getting this check on
code initialization? ( I am not dynamicly changing methods of my
models)


-- 
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: How to add a ManyToManyField "dynamically" to a model?

2011-12-20 Thread huseyin yilmaz
Generic forign key might help you
https://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/#django.contrib.contenttypes.generic.GenericForeignKey
You might not even need a metadata here.(The metadata you need looks
like ContentType model)

Just do

class GenericManyToManyDetail(Model)
ct1 = ...
object_id2 = 
firstModel = GenericForeignKey()

ct2 = ...
object_id2 = ..
secondModel = GenericForeignKey()

This table can represent any many to many relation you want.

Or you could just use django-generic-m2m

https://github.com/coleifer/django-generic-m2m

On Dec 20, 12:58 pm, Hanne Moa  wrote:
> I have some apps app1, app2, .. appN and a special app for metadata.
> The model metadata.Metadata should have ManyToManyFields to models (to
> primary key, nothing fancy) in some of the other apps. I don't want to
> have to update the models of the existing apps and the apps/models
> shouldn't be hard-coded in the metadata-app in any way.
>
> Now, one way I want very much to avoid is to make another app, let's
> call it "glue", that hardcodes one model per wanted ManyToManyField
> like so:
>
> class GlueModel1Metadata(Model):
>     model1 = ManyToManyField(Model1)
>     metadata =  ManyToManyField(Metadata)
>
> I've figured out how to "dynamically" create a Through-style model
> (like the above) but I don't want them to be Through-style models.
> (Dynamically is in quotes because I don't need to make tables at
> runtime. Making them up front through syncdb is fine.)
>
> Instead I'd rather register the models that need a manytomany to
> Metadata and create all the connection tables in one fell swoop, via
> syncdb, so I get that bit out of the way.
>
> But... I'm stumped. The examples from AuditTrail at the wiki and the
> revision history stuff in Pro Django is for full-blown models, not
> ManyToMany tables. Besides, the models that are to use the audit
> trail/history have that fact hardcoded in.
>
> HM . o 0 ( monkey patch! )

-- 
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: Urgent: django app got internal error: TemplateDoesNotExist: 500.html

2011-12-19 Thread huseyin yilmaz
It looks to me like you do not have 500.html file in your base
template directory. If you have a server error in production mode
(DEBUG = False), django will show 500.html to users. So users will not
see actual error message. But you will get that message by email.
Since you do not have 500.html it gives you template does not exist
error instead of actual error message. This will not help you to solve
your problem, but at least it will help you identify it.

On Dec 19, 9:24 pm, Ashkan Roshanayi 
wrote:
> I tried to live edit base.py template but now my app has internal error. I
> undo the changes but still get 500 error while accessing website. Tail -f
> of my application_name.log shows:
>
>
>
>
>
>
>
>
>
>
>
> >   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py",
> > line 108, in __init__
> >     self.nodelist = compile_string(template_string, origin)
> >   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py",
> > line 136, in compile_string
> >     return parser.parse()
> >   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py",
> > line 237, in parse
> >     self.invalid_block_tag(token, command, parse_until)
> >   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/base.py",
> > line 291, in invalid_block_tag
> >     raise self.error(token, "Invalid block tag: '%s'" % command)
> > TemplateSyntaxError: Invalid block tag: '%20get_static_prefix%20'
>
> And tail -f of error.log shows:
>
> [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]     return
>
>
>
>
>
>
>
>
>
> > callback(request, **param_dict), referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/utils/decorators.py",
> > line 93, in _wrapped_view, referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]     response =
> > view_func(request, *args, **kwargs), referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/views/defaults.py",
> > line 30, in server_error, referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]     t =
> > loader.get_template(template_name) # You need to create a 500.html
> > template., referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py",
> > line 157, in get_template, referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]     template,
> > origin = find_template(template_name), referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/template/loader.py",
> > line 138, in find_template, referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]     raise
> > TemplateDoesNotExist(name), referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:28 2011] [error] [client 188.158.186.121]
> > TemplateDoesNotExist: 500.html, referer:
> >http://go.madmimi.com/redirects/5e9c3ec9b21e58257eadd15120210f5c?pa=6...
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] mod_wsgi
> > (pid=2688): Exception occurred processing WSGI script
> > '/home/jalala/projects/Hamkharid/bin/django.wsgi'.
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206] Traceback
> > (most recent call last):
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/core/handlers/wsgi.py",
> > line 272, in __call__
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206]     response =
> > self.get_response(request)
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.1-py2.7.egg/django/core/handlers/base.py",
> > line 169, in get_response
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206]     response =
> > self.handle_uncaught_exception(request, resolver, sys.exc_info())
> > [Mon Dec 19 13:22:55 2011] [error] [client 109.125.144.206]   File
> > "/home/jalala/projects/Hamkharid/eggs/Django-1.3.

Re: Which IDE should I use for Django?

2011-12-19 Thread huseyin yilmaz
I was going to say emacs, but since you also use windows, Aptana would
be a better fit.


On Dec 19, 12:34 pm, Alec Taylor  wrote:
> I'm looking for a Django IDE which incorporates the following features:
> - Syntax-highlighting
> - Projects (all code file of the project shown separated by directory
> in a sidebar)
> - Tabs (with close buttons on tab)
> - Code-completion (with good introspection)
> - Text-zoom support
> - Start/stop Django server
> - Run+restart Django server shell (manage.py shell) in project (i.e. below 
> code)
>
> I program on Windows and Linux, so it would be great if the IDE is
> supported on both platforms.
>
> Previously I was using Editra, but I requested an automatic import
> into embedded interpreter feature in April, which they still haven't
> integrated. So I am looking at alternatives :)
>
> Thanks for all suggestions,
>
> Alec Taylor

-- 
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: slow function

2011-12-05 Thread huseyin yilmaz
With select related, hole queries can be ommitted but this time for
every score object one hole object will be created. so there will be
alot of hole objects.

On Dec 5, 12:18 pm, Håkon Erichsen  wrote:
> 2011/12/5 kenneth gonsalves 
>
> >  The code looks simple to me, but to analyse 10,000 rounds of golf
> > (1,80,000 hole scores) my 2 GB laptop takes 20 minutes. Would this be
> > considered normal - or slow? If slow, ideas on how to speed it up would be
> > appreciated.
>
> One thing you should look into is 
> QuerySet.select_related():https://docs.djangoproject.com/en/dev/ref/models/querysets/#select-re...
>
> Without it, every time you run scr.hole on a new scr, Django will run a new
> query, fetching that 'hole' object. If you have 10 000 scores, that means
> 10 000 queries, which is an insane number for queries like this. If you use
> select_related, Django will fetch the corrosponding hole for you, in the
> same query... meaning 1 query, instead of 10 000 :)
>
> In other words, change this:
>
>     scrs = Score.objects.all()    pscrs =
> Pscore.objects.filter(hole__tee__course = club)
>
> To this:
>
>     scrs = Score.objects.all().select_related('hole')    pscrs =
> Pscore.objects.filter(hole__tee__course = club).select_related('hole')
>
> That seems to be the biggest problem you have. Some other comments:
>
> - Holy mother of god, that's a huge view file! I would advice to slice
> it into logically separated files, and put this in a directory called
> "views", everything doesn't have to be in views.py!
>
> - Put your forms in another file, like forms.py
>
> - If you're just checking if someone is logged in with
> @user_passes_test, why not just use @login_required?
>
> - Check out 
> render:https://docs.djangoproject.com/en/dev/topics/http/shortcuts/#render
>
> Best regards,
>
> Håkon Erichsen

-- 
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: slow function

2011-12-05 Thread huseyin yilmaz
First of all You are queryin everything that you have on database for
this view and making django model objects from those. For a large db
this will run very slow and for larger dbs, it will throw memmory
exception.
Try something like this:
for hole in Hole.objects.filter(tee_course=club):
...
for score in Score.objects.filter(hole = hole)
   
for pscore in PScore.objects.filter(hole=hole)
   


With this setup you will get your memmory footprint alot smaller. and
it will run alot faster that way. and you will get rid of queries that
come from score.hole as well .

You can use values_list method to get even faster code.

Note : for more tips http://goo.gl/TMnPc
On Dec 5, 11:56 am, kenneth gonsalves  wrote:
> I have a function called holediff - the code is here:
>
> https://bitbucket.org/lawgon/djangogolf/src/a86c388f1795/web/views.py... analyses
>  golf scores and calculates the relative difficulty of the holes. The code 
> looks simple to me, but to analyse 10,000 rounds of golf (1,80,000 hole 
> scores) my 2 GB laptop takes 20 minutes. Would this be considered normal - or 
> slow? If slow, ideas on how to speed it up would be appreciated.
> --
> regards
> Kenneth Gonsalves

-- 
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: Pointing to Memcached on Remote Server

2011-12-03 Thread huseyin yilmaz
Also check memcached configuration (/etc/memcached.conf)
from this file,you can limit IP addresses that memcached listening to
here is a configuration parameter that you might have

# Specify which IP address to listen on. The default is to listen on
all IP
addresses
# This parameter is one of the only security measures that memcached
has, so make
sure
# it's listening on a firewalled
interface.
#-l 127.0.0.1


On Dec 2, 3:49 am, mattym  wrote:
> Hi all -
>
> I am stuck on this one. Caching with memcached works when I reference
> the local box holding Django. But when I point my setting to a remote
> box it does not cache:
>
> This is with Django 1.3 using python-memcached on the localbox in a
> virtualenv
>
>  'default': {
>         'BACKEND':
> 'django.core.cache.backends.memcached.MemcachedCache',
>         #'LOCATION': ['127.0.0.1:11211',]  # This works
>         'LOCATION': ['xx.xxx.xxx.xx:11211',]  # This remote one does not
>     }
>
> My settings file appears to have the proper middleware installed:
>
>  "django.middleware.gzip.GZipMiddleware",
>   "django.middleware.cache.UpdateCacheMiddleware",
>     "django.contrib.sessions.middleware.SessionMiddleware",
>     "django.contrib.auth.middleware.AuthenticationMiddleware",
>     "django.contrib.redirects.middleware.RedirectFallbackMiddleware",
>     "mezzanine.core.middleware.DeviceAwareUpdateCacheMiddleware",
>     "django.middleware.common.CommonMiddleware",
>     "django.middleware.csrf.CsrfViewMiddleware",
>     "mezzanine.core.middleware.DeviceAwareFetchFromCacheMiddleware",
>     "mezzanine.core.middleware.AdminLoginInterfaceSelector",
>     "django.middleware.cache.FetchFromCacheMiddleware",
>
> I've checked that memcached is running on the remote box. I am
> probably overlooking something simple.
> Any help is greatly appreciated.
>
> Thanks,
> Matt

-- 
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.