我正在制作一个 Django 应用程序。为了根据行和评论计算提要的排名,我正在尝试使用 django-background-tasks。我在节点模型中使用的功能是:
@background(schedule=60)
def get_score(self):
p = self.likes+self.comments # popularity
t = (now()-self.date).total_seconds()/3600 # age_in_hrs
# last_activity =
n = self.admin_score
score = (p/pow((t+1), 1.2))*n
self.score = score
return score
Run Code Online (Sandbox Code Playgroud)
但我没有看到分数有任何变化。这意味着我正在以正确的方式做这件事,但我缺少基本概念。有人可以告诉我如何使用 django-background-tasks 来安排任务或向我推荐一些现有的文档。
我正在通过 facebook 和 google 在我的应用程序中使用 django-allauth 进行用户注册。我可以显示用户的 Facebook 图像。但我不知道如何为谷歌做到这一点。对于Facebook,我遵循了本教程http://www.sarahagstrom.com/2013/09/the-missing-django-allauth-tutorial/
有人可以建议我如何在我的网站中显示用户的谷歌帐户图像。
我正在使用Django 1.7并进行身份验证我正在使用Django allauth.为了发送电子邮件,我开始使用zoho smtp服务器.它能够发送普通和交易邮件,但无法发送注册会话电子邮件.它显示错误:
SMTPDataError at /accounts/signup/
(553, b'Relaying disallowed as webmaster@localhost')
Run Code Online (Sandbox Code Playgroud)
追溯是:
69. return self.dispatch(request, *args, **kwargs)
File "C:\Python34\lib\site-packages\django\utils\decorators.py" in _wrapper
29. return bound_func(*args, **kwargs)
File "C:\Python34\lib\site-packages\django\views\decorators\debug.py" in sensitive_post_parameters_wrapper
76. return view(request, *args, **kwargs)
File "C:\Python34\lib\site-packages\django\utils\decorators.py" in bound_func
25. return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\Users\sp\industryo\allauth\account\views.py" in dispatch
167. return super(SignupView, self).dispatch(request, *args, **kwargs)
File "C:\Users\sp\industryo\allauth\account\views.py" in dispatch
62. **kwargs)
File "C:\Users\sp\industryo\allauth\account\views.py" in dispatch
145. **kwargs)
File "C:\Python34\lib\site-packages\django\views\generic\base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "C:\Users\sp\industryo\allauth\account\views.py" in post
78. …Run Code Online (Sandbox Code Playgroud) 我正在使用Django 1.7和python 3.4.我正在尝试使用django-allauth进行用户身份验证,我正在关注此链接http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/ 但是我在尝试时遇到此问题迁移应用程序.
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django\apps\config.py", line 118, in creat
e
cls = getattr(mod, cls_name)
AttributeError: 'module' object has no attribute 'sitesallauth'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
385, in execute_from_command_line
utility.execute()
File "C:\Python34\lib\site-packages\django\core\management\__init__.py", line
354, in execute
django.setup()
File "C:\Python34\lib\site-packages\django\__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python34\lib\site-packages\django\apps\registry.py", line 85, in popu
late
app_config = AppConfig.create(entry) …Run Code Online (Sandbox Code Playgroud)