我有一个功能:
def create(sender, **kw):
[...]
Run Code Online (Sandbox Code Playgroud)
当调用 django-registration 的 user_activated 信号时应该调用它。
我使用以下方法连接信号和函数:
from registration.signals import user_activated
[...]
post_save.connect(create, sender=user_activated, dispatch_uid="users-atactivation-signal")
Run Code Online (Sandbox Code Playgroud)
但是,当用户单击通过电子邮件收到的激活链接时,不会调用该函数。
我在这里想念什么。
我正在使用django-paypal,我想向我的用户收取€而不是$.我没有找到改变这种行为的方法(货币总是美元).但我非常确定有办法做到这一点.
我用python解析一个网站.他们使用了很多重定向,他们通过调用javascript函数来完成它们.
因此,当我只使用urllib来解析网站时,它对我没有帮助,因为我在返回的html代码中找不到目标网址.
有没有办法访问DOM并从我的python代码调用正确的JavaScript函数?
我需要的只是网址,重定向带我.
在我看来,我有时会使用这个:
return HttpResponseRedirect("/account/")
Run Code Online (Sandbox Code Playgroud)
但是在我看来这是硬编码的网址,我认为这不是很好.
那么替代方案是什么?我知道我可以直接从urls.py文件中,在我的模板中通过{%url%}标签生成网址,因此我必须在我的视图中执行某些操作,对吧?
我在django应用程序中使用django-paypal作为付款解决方案。我正在尝试实现IPN处理程序。
当我在IPN处理URL处收到IPN消息时,django服务器崩溃会发生什么:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 281, in run
self.finish_response()
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 321, in finish_response
self.write(data)
File "/usr/local/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 417, in write
self._write(data)
File "/usr/lib/python2.6/socket.py", line 300, in write
self.flush()
File "/usr/lib/python2.6/socket.py", line 286, in flush
self._sock.sendall(buffer)
error: [Errno 104] Connection reset by peer
Run Code Online (Sandbox Code Playgroud)
我的付款应用程序urls.py看起来像这样:
urlpatterns = patterns('mysite.payment.views',
(r'^thank_you/', 'thank_you'),
(r'^canceled/', 'canceled'),
(r'^paypal-ipn/', include('paypal.standard.ipn.urls'))
)
Run Code Online (Sandbox Code Playgroud)
对我来说,错误消息是毫无用处的。如果有人可以帮助我,那会很好。