我今天第一次阅读django-channels的文档,发现以下行Channels will take care of scheduling them and running them all in parallel.这是否意味着,它也执行 celery 任务?我曾经对芹菜、rabbitmq、mqtt 感到困惑。我以为我很清楚,我对 celery、rabbitmq 和 mqtt 的理解是
celery - 后台作业,任务调度
rabbitmq - 消息代理,向工作人员发送消息
mqtt - 这也是另一个消息队列
在我的理解中,celery 执行后台工作任务以及 rabbitmq 任务或 mqtt 任务。
所以我的问题是,当使用django-channel 时,我们是否需要使用那些列出的堆栈(芹菜,rabbitmq)?如果需要,为什么需要它?我查看了几篇文章,但无法清楚地获得洞察力。我觉得他们的用例有点相似。谁能用现实生活中的例子消除我的困惑?
我很难用Django Rest Framework进行多个图像上传.我想要的是,有一个租赁表,用户可以一次填写租赁信息和多个图像(图像可以像厨房,客厅,浴室等)对于他们想要注册的租金.一个租金可以有多个图像,所以我有多个关系的图像字段.我无法将多个图像发送到服务器或api.只有一个图像用于存储在服务器上,但在更改我的数据库设计并转到ManyToManyField选项后,即使单个图像也不会存储.
settings.py
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR,'media')
Run Code Online (Sandbox Code Playgroud)
Models.py
class Gallery(models.Model):
image = models.FileField(null=True,blank=True,upload_to='upload/')
class Meta:
verbose_name = _('Gallery')
verbose_name_plural = _('Galleries')
class Rental(models.Model):
listingName = models.CharField(_("Lisitng Name"), max_length=255, blank=False, null=True,
help_text=_("Title of the rental space"))
property = models.CharField(_("Property type"),max_length=10,null=True)
room = models.PositiveIntegerField(_("No of Rooms"), blank=False, null=True,
help_text=_("Number of bedrooms available"))
price = models.PositiveIntegerField(blank=False,null=True)
city = models.CharField(_("City"), max_length=255, blank=False, null=True)
image = models.ManyToManyField(Gallery)
Run Code Online (Sandbox Code Playgroud)
Serializers.py
class GallerySerializer(serializers.ModelSerializer):
class Meta:
model = Gallery
fields=('pk','image')
class RentalSerializer(serializers.ModelSerializer):
image …Run Code Online (Sandbox Code Playgroud) 当我执行 python manage.py runserver 时,我不断收到相同的错误。当我有ubuntu 15.10时没有这样的错误。这是当我将 ubuntu 升级到 16.04 时开始的。这个问题可能看起来重复,但我尝试过为这个问题提供的解决方案,就像我应用了命令 dpkg --configure -a,我已经完成了 apt-get update、upgrade、dist-upgrade、clean、-f install 。我也重新安装了 python2.7 和 python3 但没有成功。这是我尝试运行 django 应用程序时的屏幕截图
我在重新安装 python 后得到了这个
.bashrc 文件
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
export PYTHONHOME="/usr/bin/python"
echo $VIRTUALENVWRAPPER_PYTHON
echo 'tushant'
# don't put duplicate lines or lines starting with space in …Run Code Online (Sandbox Code Playgroud) 我正在研究chrome扩展,它只专注于gmail消息.该扩展仅用于gmail消息,但为此我需要找出登录用户的电子邮件地址.我已创建登录功能以在弹出窗口中使用扩展程序,我需要"登录用户电子邮件地址"以检查登录扩展程序的用户是否与该电子邮件地址匹配.
我在后台脚本(background.js)中尝试了两件事.
chrome.cookies.getAll({ domain: 'accounts.google.com' }, function(cookies) {
console.log('accounts.google.com cookies', cookies);
});
chrome.identity.getProfileUserInfo(function(profile) {
console.log('profile', profile);
});
Run Code Online (Sandbox Code Playgroud)
第一种方法给了我一个空数组
第二种方法给我一个空电子邮件和id的对象
有人可以帮我提供找到登录用户电子邮件地址的可靠解决方案吗?
UPDATE
我发现chrome.identity.getProfileUserInfo(function(profile) {这给了我在chrome中注册的电子邮件,而不是登录的gmail电子邮件地址.
我正在尝试创建一个简单的编辑器来编写故事情节。现在我可以在编辑器中显示 html 标记,其中粗体文本以粗体等显示。我也可以将 html 形式的数据发送到服务器,但我无法在编辑器中显示图像,也无法上传图像在编辑器中。我已经创建了它的代码和盒子。链接在这里
https://codesandbox.io/s/5w4rp50qkp
代码行有点大。这就是为什么我将代码发布在 codeandbox 中,您也可以在其中看到演示。
任何人都可以帮助我使这成为可能吗?
django ×3
javascript ×2
python ×2
ajax ×1
celery ×1
django-1.9 ×1
draftjs ×1
rabbitmq ×1
reactjs ×1
ubuntu ×1
ubuntu-16.04 ×1