我的一些远程Celery任务似乎永远不会成为我的经纪人(RabbitMQ).这appears是随机发生的.我的日志中没有错误,它们永远不会发送给工作人员或失败.Flower/Rabbit从不报告任务失败.
我曾经tcpflow -p -c -i eth0 port 5672监控发送任务的API上的流量(client).
当API成功发送任务时,传出流量的记录如下:
(删除敏感数据)
192.018.000.002.42738-052.048.150.171.05672: AMQP
052.048.150.171.05672-192.018.000.002.42738:
capabilitiesFpublisher_confirmstexchange_exchange_bindingst
basic.nacktconsumer_cancel_notifytconnection.blockedtconsumer_prioritiestauthentication_failure_closetper_consumer_qostcluster_nameSrabbit@d8b85eb5ab91copyrightS.Copyright (C) 2007-2015 Pivotal Software, Inc.informationS5Licensed under the MPL. See http://www.rabbitmq.com/platformS
Erlang/OTPproductSRabbitMQversionS3.6.0PLAIN AMQPLAINen_US
192.018.000.002.42738-052.048.150.171.05672:
nproductSpy-amqpproduct_versionS1.4.9capabilitiesF.connection.blockedtconsumer_cancel_notifytAMQPLAIN1LOGINSusernamePASSWORDSxxxxxxen_US
052.048.150.171.05672-192.018.000.002.42738:
<
192.018.000.002.42738-052.048.150.171.05672:
192.018.000.002.42738-052.048.150.171.05672:
(/
052.048.150.171.05672-192.018.000.002.42738:
)
192.018.000.002.42738-052.048.150.171.05672:
052.048.150.171.05672-192.018.000.002.42738:
192.018.000.002.42738-052.048.150.171.05672: $(
estimate_geometrydirect
052.048.150.171.05672-192.018.000.002.42738: (
192.018.000.002.42738-052.048.150.171.05672: 2
estimate_geometry
052.048.150.171.05672-192.018.000.002.42738: 2estimate_geometry
192.018.000.002.42738-052.048.150.171.05672: G2estimate_geometryestimate_geometrytasks.estimate_geometry
052.048.150.171.05672-192.018.000.002.42738: 2
192.018.000.002.42738-052.048.150.171.05672: 1<(estimate_geometrytasks.estimate_geometry
192.018.000.002.42738-052.048.150.171.05672: <application/x-python-serializebinary$021e5308-e6ac-43eb-9a06-8473ba386802$bedeb08f-9614-38b1-9b60-9eded43c3c71
192.018.000.002.42738-052.048.150.171.05672: }q(UexpiresqNUutcqUargsq]qCaUchordqNUcallbacksqNUerrbacksqNUtasksetqNUidq
Utasks.estimate_geometryqUtimelimitqNNUetaqNUkwargsq}qu.
192.018.000.002.42738-052.048.150.171.05672: (
segment_imagedirect
052.048.150.171.05672-192.018.000.002.42738: (
192.018.000.002.42738-052.048.150.171.05672: 2
segment_image
segment_image71.05672-192.018.000.002.42738: …Run Code Online (Sandbox Code Playgroud) 当我尝试在运行10.8的MAC上的virtualenv中安装MySQL-python时出现以下错误.
vertualenv EnvironmentError: mysql_config not found
Run Code Online (Sandbox Code Playgroud) 如何确定安装的ColdFusion服务器是32位还是64位?
我很乐意看到一个解决我的问题的答案,无论是登录服务器还是以编程方式从CFML代码.
我已经设置了一个新的Amazon Linux实例,下一步安装Railo的步骤是什么?
尝试运行Django开发服务器时出现以下错误.我正在使用OS X 10.8.我还使用virtualenv系统安装包.
(django-env)Glyns-iMac:Ares Glyn$ sudo python manage.py runserver
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 217, in execute
translation.activate('en-us')
File "/Library/Python/2.7/site-packages/django/utils/translation/__init__.py", line 105, in activate
return _trans.activate(language)
File "/Library/Python/2.7/site-packages/django/utils/translation/trans_real.py", line 194, in activate
_active.value = …Run Code Online (Sandbox Code Playgroud) 在我的Django设置中,我有以下内容:
DEBUG = os.environ ['DEBUG_VALUE']
哪里 DEBUG_VALUE = False
但是,当我这样做时,Django继续显示完整的错误消息.如果我手动添加DEBUG = False它工作,并显示500错误.
出于某种原因,Django在使用该os.environ值时忽略了它.
我确认DEBUG_VALUE是False但输出到文件.
我甚至尝试过:
DEBUG = bool(os.environ ['DEBUG_VALUE'])
并仍显示完整错误.
Django Rest Framework 有一个PrimaryKeyRelatedField,它列出了我与类别的关系的 ID many-to-many...
class CatalogueItemsSerializer(serializers.HyperlinkedModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='catalogue_item_detail')
name = serializers.CharField(min_length=2, max_length=60)
categories = serializers.PrimaryKeyRelatedField(many=True, read_only=True)
Run Code Online (Sandbox Code Playgroud)
我想覆盖create()类别字段上获取大量发布的 ID(传统上 DRF 希望我发送 URL)。
JSON 帖子:
{
"name": "test",
"categories": [1,2]
}
Run Code Online (Sandbox Code Playgroud)
序列化器创建:
def create(self, validated_data):
categories = validated_data.pop('categories', None)
print(categories) # This shows and empty/None even when ID are posted!
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是categories上面是空的,我假设因为PrimaryKeyRelatedField设置为read_only=True,但根据 DRF,这必须为真。
我的问题是...如何使用PrimaryKeyRelatedFieldwithvalidated_data.pop来获取我提交的 ID 列表?
我可以使用self.context.get("request").data['categories'],但这很糟糕,需要我把它变成一个列表+其他东西。
我最近为我的 django 项目之一编写了一些测试。我现在想做的是从脚本调用测试命令。
我希望解析测试结果并保存它们。这对于 django 测试框架来说是可能的吗?
在执行任何迁移命令时,我正在努力在Django中调试模糊的错误消息:
Operations to perform:
Synchronize unmigrated apps: rest_framework_docs, staticfiles, django_coverage, django_extensions, storages, corsheaders, gis, templated_email, rest_framework, django_mptt_admin, opbeat.contrib.django, grappelli, permissions, django_nose, django_markdown, messages, common
Apply all migrations: contenttypes, auth, badges, reputation, geodata, comments, sites, users, votes, watchers, library, sessions, admin, oauth2_provider
Synchronizing apps without migrations:
Creating tables...
Running deferred SQL...
Installing custom SQL...
Running migrations:
No migrations to apply.
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/user/Documents/workspace/app-api/env/lib/python3.4/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line
utility.execute() …Run Code Online (Sandbox Code Playgroud) 我正在尝试更新DRF transform_<name>以使用新to_representation方法。当我尝试执行此操作时,出现以下错误,我很难找到。我已经在所有序列化器上对此进行了测试,并且得到了相同的结果:
Traceback (most recent call last):
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
return view_func(*args, **kwargs)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/rest_framework/views.py", line 407, in dispatch
response = self.handle_exception(exc)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/rest_framework/views.py", line 404, in dispatch
response = handler(request, *args, **kwargs)
File "/Users/glyn/Documents/workspace/app/app/apps/ornamentation/views/photo.py", line 23, in get
return self.retrieve(request, *args, **kwargs)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/rest_framework/mixins.py", line 56, in retrieve
return Response(serializer.data)
File "/Users/glyn/Documents/workspace/app/django-env/lib/python2.7/site-packages/rest_framework/serializers.py", …Run Code Online (Sandbox Code Playgroud) django ×8
python ×6
celery ×1
cfml ×1
coldfusion ×1
parsing ×1
python-2.7 ×1
python-3.x ×1
railo ×1
testing ×1