Forums

incorrect search in /static/ files for some images

My web application does not search correctly for some images in the static directory

in template:

<img src="/static/{{ inn.inn_img.inn_img_thumb.url }}

output inspector:

/static/heysiweb/images/inns_img/preview.jpg.150x100_q85_crop.jpg

but it should be: /static/images/inns_img/preview.jpg.150x100_q85_crop.jpg

settings.py

PROJECT_PATH = os.path.dirname(__file__)
sys.path.insert(0, PROJECT_PATH)

DEBUG = False
TEMPLATE_DEBUG = DEBUG

LANGUAGE_CODE = 'es'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True

# Idiomas a escoger
_ = lambda s: s

LANGUAGES = (
    ('es', _('Español')),
    ('en', _('Inglés')),
)
LOCALE_PATHS = (
    '/home/heysi/heysiweb/locale',
    os.path.join(PROJECT_PATH, 'locale'),
    #'/var/local/translations/locale',
)
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_PATH, 'static')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = os.path.join(PROJECT_PATH, 'static')

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/home/heysi/heysiweb/static/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# URL prefix for admin static files -- CSS, JavaScript and images.
# Make sure to use a trailing slash.
# Examples: "http://foo.com/static/admin/", "/static/admin/".
ADMIN_MEDIA_PREFIX = '/static/admin/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    #"/home/heysi/heysiweb/static",
    os.path.join(PROJECT_PATH, '/static/'),
)

# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

internationalization and mark_safe doesn't work either look: http://heysi.pythonanywhere.com/hostal-mercedes-cano/

textfield:

<strong>Tel&eacute;fono:</strong> (53) 41-993113<br />
<strong>Movil:</strong> (+53) 52-816802</p>

Your MEDIA_URL looks wrong -- it should be a URL, and you're adding a file path to it. Normally I'd expect it to be simply "/static" or something like that.

yes, sorry, that was the problem for /static.

but I still can't solve the language and safe mode

<em><a class="book" href="/{{ inn.machine_name }}/reservacion">{% trans "RESERVAR AHORA!" %}</a></em>
                                {{ inn.details|safe }}</p>

What are you expecting that code to do and what is it doing instead?