Error when creating a django app in a specified folder with the same name as the app

2017-12-19 Thread Nick Gilmour
Hi all,

when I try to create a django app in a specified folder with the same name
as the app I get the following error:

*CommandError: 'my_app' conflicts with the name of an existing Python
module and cannot be used as an app name. Please try another name.*

These are the commands I'm using:
$ mkdir backend/apps/my_app
$ python manage startapp my_app ./backend/apps/my_app

Is this normal? Any ideas why is this happening?

Regards,

Nick

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-droyoLU7XABHSrvU40eCiNSk2rzt25wGZWRjYurSKOtweww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django+Haystack+Elastic issue

2017-05-25 Thread Nick Gilmour
It is related with Django's pagination...

The results per page value can be set with:
HAYSTACK_SEARCH_RESULTS_PER_PAGE = 20
in the settings.py.

I had found and defined this setting before but it wasn't working because I
had this in the HAYSTACK_CONNECTIONS dict (don't ask me why...).

I have increased it to 50 and I'm getting 50 hits.




On Thu, May 25, 2017 at 12:06 AM, Nick Gilmour <nickefo...@gmail.com> wrote:

> Thanks for the hint!
> It seems to be related with Django's pagination:
> with:
> {{ page.paginator.count }}
> and
> {{ page.paginator.num_pages }}
> I can see that I have 58 hits and 3 pages, which is correct.
> I was getting maximal 2 pages with 20 pages each.
> Now I have to check how pagination in Django works...
>
>
> On Wed, May 24, 2017 at 4:55 PM, Avraham Serour <tovm...@gmail.com> wrote:
>
>> it sounds like elastic is paginating, did you check that?
>>
>> On Tue, May 23, 2017 at 12:41 AM, Nick Gilmour <nickefo...@gmail.com>
>> wrote:
>>
>>> Hi all,
>>>
>>>
>>>
>>> I'm following an example to setup Django with Haystack and ES from here:
>>>
>>> https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-
>>> part-one.html
>>>
>>>
>>> Everything seems to be working OK except from the number of the results
>>> – they are always maximal 20. But actually a single query should give more
>>> than 50 results.
>>>
>>> So, where does this limitation come from? How can I change it?
>>>
>>> I cannot find a setting neither for haystack nor for django which
>>> prevents showing more than 20 results.
>>>
>>>
>>>
>>> Thanks,
>>>
>>> Nick
>>>
>>> --
>>> 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 https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5
>>> OOhtUt1LoQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CN
>> GWqyrF36-A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CNGWqyrF36-A%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-droxKK24FFz59tqMRB-m_hdrUcHPp4EEThZTRq31ZuuLG5A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django+Haystack+Elastic issue

2017-05-24 Thread Nick Gilmour
Thanks for the hint!
It seems to be related with Django's pagination:
with:
{{ page.paginator.count }}
and
{{ page.paginator.num_pages }}
I can see that I have 58 hits and 3 pages, which is correct.
I was getting maximal 2 pages with 20 pages each.
Now I have to check how pagination in Django works...


On Wed, May 24, 2017 at 4:55 PM, Avraham Serour <tovm...@gmail.com> wrote:

> it sounds like elastic is paginating, did you check that?
>
> On Tue, May 23, 2017 at 12:41 AM, Nick Gilmour <nickefo...@gmail.com>
> wrote:
>
>> Hi all,
>>
>>
>>
>> I'm following an example to setup Django with Haystack and ES from here:
>>
>> https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html
>>
>>
>> Everything seems to be working OK except from the number of the results –
>> they are always maximal 20. But actually a single query should give more
>> than 50 results.
>>
>> So, where does this limitation come from? How can I change it?
>>
>> I cannot find a setting neither for haystack nor for django which
>> prevents showing more than 20 results.
>>
>>
>>
>> Thanks,
>>
>> Nick
>>
>> --
>> 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 https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo
>> 5OOhtUt1LoQ%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaO
> s0CNGWqyrF36-A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAFWa6tL%3D1Hb3Ud1PXw6AgBue2oq9t1YnVLaOs0CNGWqyrF36-A%40mail.gmail.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-drox%3DoagV96eD7v0yM%2BxcvivaZS%3DCEkvOFZVBcGkJmtJGug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django+Haystack+Elastic issue

2017-05-22 Thread Nick Gilmour
Hi all,



I'm following an example to setup Django with Haystack and ES from here:

https://krzysztofzuraw.com/blog/2016/haystack-elasticsearch-part-one.html


Everything seems to be working OK except from the number of the results –
they are always maximal 20. But actually a single query should give more
than 50 results.

So, where does this limitation come from? How can I change it?

I cannot find a setting neither for haystack nor for django which prevents
showing more than 20 results.



Thanks,

Nick

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-drozT6m%2Be_KX4Kni_U5nJXQp8NF8EeXb9cJo5OOhtUt1LoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: View Function Signature?

2017-05-14 Thread Nick Gilmour
>
> Neither one of these is what was being asked for.


I didn't say I have found what I was looking for.

All answers are sufficient to me for now. Thanks.

On Sun, May 14, 2017 at 10:51 PM, James Bennett <ubernost...@gmail.com>
wrote:

> On Sun, May 14, 2017 at 1:36 PM, Nick Gilmour <nickefo...@gmail.com>
> wrote:
>
>> Definition of url:
>>
>> *def url(regex, view, kwargs=None, name=None):*
>>
>> I also found this:
>> *def view(request, *args, **kwargs):*
>>
>>
> Neither one of these is what was being asked for.
>
> And like several people have said, what's being asked for doesn't exist: a
> Django view is defined as a callable Python object which takes as its first
> position argument an HttpRequest object, may or may not accept additional
> positional and/or keyword arguments, and either returns an HttpResponse
> object or raises an exception. That definition does not allow for a single
> universal argument signature that will work on all views.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAL13Cg-GaiFF9E4in7vfaSd6zbiQkSsLRbpXe
> 5Y6YR0KGeKJ_Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAL13Cg-GaiFF9E4in7vfaSd6zbiQkSsLRbpXe5Y6YR0KGeKJ_Q%40mail.gmail.com?utm_medium=email_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-drow2ebTVu2x2Q3zAO0e228-7V6L_6wQXWJNrRt15s7Sx-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: View Function Signature?

2017-05-14 Thread Nick Gilmour
Definition of url:

*def url(regex, view, kwargs=None, name=None):*

I also found this:
*def view(request, *args, **kwargs):*

here:

*.../django/views/generic/base.py*


On Sat, May 13, 2017 at 11:15 PM, Daniel Roseman 
wrote:

> On Friday, 12 May 2017 15:11:55 UTC+1, nickeforos wrote:
>>
>> Thanks for the link. I understand these examples but still I would like
>> to see how a view function is defined.
>>
>> I also would like to see it in PyCharm. When I click on a view function
>> in PyCharm I only see:
>>
>> def myview_function(request)
>> Inferred type: (request: Any) -> HttpResponse
>>
>> I would expect to see something like this:
>> view_function(request, *args, **kwargs)
>>
>> I've also looked in django's source but I cannot locate it.
>>
>
>
> But this isn't how Python works. You don't need a defined signature or
> prototype for a class of functions. A view is simply called with the
> request and any parameters passed from the URL, that's all there is to it.
> --
> DR.
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/ec6a2b04-dc19-4a72-aac6-74b20dd3e730%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-drox%3DrPnXLTjFbJhkDVBdr-%2BKQTiGoNLj%2BDWOKr5-PK6W9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: View Function Signature?

2017-05-12 Thread Nick Gilmour
Thanks for the link. I understand these examples but still I would like to
see how a view function is defined.

I also would like to see it in PyCharm. When I click on a view function in
PyCharm I only see:

def myview_function(request)
Inferred type: (request: Any) -> HttpResponse

I would expect to see something like this:
view_function(request, *args, **kwargs)

I've also looked in django's source but I cannot locate it.

On Fri, May 12, 2017 at 3:05 PM, nickeforos  wrote:

> I'm following the django tutorials and documentaion as well as the django
> book.
> In
> https://docs.djangoproject.com/en/1.11/topics/http/views/
> there is this view function:
> def current_datetime(request):
> now = datetime.datetime.now()
> html = "It is now %s." % now
> return HttpResponse(html)
>
> and in:
> http://djangobook.com/django-views-dynamic-content/http://
> djangobook.com/django-views-dynamic-content/
> there is this view function:
> def hours_ahead(request, offset):
> try:
> offset = int(offset)
> except ValueError:
> raise Http404()
> dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
> html = "In %s hour(s), it will be  %s." % (offset, dt)
> return HttpResponse(html)
>
> So in the view function I can pass *request* as well as an *argument*
> from the url but how does the signature of a view function look like?
> Where can I find it in the documentation?
> Is it possible to see such signatures in PyCharm?
>
> --
> 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/76227b4e-5de3-4ca1-a9c6-658c2ee69529%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH-droyZRQNwUA39G7y9fgcodtFoO_pn1OTgO0s1ANDsn0pRtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.