Re: soundx algo in search

2013-07-10 Thread Amirouche Boubekki
Héllo again,

It sound like not something I would do in my application but in a separate
daemon.

Basically what you need is call a fonction that will return a list of
names. The «function» is initialised with a certains number of names that
it can return, is that it ?


2013/7/9 Harjot Mann 

> Below is  the soundex algorithm in python. I want to implement it in
> my search function, please help me how it will work for my search.
> http://tny.cz/8d5ba06f
>
> --
> Harjot Kaur Mann
> Blog: http://harjotmann.wordpress.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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




DJANGOֹ_SETTINGS_MODULE different from folder name

2013-07-10 Thread Etay Cohen-Solal
It's kinda noob question, 
but I have a working dev project inside directory
/var/www/django/myproject
os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'

I want to change the folder of the project to something like:
/var/www/websites/il_co_project_name_www

but i get 500 Internal Server Error.

If I change the DJANGO_SETTINGS_MODULE to:
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
(remove the myproject.)
Then WSGI works, but I get Django errors of missing URL conf, and then 
VIEW, etc...
can I use DJANGO_SETTINGS_MODULE different from folder name?

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Deploying Django on ISS with Python 3.3

2013-07-10 Thread Robert Jonathan Šimon
How can i deploy Django with Python 3.3 on windows? it would be great if on 
IIS

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: DJANGOֹ_SETTINGS_MODULE different from folder name

2013-07-10 Thread Bill Freeman
It's all about sys.path and the semantics of import.

DJANGO_SETTINGS_MODULE must be a name that can be imported.  Any dots in
the string divide the name into a number of names.  The first name must be
findable via sys.path.  If it is the last name, it can name a .py file.
Otherwise it must be the name of a package, that is, a directory (folder)
containing an __init__.py file, as well as the next name in the chain as a
package, or if it is the last name, it can be a .py file.

The lookup for the root urlconf, etc, and any installed apps that are under
your project directory, as opposed to installed in your site-packages or
dist-packages directories.  You have to fix them all.

I have often played with things like
os.path.dirname(os.path.abspath(__file__)) to discover the prefix to use in
ROOT_URLCONF, etc.

You don't mention what Django version you are using.  The more modern
Djangos have much less trouble with this stuff, where the structure, as
created by startproject, usually involves something like
myproject/myproject/settings.py and you can rename the first of the
myproject directories as you like.  You must still arrange for it to be on
your sys.path, however.  When using manage.py runserver, this is automatic,
because we cd to that directory before running the command, and the current
directory is added to sys.path by default.  Apache's WSGI, however, has
required (there is something new in the works) that you specify that
directory somehow.


Separately, why is your project under /var/www ?  Not only is it not
required to be there, it also really shouldn't be there.  You don't want
Apache serving your source code.

Bill


On Wed, Jul 10, 2013 at 2:39 AM, Etay Cohen-Solal  wrote:

> It's kinda noob question,
> but I have a working dev project inside directory
> /var/www/django/myproject
> os.environ['DJANGO_SETTINGS_MODULE'] = 'myproject.settings'
>
> I want to change the folder of the project to something like:
> /var/www/websites/il_co_project_name_www
>
> but i get 500 Internal Server Error.
>
> If I change the DJANGO_SETTINGS_MODULE to:
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
> (remove the myproject.)
> Then WSGI works, but I get Django errors of missing URL conf, and then
> VIEW, etc...
> can I use DJANGO_SETTINGS_MODULE different from folder name?
>
>  --
> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django Translation: Why is there no pgettext_noop or npgettext_noop?

2013-07-10 Thread Bob Barcklay
HI Ramiro,

Perhaps I am confused.  I just want to mark these strings for extraction by 
makemessages(xgettext) in one component of my system and store them in a 
database.  Another component will do the actual translation by calling 
pgettext.I can probably use the _lazy methods to achieve the same thing 
but I'll need to serialize these lazy proxy objects to my database and that 
just seems more complicated. Why not just use the original string and 
invoke pgettext at the right time?  Does the _lazy version do something 
else for me?  

-Bob


On Tuesday, July 9, 2013 4:10:42 PM UTC-7, Ramiro Morales wrote:
>
> On Tue, Jul 9, 2013 at 7:02 PM, Bob Barcklay > 
> wrote: 
> > I want to use contextual markers and plural forms in strings with 
> deferred 
> > translation.  I'm curious why _noop versions of pggettext and npgettext 
> > don't appear anywhere. 
>
> What do _noop-suffixed version(s) of gettext function(s) have to do with 
> contextual markers, plural forms and deferred translation? 
>
> Are you confusing _noop with _lazy? 
>
> > My plan is to modify the xgettext invocation found 
> > in django/core/management/commands/makemessages.py to include new 
> --keywords 
> > for pgettext_noop and npgettext_noop.  Is this the correct approach? 
>
> -- 
> Ramiro Morales 
> @ramiromorales 
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django graphics

2013-07-10 Thread Derek
Good advice about using forms to capture the plot parameters - be aware 
that you do not need to save anything to disk (unless you want/need to). 
 There's an example here of creating one and returning it directly via the 
response:

http://wiki.scipy.org/Cookbook/Matplotlib/Django


On Tuesday, 9 July 2013 16:58:45 UTC+2, John wrote:
>
>  On 09/07/13 15:40, amanjot kaur wrote:
>  
>
>
>>
>> There are many python plotting libraries. I usually use matplotlib 
>> because my plots tend to be quite technical.
>>
>  
> I also tried to use matplotlib but I think it is filereadable but my 
> requirements are to add values from front end and then with one click graph 
> will be ceated on these values.
>
>
> ...so you need to call matplotlib functions from the view function that 
> handles whatever form you have designed. If you want to plot onto an image 
> file (rather than embed canvas commands into an html response, for example) 
> then something like this might work:
>
> def my_view_function(request):
> 1. Create a plot using matplotlib from the form parameters.
> 2. Save the plot in /path/to/static/plots/.png (depends where 
> you are serving static images from). I use uuid for things like this as I 
> know it will be unique and it doesn't have to be user friendly.
> 3. Prepare the html response which includes the graphic plot http://url/to/static/plots/.png">.
> 4. Return the html response.
>
> If I was doing this, I would template the html part and also use the 
> settings variables for static file location/URL rather than hard-coding the 
> paths and URLs. I would also run some periodic background clean up function 
> to get rid of old plots otherwise they will steadily use more disk space.
>
> Hope that helps. Let the list know if it works!
>
> John
>  

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django graphics

2013-07-10 Thread pa xapy
why you do this with django?
there so many js libraries
i think that for the web purposes its best solution than generate graphics 
with python.
personally, i'm using the http://www.highcharts.com/ - flexible and easy to 
start. great docs.

On Tuesday, July 9, 2013 5:30:45 PM UTC+4, amanjot kaur wrote:
>
> Please suggest me some module/library in django to plot graphs which
> takes input from user.

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Total number of flags on a comment (django.contrib.comment)

2013-07-10 Thread surya
I am using Django 1.4.5, using django.contrib.comments.. 
Is there any field or model method that gives total number of flags on a 
comment?


-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: django graphics

2013-07-10 Thread carlos
Hi the other library js for graphis is http://www.flotcharts.org/


On Wed, Jul 10, 2013 at 9:17 AM, pa xapy  wrote:

> why you do this with django?
> there so many js libraries
> i think that for the web purposes its best solution than generate graphics
> with python.
> personally, i'm using the http://www.highcharts.com/ - flexible and easy
> to start. great docs.
>
> On Tuesday, July 9, 2013 5:30:45 PM UTC+4, amanjot kaur wrote:
>>
>> Please suggest me some module/library in django to plot graphs which
>> takes input from user.
>
>  --
> 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.
> 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.
For more options, visit https://groups.google.com/groups/opt_out.




Django Tastypie: Getting MultipleObjects returned

2013-07-10 Thread Rene Zelaya
Hey everyone,

While using the Tastypie API, I have been getting a MultipleObjectsReturned 
error somehow when obj_get gets called.  I feed a Resource URI to a 
ToManyField for one of the resources and somehow I get this error.  This 
has me really frustrated, since I thought that by giving it a URI (ex: " 
/api/v1/gene/1/ "), it would only return one object.  Creating and saving 
objects works fine without the Tastypie API.

These are the involved resources: 

class GeneResource(ModelResource):
entrezid = fields.IntegerField(attribute = 'entrezid')
genesets = fields.ToManyField("genesets.api.resources.GeneSetResource", 
'genesets', null=True, blank=True)

class Meta:
queryset   = Gene.objects.all()
resource_name = 'gene'
filtering = {'entrezid': ALL, }

class GeneSetResource(ModelResource):
title= fields.CharField(attribute='title')
user = fields.ForeignKey(UserResource, 'user', full=True)
organism = fields.ToOneField(OrganismResource, 'organism', full=True)
genes= fields.ToManyField(GeneResource, 'genes', 
related_name='genesets', full=True)

class Meta:
queryset  = GeneSet.objects.all()
resource_name = 'geneset'
authorization = Authorization()
filtering = {
'user': ALL_WITH_RELATIONS, 
'title': ALL,
'genes': ALL_WITH_RELATIONS,
}


And this is the error I get:

"Traceback (most recent call last): File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 217, in wrapper response = callback(request, *args, **kwargs) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 459, in dispatch_list return self.dispatch('list', request, **kwargs) 
File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 491, in dispatch response = method(request, **kwargs) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 1357, in post_list updated_bundle = self.obj_create(bundle, 
**self.remove_api_resource_names(kwargs)) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 2150, in obj_create return self.save(bundle) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 2300, in save m2m_bundle = self.hydrate_m2m(bundle) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 964, in hydrate_m2m bundle.data[field_name] = 
field_object.hydrate_m2m(bundle) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/fields.py",
 
line 853, in hydrate_m2m 
m2m_hydrated.append(self.build_related_resource(value, **kwargs)) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/fields.py",
 
line 653, in build_related_resource return 
self.resource_from_uri(self.fk_resource, value, **kwargs) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/fields.py",
 
line 573, in resource_from_uri obj = fk_resource.get_via_uri(uri, 
request=request) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 838, in get_via_uri return self.obj_get(bundle=bundle, 
**self.remove_api_resource_names(kwargs)) File 
"/home/rene/Documents/venv/local/lib/python2.7/site-packages/tastypie/resources.py",
 
line 2131, in obj_get raise MultipleObjectsReturned("More than '%s' matched 
'%s'." % (self._meta.object_class.__name__, stringified_kwargs)) 
MultipleObjectsReturned: More than 'Gene' matched ''. "

Any ideas of what is going on??  Thanks! Much appreciated!!






-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




.vimrc file for django development

2013-07-10 Thread modhaffer rahmani
Anyone got a good .vimrc file for Django development under Linux?? 

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




exploring django framework source code

2013-07-10 Thread Ahmad
Hi every body,
I'd like to know how to explore the django framework source code like if you 
are reading a book, like where to start, where to get a general overview of the 
code organization,  where to head next and so on until you become familiar with 
all of the framework parts.
Thanks in advance

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-10 Thread Nikolas Stevenson-Molnar
Hi Sven,

Thanks for the suggestion. Unfortunately, this didn't resolve the issue
for me. Chrom is still hanging on that page. It loads most of the
resources, then hangs indefinitely while requesting several images.

If I close the tab, I get a stack trace in the Django log (connection
aborted) which shows the last call to be to socket.sendall(). It's
bizarre; what is going on?  I can load all those images fine in a
separate tab, but loading them with the page creates problems...

_Nik

On 7/8/2013 4:00 AM, Sven Bröckling wrote:
> Hi,
>
> Chrome sometimes does really strange things. I use chrome with a
> disabled cache for development (Open Developer Tools, click on the
> settings menu, first option) which resolves this kind of problems for me.
>
> Regards
>   Sven
>
>> I can confirm this issue. Exactly the same problem here.
>> Also, while Chrome is spinning, I can open Firefox and load pages
>> (including the problem page) just fine. So it's not that the server
>> is overloaded or anything like that...
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Pip type error.

2013-07-10 Thread Mark Liu
Googled this problem and came here. I was also using powershell but 
everything worked after I converted the requirments file to utf-8

On Wednesday, May 1, 2013 8:43:13 AM UTC-4, il...@app-loader.com wrote:
>
> Brilliant !
> I was using powershell.
> When I switched back to good old cmd.exe pip freeze worked fine
>
> On Saturday, July 21, 2012 9:00:50 AM UTC+3, Jauharul Fuady wrote:
>>
>>
>>
>> On Sunday, 11 March 2012 15:17:59 UTC+7, John W. wrote:
>>>
>>> I know it's weird to reply to myself, but just in case that somebody has 
>>> the same problem. 
>>>
>>> It seems that the problem it is in the requirements.txt, i created it 
>>> using powershell and "pip.exe freeze > requirements.txt" command,
>>> which creates a file with a name that has nullbytes in it. 
>>> I was able to get around this problem by downloading a requirements.txt 
>>> from an example project on github and modifying it.
>>> That did the job and everything works nice.
>>>
>>>  
>> Thank you for posting it. It helps me.
>>
>

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Django 1.5 runserver hangs in Chrome

2013-07-10 Thread Nikolas Stevenson-Molnar
After a lot of dead ends, I finally found the problem! The cause is the
switch to using CompatibleStreamingHttpResponse in the
django.views.static.server view. Previously, the view simply read the
whole file into memory and returned a regular HTTP response. The
StreamingHTTPResponse class uses the file iterator to return data, which
in turn returns one line per iteration. I'm not at all sure why, but
this seams to cause a problem when requesting many files at once (e.g.,
Chrome).

In order to verify that this was the problem, I solved the issue by
adding a *file_chunk_iterator *function (yields 1024 bytes per
iteration, rather than one line like the standard Python file iterator),
and changing the response in the serve view from this:

response = CompatibleStreamingHttpResponse(open(fullpath, 'rb'),
content_type=mimetype)

to this:

response =
CompatibleStreamingHttpResponse(file_chunk_iterator(open(fullpath,
'rb')), content_type=mimetype)

The iterator function looks like this:

def file_chunk_iterator(f, size=1024):
while True:
chunk = f.read(size)
if chunk:
yield chunk
else:
return

On 7/3/2013 5:39 PM, Nikolas Stevenson-Molnar wrote:
> I've just updated to Django 1.5 and am running into a problem when
> using Chrome with the Django devlopment server (and staticfiles). One
> particular page which loads a lot of static content /consistently/
> hangs in Chrome (works fine in Firefox). This seems similar to two
> resolved issues: https://code.djangoproject.com/ticket/16099 and
> https://code.djangoproject.com/ticket/18336. Except that I've waited
> several minutes and the resources haven't finished loading. I've
> increased request_queue_size as suggested in the second issue (first
> to 10, then 20, then 50) with no change.
>
> I'd chalk this up entirely as a Chrome problem, except that if I
> switch back to Django 1.4 (changing nothing else), everything goes
> back to working fine. So what changed about runserver in Django 1.5
> that might cause this? And more importantly, how do I get around it?
> I'm running everything on Windows 7 with Django 1.5.1 and the latest
> version of Chrome.
>
> Thanks,
> _Nik

-- 
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.
For more options, visit https://groups.google.com/groups/opt_out.