Re: search across models

2013-02-03 Thread Ashwin Kumar
thank you dennis,

what you suggested is a difficult process where we need to look into
performance its the query gets more complex and database gets bigger which
is obvious.

but its a good idea. i will try that for a while.

With Best
-Ashwin.
+91-9959166266


On Sun, Feb 3, 2013 at 11:54 PM, Dennis Lee Bieber wrote:

> On Sun, 3 Feb 2013 13:11:55 +0530, Ashwin Kumar 
> declaimed the following in gmane.comp.python.django.user:
>
> > thank you joey,
> >
> > but i want to build search for queries like
> >
> >
> >1. restaurants in city1
> >2. city1 restaurants
> >3. Chinese restaurants
> >4. Chinese restaurants in city1
> >5. vegetarian restaurants in city1
> >6. vegetarian american restaurants
> >
> > the above are exact search queries we get from template.
> > i wrote
> > restas = restaurant.objects.filter(Q(name__contains =
> > request.REQUEST.get('title')) & ~Q(city__name='') )
> > this works fine to search with restaurant name.
> >
> >  i really have no idea on how to get results if the search phrase is
> > complex.
> >
> I've not been following, and don't know the schema, but for such
> searches I suspect you'll have to bypass Django's ORM and go to direct
> SQL...
>
> You'd split the search on words, skip the noise terms ("in", "and",
> "the", etc.), and then create a select statement in which you've created
> a test for each remaining word:
>
> select ... from ...
> where field contains  and field contains  and ...
>
> If you have two (or more) fields that need to be matched, it gets
> more complex (unless you build a separate index containing terms from
> all relevant fields).
> --
> Wulfraed Dennis Lee Bieber AF6VN
> wlfr...@ix.netcom.comHTTP://wlfraed.home.netcom.com/
>
> --
> 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: How is fatcow for django hosting?

2013-02-03 Thread Ashwin Kumar
i use amazon. its easy, fast, cheap, with full controll.

this month my bill is 0$ as its free for 1yr

With Best
-Ashwin.
+91-9959166266


On Sat, Feb 2, 2013 at 11:16 AM, Mike  wrote:

> I have been shopping for hosting for my project too (in my case a hobby
> project that I will monetize ).  I don't know anything about Fat Cow but
> many hosts will give you shell access and let you host django powered
> sites.  What most won't do is let you run long running background processes
> such as celery queues.  For my project I might be able to get by for a
> while by running the background process with cron.  If that's the case for
> you then make sure your host gives you access to cron.  I'd be interested
> to know if anyone else is using shared hosting for their Django projects.
>  I can afford to get a VPS but I don't want to admin my own server
> unless/until its really necessary.  Now I'm using A Small Orange. Great
> support.
>
> --
> 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: Automating deployments

2013-02-03 Thread Ashwin Kumar
thats so kind of you, i struggled a lot for 1 month to setup a server
(ubuntu+nginx+uWSGI+mysql+pil+virtualenv+emperor).
still i didn't succeed running emepror on system restart, i removed
virtualenv as i got python-mysqldb error.

let me know if you finish it.

With Best
-Ashwin.
+91-9959166266


On Sat, Feb 2, 2013 at 6:23 AM, Brian Schott  wrote:

> We are using ansible.
> http://ansible.cc/
>
> Other popular choices are puppet and chef.  The real benefit. Is that
> these tools let you version control your configurations.
>
> Sent from my iPhone
>
> On Feb 1, 2013, at 7:46 PM, Carlos Aguilar  wrote:
>
>  Bash scripts really???
>
> If you are a Python developer you can use fabric to deployed and pip for
> dependencies.
>
> Best Regards
>
> El viernes, 1 de febrero de 2013, Marc Aymerich escribió:
>
>> Hi,
>> I'm thinking about the best way to provide automatic deployment for
>> the Django project I'm working on. Its a pretty big one and has lots
>> of dependencies, lots of SO packages, Celeryd and other daemons, SO
>> tweaks... and also several people will need to have installed it on
>> their servers (they are sysadmins, not Django developers), Therefore I
>> want to automate as much as possible the installation and updating
>> processes, to minimize their pain and also because of having
>> homogeneity.
>>
>> As I've been a sysadmin myself for many years I've already written
>> some bash scripts that automates all the deployment. But in order to
>> make it more 'natural' I'm planning to integrate those scripts within
>> the Django project as management commands.
>>
>> To illustrate my ultimate goal this is how I imagine the workflow:
>>
>> sudo pip install django-my_project
>> my_project-admin.sh clone project_name path
>>
>> sudo python manage.py installrequirements
>> sudo python manage.py setuppostgres
>> python manage.py syncdb
>> python manage.py migrate
>> python manage.py createsuperuser
>>
>> sudo python manage.py setupapache
>> python manage.py collectstatic
>> sudo python manage.py setupceleryd
>> sudo python manage.py createtincserver
>> python manage.py updatetincd
>> sudo python manage.py setupfirmware
>> python manage.py loaddata firmwareconfig
>>
>> sudo python manage.py restartservices
>>
>>
>> Any thought on this? How do you automate your deployments? I heard
>> about fabric lots of times but never used it. Will fabric be helpful
>> in my case? Does it has any advantage for writing my own scripts? Or
>> maybe there are already some existing tools for automating deployment
>> of most common services like Apache, celeryd ..,?
>>
>> Many thanks!
>> br
>> --
>> Marc
>>
>> --
>> 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.
>>
>>
>>
>
> --
> Carlos Aguilar
> Consultor Hardware y Software
> DWD&Solutions
> http://www.dwdandsolutions.com
> http://www.houseofsysadmin.com
> Cel: +50378735118
> USA: (301) 337-8541
>
>  --
> 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.
>
>
>

-- 
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: search across models

2013-02-02 Thread Ashwin Kumar
thank you joey,

but i want to build search for queries like


   1. restaurants in city1
   2. city1 restaurants
   3. Chinese restaurants
   4. Chinese restaurants in city1
   5. vegetarian restaurants in city1
   6. vegetarian american restaurants

the above are exact search queries we get from template.
i wrote
restas = restaurant.objects.filter(Q(name__contains =
request.REQUEST.get('title')) & ~Q(city__name='') )
this works fine to search with restaurant name.

 i really have no idea on how to get results if the search phrase is
complex.

With Best
-Ashwin.
+91-9959166266


On Sun, Feb 3, 2013 at 12:46 AM, Joey Espinosa wrote:

> I'll assume city1 is a City object:
>
> 1) restaurants.objects.filter(city=city1)
>
> 2) city1.restaurant_set.all()
>
> 3) For this one, you have your choices variable in a difficult setup. I'd
> rewrite your restaurant class like this:
>
> class Restaurant(models.Model):  # keep class names singular, with minor
> exceptions
> CHINESE = 'c'
> AMERICAN = 'a'
> JAPANESE = 'j'
>
> RESTAURANT_TYPES = (
> (CHINESE, 'Chinese'),
> (AMERICAN, 'American'),
> (JAPANESE, 'Japanese'),
> (
>
> name = models.CharField(max_length=456)
> city = models.ForeignKey(city) # on a side note, the "city" class
> should be defined as "class City(models.Model)"
> rtype = models.CharField(max_length=10, choices=RESTAURANT_TYPES) #
> another side note... don't use Python reserved keywords such as
>
>   #
> "type" for your own variables
> is_veg = models.BooleanField(default=True)
>
> Now you'll be able to do this:
>
> Restaurant.objects.filter(rtype=Restaurant.CHINESE)
>
> 4) Using the above rewritten class as a guide:
>
> city1.restaurant_set.filter(rtype=Restaurant.CHINESE)
>
> or
>
> Restaurant.objects.filter(city=city1, rtype=Restaurant.CHINESE)
>
> 5) city1.restaurant_set.filter(is_veg=True)
>
> 6) city1.restaurant_set.filter(is_veg=True, rtype=Restaurant.AMERICAN)
>
> 7) ... and so on.
>
> Hope this helped. Also, I'd recommend getting familiar with this:
> http://www.python.org/dev/peps/pep-0008/
>
> --
> Joey "JoeLinux" Espinosa*
> *
>  
> 
>
>
> On Sat, Feb 2, 2013 at 1:13 PM, Aswani Kumar  wrote:
>
>> hi all, i have a big question.
>> how can i perform search queries like on following models
>>
>> RESTAURANT_TYPES = (
>> ('C', 'Chinese'),
>> ('A', 'American'),
>> ('J', 'Japanese'),
>> )
>>
>> class city (models.Model):
>> name = models.CharField(max_length=200)
>>
>> class restaurants(models.Model):
>> name = models.CharField(max_length=456)
>> city = models.ForeignKey(city)
>> type = models.CharField(max_length=10, choices=RESTAURANT_TYPES)
>> is_veg = models.BooleanField(default=True)
>>
>> search queries:
>>
>>1. restaurants in city1
>>2. city1 restaurants
>>3. Chinese restaurants
>>4. Chinese restaurants in city1
>>5. vegetarian restaurants in city1
>>6. vegetarian american restaurants
>>7. and so on...
>>
>>  --
>> 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.
>
>
>

-- 
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: google app engine suggestion

2012-11-10 Thread Ashwin Kumar
wow thank you, can any one of you write a blog post about how to setup this
environment or share a post which you have written earlier.


With Best
-Ashwin.
+91-9959166266



On Sat, Nov 10, 2012 at 10:19 PM, Javier Guerra Giraldez  wrote:

> On Sat, Nov 10, 2012 at 3:51 AM, Kurtis Mullins
>  wrote:
> > I, personally, prefer Nginx and uWSGI but something else may be better
> for
> > your particular use case.
>
> same here.  it's a little different from other solutions, but rock
> solid, and includes its own process management, so it's really close
> to 'setup and forget about it'.
>
> of course, if/when your traffic outgrows your initial setup you have
> to tune up and/or add more resources, but it has a lot of grow space.
> you won't find it constraining until you become bigger than twitter.
>
> --
> Javier
>
> --
> 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.
>
>

-- 
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: google app engine suggestion

2012-11-09 Thread Ashwin Kumar
thank you javier,

i am a .net and php developer, i can setup .net and php servers on windows,
ubuntu.

i am new to django/python. i love python so giving it a try.

can you give any idea of setting up my own django server, i found hard time
in setting up one. not able to choose between apache and nginx mod_wsgi,
mod_python.

i never found a decent documentation on how to setup and run django on
apache or nginx.

With Best
-Ashwin.
+91-9959166266



On Fri, Nov 9, 2012 at 11:24 PM, Javier Guerra Giraldez
wrote:

> On Fri, Nov 9, 2012 at 11:53 AM, Aswani Kumar 
> wrote:
> > my question is google app engine supports python 2.7 but django moving
> > towards python 3.x now with django 1.5 the minimum required version of
> > python is 2.6. and django 1.6 will be on python 2.7. what will be my
> future
> > if i choose google app engine and django.
>
> migration to 3.x is still experimental, it will be some time before
> it's mandatory.
>
> also, a significant part of Django deprecation policy is which
> versions are available in widely used platforms. Not so long ago, 2.4
> was still supported just because some still-supported RHEL version
> uses it by default.
>
> finally, i'm sure Google will make 3.x available before 2.7 is
> hopelessly obsolete.  Remember that they employ some big-name Python
> developers just for that (even someone with GvR initials)
>
>
> > i need a PAAS like google app engine so i can concentrate on developing
> app
> > instead of managing servers.
>
> personally, i find much easier to manage my own server than to be
> constantly distracted by the by-design limitations of the different
> PaaS offerings.  But if you find one that you really like, and don't
> mind the lock-in, go for it!
>
>
> --
> Javier
>
> --
> 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.
>
>

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