Django1.4の頃に経験したことなので、今回のケースを改善できるかは 不明ですが、私も過去に日本語名のファイルをアップロードできなかったことが ありました。
私はDjango環境はCentOSを使っているので、下記の設定で日本語名の ファイルがアップロードできるようになりました。 ``` # vi /etc/profile export LANG='ja_JP.UTF-8' export LC_ALL='ja_JP.UTF-8' # source /etc/profile ``` 2014年8月6日水曜日 11時53分06秒 UTC+9 Hari Manmon: > > > > Django 1.7 でWebサイト構築を行っています。 > > どうしても解決しないため投稿させていただきます。 > > models.pyでImageFieldを属性としたクラスを定義しているのですが > adminサイトから日本語名のファイルをアップロードしようとすると > > 'ascii' codec can't encode characters in position 47-52: ordinal not in > range(128) > > エラーがでます。 > > utf 8にデコードしたいと考えています。 > > 解決方法がありましたらご教授お願いします。 > > ソースは以下のようになっています。 > > models.py > > class Image(models.Model): > > img = models.ImageField(upload_to=settings.MEDIA_ROOT) > > def __unicode__(self): > > return os.path.basename(self.img.name) > > -- -- ----------------- http://djangoproject.jp/ ----------------- You received this message because you are subscribed to the Google Groups "django-ja" group. To post to this group, send email to django-ja@googlegroups.com To unsubscribe from this group, send email to django-ja-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-ja --- このメールは Google グループのグループ「django-ja」の登録者に送られています。 このグループから退会し、グループからのメールの配信を停止するには django-ja+unsubscr...@googlegroups.com にメールを送信してください。 その他のオプションについては、https://groups.google.com/d/optout にアクセスしてください。