Django's regular-expression based URL dispatcher is designed to do
this directly; and you might want to use a model (database table) for
each of your lookups.  The third part of the tutorial [1] addresses
this.

[1] https://docs.djangoproject.com/en/dev/intro/tutorial03/

On Nov 29, 3:30 am, Nolhian <eldur...@hotmail.com> wrote:
> Hello,
>
> I've got a view associated with a lot of urls which have 2 variables
> ( like /computer/keyboard, /animal/dog and so on ). I thought of doing
> a regex like [a-z]/a-z]/$  and make 2 lists or dicts at the beginning
> of the view and check if the 2 variables are in these dicts or respond
> with a 404 error page. Obviously it will be huge dicts let's say 100
> keys for the first and maybe 50 for the second one. Is it the best way
> to go ?  Won't it be slow / consume a lot of ram ( because of the
> dicts )  if a lot of people  are viewing the pages simultaneously ?
>
> Thanks,
> Nolhian

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

Reply via email to