Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Django可疑行动_Python_Django_Exception_Heroku_Amazon S3 - Fatal编程技术网

Python Django可疑行动

Python Django可疑行动,python,django,exception,heroku,amazon-s3,Python,Django,Exception,Heroku,Amazon S3,所以我用django在heroku上做了这个小应用。 我的计算机上的一切都正常工作,包括此URL 不幸的是,我得到了一个400错误,起初我没有办法知道出了什么问题。 我使用名为“Bugsnag”的加载项来跟踪错误,它最终向我显示: django.core.exceptions.SuspiciousOperation: Attempted access to 'https:/reginaemploi.s3.amazonaws.com/static/images/company-logo/defau

所以我用django在heroku上做了这个小应用。 我的计算机上的一切都正常工作,包括此URL 不幸的是,我得到了一个400错误,起初我没有办法知道出了什么问题。 我使用名为“Bugsnag”的加载项来跟踪错误,它最终向我显示:

django.core.exceptions.SuspiciousOperation: Attempted access to 'https:/reginaemploi.s3.amazonaws.com/static/images/company-logo/default-pic.jpg?Signature=P7cCZpYOlnzr7asOEjVyqHzGIgw%3D&Expires=1403269018&AWSAccessKeyId=AKIAITNBWFV6BZDWPZMQ' denied.
storages/backends/s3boto.py:341 _normalize_name
storages/backends/s3boto.py:458 url
django/contrib/staticfiles/templatetags/staticfiles.py:12 url
django/templatetags/static.py:106 render
django/template/defaulttags.py:196 render
django/template/debug.py:78 render_node
django/template/base.py:840 render
django/template/loader_tags.py:62 render
django/template/debug.py:78 render_node
django/template/base.py:840 render
django/template/base.py:134 _render
django/template/loader_tags.py:123 render
django/template/debug.py:78 render_node
django/template/base.py:840 render
django/template/base.py:134 _render
django/template/base.py:140 render
django/template/loader.py:169 render_to_string
django/shortcuts/__init__.py:29 render_to_response
jobSearch/views.py:177 results
django/core/handlers/base.py:114 get_response
当访问
https:/reginaemploi.s3.amazonaws.com/static/images/company logo/default pic.jpg
这很奇怪,因为当我将同一个链接粘贴到浏览器中时,它在Django之外工作。 我读到下划线(“389;”)可能会引起一些问题,所以我从访问路径中删除了所有下划线。(这是我第二次收到此异常,在此之前,我有一个名为
“company\u logo”


您能告诉我问题出在哪里吗?

在包含图像url时,您似乎缺少第二个正斜杠。它应该是

您有
https:/yourdomain/image.jpg
,它应该是
https://mydomain/mypicture.jpg

好的,我找到了:) 错误源于我编写的模板

 {% static object.picture.url %}
而不是

{{ object.picture.url }}
很明显,它使用了一个错误的路径来访问存储在AmazonS3上的我的图片


谢谢大家:)我应该在问之前多找一点。我希望这对某人有所帮助。

谢谢@Alasdair,我检查了我的设置,不知道为什么会出现这种情况。我在我的
settings.py中写了
https://
,我也遇到了同样的问题。Django的
FieldFile
调用存储类的
url()
方法,因此它可能与对
static()