在 pythonanywhere 中托管时,django python 中的 Cloudinary 图像上传错误
Cloudinary Image Upload errpr in django python while hosted in pythonanywhere
所以我使用 pythonanywhere 托管一个 django 网站,上传并显示图片上传的图片存储在 cloudinary 中显示图片工作正常但是当我上传 post 我得到这个错误:
Error at /post/
Unexpected error - MaxRetryError("HTTPSConnectionPool(host='api.cloudinary.com', port=443): Max retries exceeded with url: /v1_1/meme-topia/image/upload (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8d77f41370>: Failed to establish a new connection: [Errno 111] Connection refused'))")
模型文件:
from django.db import models
from cloudinary.models import CloudinaryField
# Create your models here.
class MemeImg(models.Model):
Title = models.CharField(max_length=500)
Post_Img = CloudinaryField('image')
def __str__(self):
return self.Title
表格文件:
from django import forms
from .models import MemeImg
class PostImg(forms.ModelForm):
class Meta:
model = MemeImg
fields = '__all__'
然后是源码link:https://github.com/Shadow-Knight503/memoster503.git
请帮忙
您确定 settings.py 中确实有这个吗?
CLOUDINARY = {
'CLOUD_NAME': 'CLOUD-NAME',
'API_KEY': 'xx',
'API_SECRET': 'xx',
'API_PROXY': 'http://proxy.server:3128'
}
我认为按键应该是小写字母。万无一失的方法是转到您的仪表板并下载您的 python 设置:
settings.py 应采用以下格式:
CLOUDINARY = {
'cloud_name': 'CLOUD-NAME',
'api_key': 'xx',
'api_secret': 'xx',
'api_proxy': 'http://proxy.server:3128'
}
所以我使用 pythonanywhere 托管一个 django 网站,上传并显示图片上传的图片存储在 cloudinary 中显示图片工作正常但是当我上传 post 我得到这个错误:
Error at /post/
Unexpected error - MaxRetryError("HTTPSConnectionPool(host='api.cloudinary.com', port=443): Max retries exceeded with url: /v1_1/meme-topia/image/upload (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f8d77f41370>: Failed to establish a new connection: [Errno 111] Connection refused'))")
模型文件:
from django.db import models
from cloudinary.models import CloudinaryField
# Create your models here.
class MemeImg(models.Model):
Title = models.CharField(max_length=500)
Post_Img = CloudinaryField('image')
def __str__(self):
return self.Title
表格文件:
from django import forms
from .models import MemeImg
class PostImg(forms.ModelForm):
class Meta:
model = MemeImg
fields = '__all__'
然后是源码link:https://github.com/Shadow-Knight503/memoster503.git
请帮忙
您确定 settings.py 中确实有这个吗?
CLOUDINARY = {
'CLOUD_NAME': 'CLOUD-NAME',
'API_KEY': 'xx',
'API_SECRET': 'xx',
'API_PROXY': 'http://proxy.server:3128'
}
我认为按键应该是小写字母。万无一失的方法是转到您的仪表板并下载您的 python 设置:
settings.py 应采用以下格式:
CLOUDINARY = {
'cloud_name': 'CLOUD-NAME',
'api_key': 'xx',
'api_secret': 'xx',
'api_proxy': 'http://proxy.server:3128'
}