Re: Template.render(Context) in django 1.10+

2018-03-13 Thread Mike Dewhirst

On 13/03/2018 4:55 PM, Craig de Stigter wrote:

Cheers Mike

That deprecation notice says to me that Context itself is not 
deprecated, but the `current_app` argument is. I don't think that's a 
problem for us as I don't think we've ever used it.


Perhaps I can clarify. As far as I can tell, according to the errors 
and deprecation warnings I'm receiving in Django 1.9:


  * `django.templates.base.Template.render()` requires a Context
instance

,
and does not accept a dict
  * `django.templates.backends.django.Template.render()` /requires a
dict

,
/and does not accept//a Context instance.



It is all news to me so I went looking. If you look at 
django/template/__init__.py there seems to be a brief explanation. It 
does start by saying the Django template namespace contains two 
independent subsystems. One is for pluggable (and the Django template 
language is pluggable) template backends. That's probably where the 
Jinja template system plugs in. The other subsytem is the Django 
template language itself.


I think the answer to your problem might be found in the imports in that 
__init__.py


If you are *only* using the Django template system that enormous 
codebase probably needs to be adjusted so it does all its 
template-oriented imports from that file. In other words ...


from django.template import Template, Context, RequestContext and 
whatever else you use.


Again, if you are only using Django templates you should be able to 
safely drop imports from 'backend' in favour of the above 'from 
django.template import ...'


Hope that works! Don't know of course but I reckon it would be worth a try.

Good luck

Mike

While I haven't yet made things 'work' in 1.10 to a point where I can 
test it adequately, the 1.10 code I've read looks consistent with that 
hypothesis.


So it really seems there's no clear safe choice, except to absolutely 
enforce that all templates in my codebase must be one or the other 
(presumably, the new-style one).


Unfortunately it's really unclear which of the two template classes 
I'm using in the hundreds of places we render templates in this rather 
large codebase. The shortcut functions (`render` etc) appear to use 
the backend-specific template, whereas if I just import Template 
directly and instantiate it it turns out to be the old-style template.


I'm not really sure what I'm saying except that maybe the old-style 
Template class just needs to be removed to avoid confusion.



On Tue, 13 Mar 2018 at 14:50 Mike Dewhirst > wrote:


On 13/03/2018 11:44 AM, Craig de Stigter wrote:

Thanks for the reply.

So I guess there are actually now two types of templates, and
they have incompatible API. Neither is deprecated.


Craig

I don't think your guess is correct. Or at least I'm missing
something if it is!

I remember bringing a project from 1.8 to 1.11 without any
problems other my own mis-readings of the docs. Things changed in
1.9 and the following comes from ...

https://docs.djangoproject.com/en/1.9/ref/templates/api/#rendering-a-context.
Notice the Deprecated comment  ...


Rendering a context¶



Once you have a compiled |Template|


object, you can render a context with it. You can reuse the same
template to render it several times with different contexts.

/class /|Context|(/dict_=None/,
/current_app=_current_app_undefined/)[source]



This class lives at |django.template.Context|. The constructor
takes two optional arguments:

 *

A dictionary mapping variable names to variable values.

 *

The name of the current application. This application name
is used to help resolve namespaced URLs

.
If you’re not using namespaced URLs, you can ignore this
argument.

Deprecated since version 1.8: The |current_app| argument
is deprecated. If you need it, you must now use a
|RequestContext|


instead of a |Context|

.


If you visit the link you quoted (below) and adjust the version
part o

Zoomslider in Django

2018-03-13 Thread deviya sweety
Hi,
   I'm new to django and jquery, how can I use Zoomslider in Django??
When i try to use data-zs-src='["images/2.jpg", "images/1.jpg", 
"images/3.jpg"]' it shows an error that those images are not found.
could anyone help me out with this please.
Thankyou 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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/745abc51-2e60-4dec-9da9-606a18165c39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Zoomslider in Django

2018-03-13 Thread Phang Mulianto
Hi

This related to static path.can you access the image manually in the
browser?

The javascript part is run in client browser already, which django finished
processing when page sent to client.

Hope helps.

Regards

On 13 Mar 2018 5:17 pm, "deviya sweety"  wrote:

> Hi,
>I'm new to django and jquery, how can I use Zoomslider in Django??
> When i try to use data-zs-src='["images/2.jpg", "images/1.jpg",
> "images/3.jpg"]' it shows an error that those images are not found.
> could anyone help me out with this please.
> Thankyou 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 https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/745abc51-2e60-4dec-9da9-606a18165c39%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/CA%2BSr5mQ3j8NSMMm-sUYxPNwLsJvNVNG8ui5Zmb9EkneDgO3f%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Listening to a django channel from outside a consumer

2018-03-13 Thread Andrew Godwin
Hi Alex,

Consumers aren't designed to be run outside of a Channels or ASGI
environment. If you read the ASGI spec (
https://github.com/django/asgiref/blob/master/specs/asgi.rst), you'll see
that to run a consumer - which is an ASGI app - you need to do quite a bit
more than you did there, in particular making an event loop and running its
coroutine.

Instead, if you want to receive on a channel layer channel externally, I
recommend calling channel_layer.receive directly. It takes a channel name
to receive on and blocks until there's a message. Ideally you should do
this all within an async context rather than using async_to_sync, but I
believe both should work.

Andrew

On Tue, Mar 13, 2018 at 12:15 AM, Alex  wrote:

> Hi,
>
>
> The docs explain that it is possible to publish to the channel layer from
> outside of a consumer: https://channels.readthedocs.io/en/latest/
> topics/channel_layers.html#using-outside-of-consumers I need to do the
> opposite. I have a fairly complex python script that reads live data from
> pubnub, processes it, and pushes it to consumers via groups on the
> channel_layer. This works fine, but I need consumers to be able to announce
> their presence to this script so that it can push them data (it currently
> pushes to the channel layer only when it gets new data from pubnub, which
> could be every 24 hours).
>
>
> I've decided to solve this by having the consumers publish to a 'presence'
> channel on connect. I now need the pubnub source script to listen to this
> channel. I've tried adding the below to the script, and it no longer throws
> errors, but it doesn't actually respond to messages. It successfully joins
> the channel layer, but the message handler 'receive_json', never fires.
>
>
> This is the class, and then the initiation further down in the code:
> from channels.generic.websocket import JsonWebsocketConsumer
>
>
> class channelConsumer(JsonWebsocketConsumer):
>
> def __init__(self):
> self.channel_name = 'source'
> def join(self):
> async_to_sync(channel_layer.group_add)('presence', self.
> channel_name)
> def receive_json(self, message):
> print("Presence Detected")
> # do some stuff
>
> global channel_layer
> channel_layer = get_channel_layer()
>
> global listener
> listener = channelConsumer()
> listener.join()
>
>
>
>
> --
> 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/08086bed-67a8-4fd6-8eec-0c417423ea8b%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/CAFwN1ur6Dxa%3D6Dfw2PVBKURa55xPxrDRgPa7i6SkKsDbHdrXqw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Webpage Displays Blank

2018-03-13 Thread Derek
Maybe you need to show what your urls.py looks like as well?

On Tuesday, 13 March 2018 05:57:55 UTC+2, Carl Brubaker wrote:
>
> I'm probably missing something simple, but I can't get my info to display 
> from my database.
>
> I have 2 abstract models to make 1 normal model.
> My url views aren't giving me errors, the web browser finds them.
> My variables aren't correct(I can only assume).
>
> Thanks!
>

-- 
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/5fdd9ade-c3f4-4e8b-8abb-398cf10f092e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Template.render(Context) in django 1.10+

2018-03-13 Thread James Bennett
On Mon, Mar 12, 2018 at 5:44 PM, Craig de Stigter <
craig.destig...@koordinates.com> wrote:

> Thanks for the reply.
>
> So I guess there are actually now two types of templates, and they have
> incompatible API. Neither is deprecated.
>
> Has this confused anyone else? Is this a desirable/necessary situation?
>

Here is what happened:

Django originally shipped with one template language, and that was the
only thing its template framework understood. The interface for it
involved instances of django.template.Template and rendered them using
instances of django.template.Context.

When Django grew support for using multiple template languages, this
became a problem since Django's original template language was the
only one that understood the Django Context object. So the
engine-based interface wants you to pass in a dict instead of a
Context for rendering, which then lets the underlying template
framework figure out what template-language-specific type of object to
convert it into. If you happen to use the original Django template
language, of course it gets converted into a Context instance, but
Django has no way of knowing in advance that this will happen.

The old django.template.Template/django.template.Context interface
hasn't been deprecated, because for users who use only the original
Django template language, it still works and is still a very
convenient and simple API, and there's no need to make them deal with
the indirection of working through the template-engine API. The only
time you need to know or care about the engine API and using plain
dicts is when you start using some other template language with
Django, so the complexity of dealing with the engine API gets deferred
to that point.

The problem you're running into, of course, is an old codebase where
apparently some developers used one of these APIs while some
developers used the other API. And the solution is to pick one and
force the developers on your team to use only that API going forward.

If you know that you are always going to use the original Django
template language, and not use any other language (like Jinja), then
using django.template.Template/django.template.Context is still fine
and is still supported. If you think there's even a small chance that
at some point in the future you might want a different template
language, use the engine API.

Also, it's generally best to avoid from_string(); while it may seem
convenient, it can cause situations where you have template code
hidden somewhere other than where you store your templates. Just make
a real template and use the loader to go find it. And importing
through django.template.base instead of just through django.template
is probably a bad idea; I don't think we have any kind of
compatibility guarantee for django.template.base to keep working,
while we do have one for django.template to keep working. This is why
it's good to use the import path given in the Django documentation,
rather than trying to track down the "real" location of a definition
and import from there instead.

-- 
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_Fx9R012t9KKDEQ8LajJNOpbXGRUyNR9%2BYXkMBZXzzCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error After Inspect db

2018-03-13 Thread Avraham Serour
it seems you wrote def_str_, if should be def (space) then the function name

also the function str should probably be named with double underscores like
this: __str__ not _str_

On Tue, Mar 13, 2018 at 5:27 PM, mansi thakkar 
wrote:

> Hello ,
> Here is the attached files of my output and my error and my models.py
> file. I have database residing in aws cloud platform. What I have done is I
> have used inspectdb command and created models using that command. Then
> have registered my model into admin site and then model has been displayed
> (Ingredient in my case.) Now it is showing Ingredient object for each and
> every entry as shown in pic I would like to display master_name instead og
> ingredient_name. How can I do that?
> Please reply me as soon as possible.
> Thank you.
>
> --
> 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/d9fe676d-9988-4f59-a97f-fdc5db777e39%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/CAFWa6tJo-jNjU%3DS62UgnTV%3DERu4-w4xe-JcoUT2hgJf2s7e6tA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Error After Inspect db

2018-03-13 Thread mansi thakkar
I got it and tried as you said but still couldn't get the output as I want. 
It is still showing ingredient object.

On Tuesday, March 13, 2018 at 12:09:36 PM UTC-4, Avraham Serour wrote:
>
> it seems you wrote def_str_, if should be def (space) then the function 
> name
>
> also the function str should probably be named with double underscores 
> like this: __str__ not _str_
>
> On Tue, Mar 13, 2018 at 5:27 PM, mansi thakkar  > wrote:
>
>> Hello , 
>> Here is the attached files of my output and my error and my models.py 
>> file. I have database residing in aws cloud platform. What I have done is I 
>> have used inspectdb command and created models using that command. Then 
>> have registered my model into admin site and then model has been displayed 
>> (Ingredient in my case.) Now it is showing Ingredient object for each and 
>> every entry as shown in pic I would like to display master_name instead og 
>> ingredient_name. How can I do that? 
>> Please reply me as soon as possible. 
>> Thank you.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@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/d9fe676d-9988-4f59-a97f-fdc5db777e39%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/147bd8b6-503e-46dc-93ab-1b75ea288ecb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


separate http requests between channels routing and "classic django routing

2018-03-13 Thread Kevin Tewouda

Hello,
i am developing an application (a REST one) which have to serve some sse 
events to a web application. I saw in the latest documentation how to 
create an SSE consumer, but now when i create an http routing for 
consumers, i can't serve the others requests using the "classic django view 
system". So my question is how can i separate the sse routing from the 
other http requests to have all of this working properly.
Thanks in advance for your suggestions.

Best regards

-- 
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/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django development test suite fail

2018-03-13 Thread cheulheeyoo
Hi,

I am new to django contribution and I followed instructions on how to 
contribute guideline but I am stuck on one issue.
I ran the test stream like shown in the tutorial and keep getting failed 
status.
Is this suppose to be normal?

FAILED (failures=10, errors=1, skipped=856, expected failures=6)

-- 
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/af3ba6a5-a3e6-47da-8a90-2c9c1453865f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Fetching next and/or prior objects given an arbitrary ordering

2018-03-13 Thread Bernd Wechner
Hmmm, really stuck on this. Can find no way of selecting from a select in 
the ORM. The whole premise seems be to start from model.objects and add SQL 
clauses with filter, annotate and other methods. But a QuerySet is not a 
model and queryset.objects doesn't exist, and queryset.filter just adds a 
where clause to the select on the original model not on the result of the 
queryset. It's almost as if we need a way to cast a queryset as a virtual 
model in the style of:

def get_prior(model, pk):
# Get the ordering list for the model (a list of fields
# See: 
https://docs.djangoproject.com/en/2.0/ref/models/options/#ordering
ordering = model._meta.ordering

order_by = []
for f in ordering:
if f.startswith("-"):
order_by.append(F(f[1:]).desc())
else:
order_by.append(F(f).asc())

my_queryset = model.objects.annotate(prior=Window(expression=Lag("pk"), 
order_by=order_by))

my_result = Model(my_queryset).objects.filter(pk=pk)

That last line is the crux of the issue.I see no way of writing this. When 
doing this:

my_result = my_queryset.filter(pk=pk)

The WHERE clause ends up on the select in in my_querset. we want to wrap 
the whole of my_queryset with 

select * from my_queryset where pk=pk

But how? Can anyone think of a way to do that?

Regards,

Bernd.

On Monday, 12 March 2018 23:43:33 UTC+11, Bernd Wechner wrote:
>
> OK Trying to implement this now and has SQL that works but can't work how 
> to use the Django ORM to produce it. Here is the proforma SQL:
>
> SELECT *
> FROM (
> SELECT id, LAG(id, 1) OVER (ORDER BY ) AS 
> prior, LEAD(id 1) OVER (ORDER BY ) AS next
> FROM 
>   ) result
> WHERE id=;
>
> There's a sub query involved (as LAG and LEAD don't work if you constrain 
> the inner query alas. And I've used SubQuery in Django before but not like 
> this, (in the FROM clause), and am a tad stuck. Can anyone code this sort 
> of query up in the Django ORM with QuerySets.
>
> I can create the inner set.
>
> result = model.objects.annotate(prior=Window(expression=Lag("pk"), 
> order_by=order_by)).annotate(next=Window(expression=Lead("pk"), order_by=
> order_by))
>
> Now the question is how to filter() the result of that, rather than that 
> itself ;-). If that makes sense. Namely the aforementioned SQL. Any 
> filter() I add to the end of this ORM QyerySet produces SQL more like
>
> SELECT id, LAG(id, 1) OVER (ORDER BY ) AS prior, 
> LEAD(id 1) OVER (ORDER BY ) AS next
> FROM 
> WHERE id=;
>
> In with prior and next are empty, because that's just how such SQL works 
> it seems. do the WHERE on the table produced by the SELECT/FROM as per SQL 
> above to make this work.
>
> Regards,
>
> Bernd.
>

-- 
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/dace1caf-4748-4d99-a836-7f016f87414d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How do I set up an AngularJS-driven form to work with Django password reset functionality?

2018-03-13 Thread Tom Tanner
I'm working on a web page with AngularJS v1.5.6. This page has other forms. 
I want to add a "Reset password" form to this page.

I've seen this Django password reset for tutorial: 
https://simpleisbetterthancomplex.com/tutorial/2016/09/19/how-to-create-password-reset-view.html.
 
But I'm unsure how I'd apply it to my situation.

My questions is how would I set up urls.py and views.py to handle this?

Here's the example code on 
StackOverflow: 
https://stackoverflow.com/questions/49265097/how-do-i-set-up-an-angularjs-driven-form-to-work-with-django-password-reset-func

-- 
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/33acd11a-6a05-4d50-88c4-be93268e417f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


import file from view.py

2018-03-13 Thread sum abiut
I have a conf file containing the parameter of hostmane,db,usernam,pass, db

i want to import that file from view.py and use parameter from the conf
file to connect to a db.

i did something this from appname.conf import but it doesn't seem to work,
appreciate any assistance.

cheers

-- 
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/CAPCf-y5Og0o5yb_e%3D6ggLjS%2BOtDyZFUoqe_9KYZLbC1w72g7MA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Webpage Displays Blank

2018-03-13 Thread Carl Brubaker
Added urls file

On Tuesday, 13 March 2018 10:40:29 UTC-4, Derek wrote:
>
> Maybe you need to show what your urls.py looks like as well?
>
> On Tuesday, 13 March 2018 05:57:55 UTC+2, Carl Brubaker wrote:
>>
>> I'm probably missing something simple, but I can't get my info to display 
>> from my database.
>>
>> I have 2 abstract models to make 1 normal model.
>> My url views aren't giving me errors, the web browser finds them.
>> My variables aren't correct(I can only assume).
>>
>> Thanks!
>>
>

-- 
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/5883a41e-99e0-4f6b-86cd-2d519dd7abf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.urls import path

from . import views

urlpatterns = [
	path('', views.contacts, name='index'),
	path('create/', views.contact_create, name='create'),
	path('/', views.contact_detail, name='detail'),
	path('/update/', views.contact_update, name='update'),
]

Re: separate http requests between channels routing and "classic django routing

2018-03-13 Thread Andrew Godwin
You can just use channels.http.AsgiHandler as the consumer/ASGI app to hand
off to Django views. It's mentioned in the last paragraph here:
http://channels.readthedocs.io/en/latest/topics/routing.html#protocoltyperouter

Andrew

On Tue, Mar 13, 2018 at 9:20 AM, Kevin Tewouda  wrote:

> Hello,
> i am developing an application (a REST one) which have to serve some sse
> events to a web application. I saw in the latest documentation how to
> create an SSE consumer, but now when i create an http routing for
> consumers, i can't serve the others requests using the "classic django view
> system". So my question is how can i separate the sse routing from the
> other http requests to have all of this working properly.
> Thanks in advance for your suggestions.
>
> Best regards
>
> --
> 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/6b19b58f-d5e3-4e31-908b-a9371e31b2cc%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/CAFwN1urnqpo%2Bh122rkNLNBYA-o%3D35LWhvnHKx%2BRDYTdWROHt-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.