Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4248510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:16:01+00:00 2026-05-21T04:16:01+00:00

For some reason, Django seems to be displaying my ImageField URL strings escaped. See

  • 0

For some reason, Django seems to be displaying my ImageField URL strings escaped. See below (ImageWithThumbsFieldFile uses an ImageField behind the scenes, and I tested it with a normal ImageField as well and the problem still existed.)

>>> from … import UserProfile
>>> u = UserProfile.objects.get(pk=1)
>>> u
<UserProfile: johnny's profile>
>>> u.profile_picture
<ImageWithThumbsFieldFile: /static/img/profile_picture.png>
>>> u.profile_picture.url
'http://mysite.com/%2Fstatic%2Fimg%2Fprofile_picture.png'

Notice the escaping in the URL. Now, when I query the MySQL database:

mysql> select * from ..._userprofile;
+----+---------+---------------------------------+------+
| id | user_id | profile_picture                 | bio  |
+----+---------+---------------------------------+------+
|  1 |       1 | /static/img/profile_picture.png | NULL |
|  2 |       2 | /static/img/profile_picture.png |      |

The url is not stored as such. So, I do not believe the problem is the data stored in the database (the url is the default).

I have tried escaping with

|safe 

and

{% autoescape off %} {% autoescape end %}

to no avail. My setup is Django 1.2.3 with MySQL running under Apache mod_wsgi. The app runs on my staging server under the same setup without issue (also Apache and MySQL). But since the escapes show up in the Python shell, I do not believe the database or server to be the root cause. The good server is running Python 2.7, and the bad server is running Python 2.6.6 (for reasons out of my control…though I doubt that is the issue either).

Any ideas on how to fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:16:01+00:00Added an answer on May 21, 2026 at 4:16 am

    As far as I can tell, this is due to Amazon S3 not having folders. For some reason the django-storages app outputs the urls this way. I thought it was wrong, but the images are working. Just pretty weird to see the urls like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Django's website seems good but for some reason I couldn't find where to download
I have a django project, but for some reason basic jquery isn't working. <html>
I have a django auth_user table, and for some reason, some of the passcodes
I'm running mod_wsgi on apache2. It's running Django and for some reason, after I
I'm working with my Django app. For some reason an element of a list
I wanted to test something that uses a User objects. But for some reason
For some reason, at some point the django administration got broken. The css is
I have a django app that has a horizontal navigation. For some reason I
1- I want to install tinymce . not django-tinymce ( for some reason )
I'm doing some i18n on a web-based app using Django, which uses gettext as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.