Issue with post_save signal only when using https

92 views
Skip to first unread message

Shawn H

unread,
Nov 13, 2015, 12:45:05 PM11/13/15
to Django users
I have a post_save signal on a model. There are many different places where this model gets updated and saved, which is why I'm using the signal, to ensure each time the model is changed, the same code gets called. I make the calls to save the model instances via a jQuery post. When I run this on my local machine and test servers, the code works perfectly. When I move it to my production server, which is the only one running https, I get ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it')) back from the server. What can I do to fix this? Let me know what code might be helpful if necessary, and thanks in advance for the help. I'm using Django 1.8.2

James Schneider

unread,
Nov 13, 2015, 12:57:37 PM11/13/15
to django...@googlegroups.com
On Fri, Nov 13, 2015 at 9:45 AM, Shawn H <shawn....@gmail.com> wrote:
I have a post_save signal on a model. There are many different places where this model gets updated and saved, which is why I'm using the signal, to ensure each time the model is changed, the same code gets called. I make the calls to save the model instances via a jQuery post. When I run this on my local machine and test servers, the code works perfectly. When I move it to my production server, which is the only one running https, I get ('Connection aborted.', error(10061, 'No connection could be made because the target machine actively refused it')) back from the server. What can I do to fix this? Let me know what code might be helpful if necessary, and thanks in advance for the help. I'm using Django 1.8.2

Are you specifying a full path for the redirect that doesn't include HTTPS? I would assume that all of your redirects would be relative if built via standard Django mechanisms, but you mentioned JQuery, so I could see JavaScript not generating the correct URL if you aren't careful. Is your production server listening on tcp/80 (HTTP) at all?

-James 

Shawn H

unread,
Nov 13, 2015, 2:04:05 PM11/13/15
to Django users
The return is a JsonResponse instead of a redirect. The production server does listen on port 80, but has a permanent redirect to port 443 on the web server. The thing that's confusing is I'm using this pattern with other models, with the exception of the post_save signal, and I have no problems, even on https. I can save the object and return a JsonResponse no problem. It seems to be exclusively the signal that causes the issue, as far as I can tell.

James Schneider

unread,
Nov 13, 2015, 2:18:14 PM11/13/15
to django...@googlegroups.com
On Fri, Nov 13, 2015 at 11:04 AM, Shawn H <shawn....@gmail.com> wrote:
The return is a JsonResponse instead of a redirect. The production server does listen on port 80, but has a permanent redirect to port 443 on the web server. The thing that's confusing is I'm using this pattern with other models, with the exception of the post_save signal, and I have no problems, even on https. I can save the object and return a JsonResponse no problem. It seems to be exclusively the signal that causes the issue, as far as I can tell.

That doesn't make sense. What process is generating the URL for the redirect? Have you validated that the redirect is pointing at the right location?

Where exactly are you seeing this message? Have you installed django-debug-toolbar and told it to intercept the redirects so that you can examine them?

I guess the better question is how a redirect is involved if your updates are pushed via JQuery? Or do you have other regular web forms that modify this model as well?

-James

Shawn H

unread,
Nov 13, 2015, 2:39:44 PM11/13/15
to Django users
OMG. I tracked it down. It has nothing to do with signals nor with https. I had a setting wrong on my production box that sent a request to the wrong location. Stupid! Thanks regardless for responding and trying to help.
Reply all
Reply to author
Forward
0 new messages