Quantcast
Channel: Django talk
Viewing all 28280 articles
Browse latest View live

Django stringformat:"d"not work in template

$
0
0
{% if request.GET.active == catmenu.id|stringformat:"d" %}  class="active" {% endif %}

--
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+unsubscribe@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/ba1a2c2e-c3a8-4817-855b-5a2581f022cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django not showing updated data

$
0
0

1) You hit Ctrl+R or otherwise refresh the page in the browser, and it still shows the old data?

2) How do you know the new record is in the database?

3) What is your RDBMS?

4) Are you using any cache middleware?

Antonis Christofides  http://djangodeployment.com
On 2017-05-18 16:08, George Kleanthous wrote:
Hi,

This is the view

def taxes(request):

    taxes = Tax.objects.all()
    return render (request, 'app/taxes.html',
                    {"data":taxes})


On 18 May 2017, at 3:19 PM, Antonis Christofides <antonis@djangodeployment.com> wrote:

Hi,

it's hard to tell without more information. It could be a caching issue, if you are using a cache. If possible, please show us the code of the view that is causing the error (if it's not too long).

Regards,

A.

Antonis Christofides  http://djangodeployment.com
On 2017-05-18 11:41, gkleanthous.mob wrote:
Hi

I have a page which shows a list of records from a model. I have an "add new" link which opens a form. User fill the form and clicks save. Then an ajax call is done and the new record is saved to the database.

When i visit back the page with the list i do not see the new record, although it is saved in the database. I have to stop the server and restart it in order to see the new records.


Why is this happening?


Please advise.

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+unsubscribe@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/a8e40b18-2cec-4efc-8b12-a2d788161ee8%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+unsubscribe@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/0f5eb0cf-f4ba-5044-06cd-a8bab97f0dba%40djangodeployment.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+unsubscribe@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/A309CA2C-C770-42FE-86C9-52BEA0CE4C60%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.

$
0
0
I'm trying to allow users to login with facebook  via django allauth to my website but I am getting the following error:
URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app's Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.


I configured my Facebook app like this:

1. Made it Public

2.Website
   site URL: http://localhost:8000/ (since I'm running locally)

3. Client OAuth Login -ON
    Web OAuth Login -ON

4.Valid OAuth redirect URIs: what do I put here,  and  is it even necessary to put something? 


--
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+unsubscribe@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/843f37b5-ff60-4638-82ed-ade5bc88b7d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Problem with CircularDependency Model

$
0
0
No, I am trying to deploy it locally. I have no sqlite DB and no migrations. For some strange reason I used to just run manage.py makemigrations and would create the initial migrations for all Apps. This doesn't work for some reason anymore. So I have to to makemigrations APPname for each app and when I run to migrate to create the intial database schema, it doesn't work. So I figured my Data Model is crap.

On Wednesday, May 17, 2017 at 5:41:41 PM UTC+2, Melvyn Sopacua wrote:

On Wednesday 17 May 2017 05:57:57 Tobias Dacoir wrote:

> Thanks Melvyn,

>

> I used promises before, when I use a foreign key for a class that is

> not yet defined, however it didn't change anything for my problem. I

> can make migrations, but not migrate. I am starting with a new

> database from scratch.

> self.ensure_not_cyclic(target, lambda x: (parent.key for parent in

> self. node_map[x].parents))

> File

> "/Users/no68tuh2/.virtualenvs/ihearu/lib/python2.7/site-packages/djang

> o/db/migrations/graph.py" , line 370, in ensure_not_cyclic

> raise CircularDependencyError(", ".join("%s.%s" % n for n in

> cycle)) django.db.migrations.exceptions.CircularDependencyError:

> play.0001_initial, portal.0001_initial

>

> This CircularDependencyError is driving me crazy.

 

Ah, now I see!

This has nothing to do with *model* dependencies. Two *migrations* depend on each other: play and port, both 0001_initial.

 

Do you have any idea how you got into that jam? Did you fiddle with django_migrations table? Maybe run --fake?

--

Melvyn Sopacua

--
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+unsubscribe@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/5bb45dcf-9ced-44b9-96fe-345ab9e0dec3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Selecting overlapping elements from ArrayField of DateTimeRangeField

$
0
0
I answer to my own question. It can't be done :-) The solution needs raw SQL query + subquery (eg. using JOIN LATERAL: https://dba.stackexchange.com/questions/147129/selecting-only-overlapping-elements-from-array-of-ranges )


W dniu czwartek, 18 maja 2017 12:58:35 UTC+2 użytkownik user0008 napisał:
Hello all!

I'm trying to flter query that returns rows from the table along with only elements from the ArrayField that overlap a specified DateTimeTZRange. Example:

import datetime
from psycopg2.extras import DateTimeTZRange

from django.db import models
from django.contrib.postgres.fields importArrayField,DateTimeRangeField


classMyModel(models.Model):
   myfield
=ArrayField(DateTimeRangeField())


d1 = datetime.datetime.now()
d2 = datetime.datetime.now() + datetime.timedelta(days=1)

d3 = datetime.datetime.now() + datetime.timedelta(days=5)
d4 = datetime.datetime.now()+ datetime.timedelta(days=7)


MyModel.objects.create(myfield=[DateTimeTZRange(d1, d2), DateTimeTZRange(d3, d4)])

Filtering by each element of array works as expected:

search_from = datetime.datetime.now()
search_to
= datetime.datetime.now()+ datetime.timedelta(hours=8)

MyModel.objects.filter(myfield__0__overlap=DateTimeTZRange(search_from, search_to))
<QuerySet[<MyModel:MyModel>]>


MyModel.objects.filter(myfield__1__overlap=DateTimeTZRange(search_from, search_to))
<QuerySet[]>

But how to filter by all array fields?

MyModel.objects.filter(myfield__overlap__overlap=DateTimeTZRange(search_from, search_to))
...
FieldError: Unsupported lookup 'overlap' for ArrayField or join on the field not permitted.



MyModel.objects.filter(myfield__0_100000__overlap=DateTimeTZRange(search_from, search_to))
<QuerySet[]>

Thanks for any help.

--
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+unsubscribe@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/dbce520d-8b10-4497-84e3-9da0cb1b056c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Internship

$
0
0


On Wednesday, May 17, 2017 at 3:25:42 PM UTC-4, mark wrote:
A couple of comments..

1. This list is not for job hunting. Learn how to post correctly on email lists. In this instance, you need an OT (Off Topic) at the start of your subject line as this is a list for asking technical questions about Django. More people will want to help you if you respect the purpose of each email list you post on.

I reallly want to aplozgize for my mistake and will never repeat it next time.I also want to thanks for your time to write about the mistakes. 

2. No one will sign in to Google drive to see your resume. It should be readable on your web site in both plain text and pdf (NOT downloads).

So is there anything that you suggest rather than google drive to upload the resume such that is will directly open in browser ? 

3. Never tell a prospective employer that you hate something ("...and just hates Front-end ."). Always tell them what you have accomplished, what you are good at and what you enjoy doing. Always be open minded about learning new things/technologies/etc until you have a lot more experience, many more accomplishments, and at least a hint of gray hair. ;)

Again thanks for the suggestion and now i have changed the intro part :) 

4. If you are going to post the code you wrote, then you better be sure it is golden. functions.php has no comments, poor style, and I have no idea what it does. Not the code I want to have in my products. Learn how to write code that others can easily support, then post that code to your web site so others will be impressed. There are all sorts of style guides for php, python, java, etc. Learn them and apply them to the code you publish for others to see (actually all your code).

5. Not sure what all these courses are listed on your site. Did you take them? If so, then they should be in your resume and not here. If you are just trolling the web for content, don't make me guess what it is and don't make me look at them. You are making yourself look very undesirable as a candidate for an internship by just adding fluff to your github account. Get rid of it. If you are just starting out and don't have a lot of projects, that is OK. Showing me one project where you really excelled  (eg see #4) is far better than a lot of poorly done projects with irrelevant fluff surrounding them.

Now I have pinned the good projects that i have done, now it is looking better.Previously I did now know the feature of pinned repository on github. 

Good luck!

Mark

On Wed, May 17, 2017 at 11:55 AM, Mannu Gupta <abhiman...@gmail.com> wrote:
Hi everyone,

I have been learning on Django for around 6+ months, Now looking for a internship based on it .If anyone know about any internship offer then please let me know.

My Website :- http://theparadoxer02.github.io
Github:-  http://github.com/theparadoxer02

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...@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/f9a00b76-81b3-414b-a53a-84ab2c43a8cf%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+unsubscribe@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/b21e9037-0a3e-4c36-8d5e-8f0787223c03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: vs {{ form }}

$
0
0


On Thu, May 18, 2017 at 8:14 AM, guettli <guettli.google@thomas-guettler.de> wrote:



Am Mittwoch, 17. Mai 2017 23:14:04 UTC+2 schrieb James Schneider:


On May 17, 2017 6:31 AM, "guettli" <guettli...@thomas-guettler.de> wrote:
Hi Russell Keith-Magee,

which version do you use? With <table> or without table?

   <table>{{ form }}</table> vs {{ form }}

Both of these are incorrect.

You need to wrap {{ form }} in a <form> HTML tag. If you want it in a table, use {{ form.as_table }}.


There is no "correct" way, it depends on your template design as to which one is more appropriate.


Hi James,

yes, you are right. Both ways need a surrounding <form> tag. Maybe I condensed my question too much.

I don't understand the "as_table" part you wrote. AFAIK {{ form.as_table }} and {{ form }} return the same result.


Hmm, it appears you're right. I mistakenly though that {{ form }} would result in something similar to {{ form.as_p }}. I haven't rendered a {{ form }} without crispy-forms in quite a while.


Also tested myself quickly on a current project and verified the same.

In that case, both of those formats are valid and effectively equivalent. My original assertion about there being no "correct" format still stands, since that is based on your template design. Adding the <table> tags will place the form inside of a true HTML table. That may or may not be what you want. You may want to be more semantic if using a table and use <table>{{ form.as_table }}</table> just to make it clear that the variable is being rendered as a table, rather than relying on a default output format. That's personal preference, though, but it is slightly safer if the default format for {{ form }} ever changed, which I doubt will be the case any time soon.

Apologies for not checking myself before sending out the response. 

-James

--
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+unsubscribe@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%2Be%2BciWAu90pheRRCeRQVVu87t1WaZYsJZjpg0ejh4y-wa2w7w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Building correct queryset

$
0
0
Hello. I have these two models. I have to show 4 or less products on a page for each brand ordered by score. Please, help construct correct queryset.


class Brand(models.Model):
title = models.CharField(
verbose_name='Название бренда',
max_length=64,
unique=True,
db_index=True,
error_messages={
'unique': 'Бренд с таким именем уже существует.'
}
)

slug = AutoSlugField(
verbose_name='Адрес страницы бренда',
populate_from='title',
editable=True,
unique=True,
slugify=custom_slugify,
db_index=True
)

owner = models.OneToOneField(
to=settings.AUTH_USER_MODEL,
verbose_name='Владелец',
on_delete=models.PROTECT,
)

    score = models.DecimalField(
verbose_name='Рейтинг бренда',
blank=True,
null=True,
max_digits=19,
decimal_places=18,
)


class Product(models.Model):
title = models.CharField(
verbose_name='Название изделия',
max_length=255,
db_index=True,
)

slug = AutoSlugField(
verbose_name='Адрес страницы изделия',
populate_from='title',
editable=False,
unique_with='brand',
slugify=custom_slugify,
db_index=True,
)

brand = models.ForeignKey(
to=Brand,
verbose_name='Бренд',
related_name='products',
on_delete=models.CASCADE,
)

--
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+unsubscribe@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/9ec086f9-c91f-4a8e-b474-9b1d89d1ef2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: vs {{ form }}

$
0
0


Am Freitag, 19. Mai 2017 10:46:02 UTC+2 schrieb James Schneider:


On Thu, May 18, 2017 at 8:14 AM, guettli <guettli...@thomas-guettler.de> wrote:



Am Mittwoch, 17. Mai 2017 23:14:04 UTC+2 schrieb James Schneider:


On May 17, 2017 6:31 AM, "guettli" <guettli...@thomas-guettler.de> wrote:
Hi Russell Keith-Magee,

which version do you use? With <table> or without table?

   <table>{{ form }}</table> vs {{ form }}

Both of these are incorrect.

You need to wrap {{ form }} in a <form> HTML tag. If you want it in a table, use {{ form.as_table }}.


There is no "correct" way, it depends on your template design as to which one is more appropriate.


Hi James,

yes, you are right. Both ways need a surrounding <form> tag. Maybe I condensed my question too much.

I don't understand the "as_table" part you wrote. AFAIK {{ form.as_table }} and {{ form }} return the same result.


Hmm, it appears you're right. I mistakenly though that {{ form }} would result in something similar to {{ form.as_p }}. I haven't rendered a {{ form }} without crispy-forms in quite a while.


Also tested myself quickly on a current project and verified the same.

In that case, both of those formats are valid and effectively equivalent. My original assertion about there being no "correct" format still stands, since that is based on your template design. Adding the <table> tags will place the form inside of a true HTML table. That may or may not be what you want. You may want to be more semantic if using a table and use <table>{{ form.as_table }}</table> just to make it clear that the variable is being rendered as a table, rather than relying on a default output format. That's personal preference, though, but it is slightly safer if the default format for {{ form }} ever changed, which I doubt will be the case any time soon.

Apologies for not checking myself before sending out the response. 



No need to apology :-)

Up to now I don't use crispy forms. I think a lot of people use it. Maybe I should try it.

Regards,
  Thomas

--
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+unsubscribe@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/6b5594f4-541a-4f3c-9754-9354a6f05a4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Problem with CircularDependency Model

$
0
0

On Friday 19 May 2017 00:19:04 Tobias Dacoir wrote:

> No, I am trying to deploy it locally. I have no sqlite DB and no

> migrations. For some strange reason I used to just run manage.py

> makemigrations and would create the initial migrations for all Apps.

> This doesn't work for some reason anymore. So I have to to

> makemigrations APPname for each app and when I run to migrate to

> create the intial database schema, it doesn't work. So I figured my

> Data Model is crap.

 

Yep, let me see if I got it right:

- The User model is defined as AUTH_USER_MODEL in settings.py

- User points to institute

- Institute points to User

 

So it is in fact a circular dependency on the model level as well. And one you don't need.

 

From the way you defined the related_name it is also clear you don't get the RelatedObject principle of Django.

 

A ForeignKey creates a bridge between two models: you can travel in both directions. Using your models:

 

class User(AbstractBaseUser, PermissionsMixin):

username = ...

 

class Institute(models.Model):

master_user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='institute')

members = models.ManyToManyField(settings.AUTH_USER_MODEL)

 

Because of the ForeignKey on Institute, Django creates an attribute on User, called 'institute'. It uses institute, because I specified that as related_name. You could use a different name there, but it has to be a name that can be used on the model you point to.

 

However, this isn't a good representation of realitity, given your own description.

So this is a better way to do it:

 

class User(AbstractBaseUser, PermissionsMixin):

institute = models.ForeignKey('port.Institute', related_name='members')

is_master_user = models.BooleanField(default=False)

 

class Institute(models.Model)

name = models.CharField(max_length=255)

# members is now created by the foreign key

@property

def master_user(self):

return self.members.get(is_master_user=True)

 

This model is much simpler. All you need to do is to verify that when someone is made master user, that all other members of the institute are *not* master user.

 

You can do this in a post_save signal or in the clean method of User , both with its own caveats.

 

Another way would be to define a MasterUser model, which is easier to maintain in the admin:

 

class MasterUser(models.Model):

# Assume one person can be master user of many institutes

# if not, this also has to be a OneToOneFIeld

user = models.ForeignKey(settings.AUTH_USER_MODEL)

institute = models.OneToOneField(Institute, related_name='master_user')

 

 

 

 

> On Wednesday, May 17, 2017 at 5:41:41 PM UTC+2, Melvyn Sopacua wrote:

> > On Wednesday 17 May 2017 05:57:57 Tobias Dacoir wrote:

> > > Thanks Melvyn,

> > >

> > >

> > >

> > > I used promises before, when I use a foreign key for a class that

> > > is

> > >

> > > not yet defined, however it didn't change anything for my problem.

> > > I

> > >

> > > can make migrations, but not migrate. I am starting with a new

> > >

> > > database from scratch.

> > >

> > > self.ensure_not_cyclic(target, lambda x: (parent.key for parent in

> > >

> > > self. node_map[x].parents))

> > >

> > > File

> > >

> > > "/Users/no68tuh2/.virtualenvs/ihearu/lib/python2.7/site-packages/d

> > > jang

> > >

> > > o/db/migrations/graph.py" , line 370, in ensure_not_cyclic

> > >

> > > raise CircularDependencyError(", ".join("%s.%s" % n for n in

> > >

> > > cycle)) django.db.migrations.exceptions.CircularDependencyError:

> > >

> > > play.0001_initial, portal.0001_initial

> > >

> > >

> > >

> > > This CircularDependencyError is driving me crazy.

> >

> > Ah, now I see!

> >

> > This has nothing to do with *model* dependencies. Two *migrations*

> > depend on each other: play and port, both 0001_initial.

> >

> >

> >

> > Do you have any idea how you got into that jam? Did you fiddle with

> > django_migrations table? Maybe run --fake?

> >

> >

> > Melvyn Sopacua

 

--

Melvyn Sopacua

Re: Django Channels error : (index):173 Disconnected from chat socket websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404 connect @

$
0
0
THis is the new error that im getting after fixing my redis configuration in the settings.py 

WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.


On Thursday, May 18, 2017 at 2:08:05 PM UTC-5, djangorobert wrote:



On Wednesday, May 17, 2017 at 3:59:47 PM UTC-5, djangorobert wrote:
currently getting this error : 
WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):174 Disconnected from chat socket

On Tuesday, May 16, 2017 at 11:31:19 PM UTC-5, djangorobert wrote:
thanks ya that seemed to help a little now im running into a new error: 

WebSocket connection to 'ws://www.openchat.us/griper' failed: WebSocket is closed before the connection is established.
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/griper' failed: Error during WebSocket handshake: Unexpected response code: 403
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket

hmmm :)

On Tuesday, May 16, 2017 at 8:26:18 PM UTC-5, Dylan Reinhold wrote:
Sorry sounds like you will need to configure somting in your webfaction controll panel.

Here is another person with same issue, they said it fixed it for them.
https://github.com/django/channels/issues/445

On Tue, May 16, 2017 at 5:46 PM, djangorobert <djangoc...@gmail.com> wrote:
hi Dylan Im usingWebfaction Im kind of new to django channels 
my website is www.openchat.us 

do you mean redisserver ?

or are you refering to the commands python mange.py runserver or runworkder? because with those commancds im kind of confused when ussing webfaction 
im using putty to enter the commands to my webfaction account

On Tuesday, May 16, 2017 at 5:49:04 PM UTC-5, Dylan Reinhold wrote:
How are you running the web server?
Looks like your web socket traffic is not being set to daphene. Probably hitting the regular django listener and its returning a 404.

Dylan

On Tue, May 16, 2017 at 3:39 PM, djangorobert <djangoc...@gmail.com> wrote:
working on the Django channels example : multi chat on Github 
but am getting this error


(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
2(index):173 Disconnected from chat socket
2websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
(index):1 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: WebSocket is closed before the connection is established.
2(index):173 Disconnected from chat socket
(index):1 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: WebSocket is closed before the connection is established.
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
2(index):173 Disconnected from chat socket
2websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
(index):1 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: WebSocket is closed before the connection is established.
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket
websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Unexpected response code: 404
connect @ websocketbridge.js:118
(index):173 Disconnected from chat socket


not sure if anyone has used this example in a production enviorment? 
in google browser when you click on tools it will provide this error
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...@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/11602fb3-87fc-452c-adbe-b151519e3acc%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...@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/f34f210a-a2a9-4354-bd41-8dac8f7380b2%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+unsubscribe@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/9fa6b5d8-de16-45c2-9efd-31aabb78d789%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0
Hi hoping somebody in the entire Djang Users can help me solve this problem its been going on for about a week now Im using the django channels example on github the "Multichat" example I am using webfaction. 

my website for this test is www.openchat.us but when you go to the site it throws an error the error that i am getting is this: 
WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.


settings.py 

CHANNEL_LAYERS = {
   "default": {
        "BACKEND": "asgi_redis.RedisChannelLayer",
        "CONFIG": {
        },
        "ROUTING": "myproject.routing.channel_routing",
   },
}




redis_host = os.environ.get('REDIS_HOST', 'localhost')


INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myproject',
    'channels',
    'chat',
]


command that im using to launch daphne is : daphne -p 24711 myproject.asgi:channel_layer

$ daphne -p 27411 myproject.asgi:channel_layer
2017-05-19 16:52:40,360 INFO     Starting server at tcp:port=27411:interface=127.0.0.1, channel layer myproject.asgi:channel_layer.
2017-05-19 16:52:40,360 INFO     HTTP/2 support enabled
2017-05-19 16:52:40,360 INFO     Using busy-loop synchronous mode on channel layer
2017-05-19 16:52:40,361 INFO     Listening on endpoint tcp:port=27411:interface=127.0.0.1

--
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+unsubscribe@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/84199dbf-942d-43e4-9f08-098bc5cda922%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0
One qustion i do have is do I leave it as localhost ? or do i change that to a different IP address or www.openchat.us ? thanks

On Friday, May 19, 2017 at 11:53:37 AM UTC-5, djangorobert wrote:
Hi hoping somebody in the entire Djang Users can help me solve this problem its been going on for about a week now Im using the django channels example on github the "Multichat" example I am using webfaction. 

my website for this test is www.openchat.us but when you go to the site it throws an error the error that i am getting is this: 
WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.


settings.py 

CHANNEL_LAYERS = {
   "default": {
        "BACKEND": "asgi_redis.RedisChannelLayer",
        "CONFIG": {
        },
        "ROUTING": "myproject.routing.channel_routing",
   },
}




redis_host = os.environ.get('REDIS_HOST', 'localhost')


INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myproject',
    'channels',
    'chat',
]


command that im using to launch daphne is : daphne -p 24711 myproject.asgi:channel_layer

$ daphne -p 27411 myproject.asgi:channel_layer
2017-05-19 16:52:40,360 INFO     Starting server at tcp:port=27411:interface=127.0.0.1, channel layer myproject.asgi:channel_layer.
2017-05-19 16:52:40,360 INFO     HTTP/2 support enabled
2017-05-19 16:52:40,360 INFO     Using busy-loop synchronous mode on channel layer
2017-05-19 16:52:40,361 INFO     Listening on endpoint tcp:port=27411:interface=127.0.0.1

--
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+unsubscribe@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/6abd0b3f-f1c8-4661-804b-b69c6598bc35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

multiple db in admin [how-to]

$
0
0

Hi guys,

Could you please advise in the following:

registry is the project, BGP is the app, default is the sqlite db, registry is a postgres db

the admin.py looks like this:

classMultiDBModelAdmin(admin.ModelAdmin):# A handy constant for the name of the alternate database.      using ="registry"def save_model(self, request, obj, form, change):# Tell Django to save objects to the 'other' database.          obj.save(using=self.using)def delete_model(self, request, obj):# Tell Django to delete objects from the 'other' database          obj.delete(using=self.using)def get_queryset(self, request):# Tell Django to look for objects on the 'other' database.return super(MultiDBModelAdmin, self).get_queryset(request).using(self.using)def formfield_for_foreignkey(self, db_field, request,**kwargs):# Tell Django to populate ForeignKey widgets using a query# on the 'other' database.return super(MultiDBModelAdmin, self).formfield_for_foreignkey(db_field, request, using=self.using,**kwargs)def formfield_for_manytomany(self, db_field, request,**kwargs):# Tell Django to populate ManyToMany widgets using a query# on the 'other' database.return super(MultiDBModelAdmin, self).formfield_for_manytomany(db_field, request, using=self.using,**kwargs)classBGPcommunitiesAdmin(MultiDBModelAdmin):        list_display    =("comm_name","comm_value","used_as","label","modified_on")      search_fields   =("comm_name","comm_value","label")      list_filter     =("used_as","modified_on")      admin.site.register(BGPcommunities,BGPcommunitiesAdmin)    registryadmin = admin.AdminSite("registryadmin")  registryadmin.register(BGPcommunities,BGPcommunitiesAdmin)

and the urls.py looks like this:

from BGP.admin import registryadmin    urlpatterns =[      url(r'^admin/', admin.site.urls),      url(r'^registryadmin/', registryadmin.urls),]

The issue is that I cannot save any record in the database (the table is not found).

This can be fixed by tweaking /usr/lib/python2.7/site-packages/django/db/models/query.py:

def exists(self):      other_db ='registry'if self._result_cache isNone:try:return self.query.has_results(using=self.db)except:return self.query.has_results(using=other_db)return bool(self._result_cache)

The original version was:

def exists(self):if self._result_cache isNone:return self.query.has_results(using=self.db)return bool(self._result_cache)

Could you please advise who to solve this the proper way ? It seems that the connection tot he databases is not using the registry database, but the default one.


--
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+unsubscribe@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/750705f7-2e04-4ca8-9747-7552f2475c4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

django Select or RadioSelect does not work.

$
0
0
Hi,

Below is my code. If I use
  widget=forms.CheckboxSelectMultiple or SelectMultiple, it works for me.
But if I use Select or RadioSelect (I want only one to be selected): this doesn't work.

If I use 'Select', I get the list of versions  (e.g 5.6 and 5.7). If I select 5.7 and click on 'Upgrade', it returns with a message saying 'Enter the list of values'. Not sure what's wrong with 'Select'?

Thanks in advance.

                self.fields[instance_choice[0]] = forms.MultipleChoiceField(
                    label=_("Available Versions"),
                    required=False,
                    widget=forms.Select(
                        attrs={'class': 'switched',
                               'data-switch-on': 'instance',
                               dataKey: instance_choice[0]}))

                # Populate field with choices
                version_choices = []

                try:
                    # Retrieve the available datastore versions
                    ds_versions = trove_api.trove.datastore_version_list(request, instance.datastore['type'])
                except Exception as e:
                    logging.error("%s: Exception received trying to retrieve datastore versions for datastore %s. "
                                  "Exception is: %s",
                                  __method__, instance.datastore['type'], e)

                for avail_version in ds_versions:
                    version_choices.append((avail_version.name, avail_version.name))

                    self.fields[instance_choice[0]].choices = version_choices

--
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+unsubscribe@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/d4f982d8-1dd3-4415-a80c-9ac28835046a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Building correct queryset

$
0
0
brand =Brand.objects.get(title='mybrand')
products
=Product.objects.filter(brand=brand).order_by('-score')[:4]

...gets you the top 4 products in order for the brand

On Friday, May 19, 2017 at 10:32:49 AM UTC+1, Горобец Дмитрий wrote:
Hello. I have these two models. I have to show 4 or less products on a page for each brand ordered by score. Please, help construct correct queryset.


class Brand(models.Model):
title = models.CharField(
verbose_name='Название бренда',
max_length=64,
unique=True,
db_index=True,
error_messages={
'unique': 'Бренд с таким именем уже существует.'
}
)

slug = AutoSlugField(
verbose_name='Адрес страницы бренда',
populate_from='title',
editable=True,
unique=True,
slugify=custom_slugify,
db_index=True
)

owner = models.OneToOneField(
to=settings.AUTH_USER_MODEL,
verbose_name='Владелец',
on_delete=models.PROTECT,
)

    score = models.DecimalField(
verbose_name='Рейтинг бренда',
blank=True,
null=True,
max_digits=19,
decimal_places=18,
)


class Product(models.Model):
title = models.CharField(
verbose_name='Название изделия',
max_length=255,
db_index=True,
)

slug = AutoSlugField(
verbose_name='Адрес страницы изделия',
populate_from='title',
editable=False,
unique_with='brand',
slugify=custom_slugify,
db_index=True,
)

brand = models.ForeignKey(
to=Brand,
verbose_name='Бренд',
related_name='products',
on_delete=models.CASCADE,
)

--
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+unsubscribe@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/c8d4f47e-10b8-4ddf-95f5-23f8c4d05cf7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0

    var connect = function () {
        log('connect');
        var oldWs = ws;
        ws = new config.constructor(url, protocols);

thats part of what the error points me to in google tools: 




(index):182 Disconnected from chat socket
VM170 websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Invalid status line
connect @ VM170 websocketbridge.js:118
(index):182 Disconnected from chat socket
On Friday, May 19, 2017 at 11:53:37 AM UTC-5, djangorobert wrote:
Hi hoping somebody in the entire Djang Users can help me solve this problem its been going on for about a week now Im using the django channels example on github the "Multichat" example I am using webfaction. 

my website for this test is www.openchat.us but when you go to the site it throws an error the error that i am getting is this: 
WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.


settings.py 

CHANNEL_LAYERS = {
   "default": {
        "BACKEND": "asgi_redis.RedisChannelLayer",
        "CONFIG": {
        },
        "ROUTING": "myproject.routing.channel_routing",
   },
}




redis_host = os.environ.get('REDIS_HOST', 'localhost')


INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'myproject',
    'channels',
    'chat',
]


command that im using to launch daphne is : daphne -p 24711 myproject.asgi:channel_layer

$ daphne -p 27411 myproject.asgi:channel_layer
2017-05-19 16:52:40,360 INFO     Starting server at tcp:port=27411:interface=127.0.0.1, channel layer myproject.asgi:channel_layer.
2017-05-19 16:52:40,360 INFO     HTTP/2 support enabled
2017-05-19 16:52:40,360 INFO     Using busy-loop synchronous mode on channel layer
2017-05-19 16:52:40,361 INFO     Listening on endpoint tcp:port=27411:interface=127.0.0.1

--
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+unsubscribe@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/cc6b6004-0947-4aca-9a5b-704b967538e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0


On May 19, 2017 8:02 PM, "djangorobert" <djangocharm2020@gmail.com> wrote:

    var connect = function () {
        log('connect');
        var oldWs = ws;
        ws = new config.constructor(url, protocols);

thats part of what the error points me to in google tools: 




(index):182 Disconnected from chat socket
VM170 websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Invalid status line
connect @ VM170 websocketbridge.js:118
(index):182 Disconnected from chat socket
On Friday, May 19, 2017 at 11:53:37 AM UTC-5, 


Not sure if Web sockets have this problem, but I've seen invalid handshake errors come about when one side is using HTTPS and the other is just using HTTP. Perhaps connect to wss:// instead of ws://? I think that's the secure protocol for web sockets.

-James

--
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+unsubscribe@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%2Be%2BciVs9kDEzAChJ_vC60w2jqii%2Bi25kF-evsVUq65hA0W_-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0
Thanks james going to try it out will post my results in a bit thank you for your time its appreciated.

On Friday, May 19, 2017 at 11:21:33 PM UTC-5, James Schneider wrote:


On May 19, 2017 8:02 PM, "djangorobert" <djangoc...@gmail.com> wrote:

    var connect = function () {
        log('connect');
        var oldWs = ws;
        ws = new config.constructor(url, protocols);

thats part of what the error points me to in google tools: 




(index):182 Disconnected from chat socket
VM170 websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Invalid status line
connect @ VM170 websocketbridge.js:118
(index):182 Disconnected from chat socket
On Friday, May 19, 2017 at 11:53:37 AM UTC-5, 


Not sure if Web sockets have this problem, but I've seen invalid handshake errors come about when one side is using HTTPS and the other is just using HTTP. Perhaps connect to wss:// instead of ws://? I think that's the secure protocol for web sockets.

-James

--
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+unsubscribe@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/b018828e-e45f-4040-b0a1-9909d5e1a789%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Re: Django Channels Error: WebSocket connection to 'ws://openchat.us:24711/' failed: WebSocket is closed before the connection is established.

$
0
0
hi james im going off of andrew godwins django channels example on github the multi chat example and using Webfactions hosting services. 
im  getting the error of the websocket being closed
I know your saying to maybe chaning it to wss instead of ws do you mean to change it in the javascript that is in the django channels github for multichat js file ?

On Friday, May 19, 2017 at 11:21:33 PM UTC-5, James Schneider wrote:


On May 19, 2017 8:02 PM, "djangorobert" <djangoc...@gmail.com> wrote:

    var connect = function () {
        log('connect');
        var oldWs = ws;
        ws = new config.constructor(url, protocols);

thats part of what the error points me to in google tools: 




(index):182 Disconnected from chat socket
VM170 websocketbridge.js:118 WebSocket connection to 'ws://www.openchat.us/chat/stream/' failed: Error during WebSocket handshake: Invalid status line
connect @ VM170 websocketbridge.js:118
(index):182 Disconnected from chat socket
On Friday, May 19, 2017 at 11:53:37 AM UTC-5, 


Not sure if Web sockets have this problem, but I've seen invalid handshake errors come about when one side is using HTTPS and the other is just using HTTP. Perhaps connect to wss:// instead of ws://? I think that's the secure protocol for web sockets.

-James

--
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+unsubscribe@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/c4eb889f-c0da-4f6c-9f08-8bfee0ef841d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Viewing all 28280 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>