me for a few months, and still does but calling:
{{ modelxx.objectyy.url }}
to get a file url seemed to add full path out of nowhere instead of
relative path. Now
/site_media/{{ modelxx.objectyy.url }}
gives double prefix of : /home/trak/media/home/trak/media/dir/
filename ; my plugin that uses this URL is now broken. Removing the /
site_media/ prefix and using just
fileurl = {{ modelxx.objectyy.url }}
would seem to work and gives the exact path /home/trak/media/dir/
filename, but miraculously does not work. Perhaps calling /home/
directly perms problem? Anyway the only way I can get the url to work
is by keeping the /site_media/ prefix and pasting in a static
extension:
/site_media/dirxx/filename
I am at a complete loss but know that originally the combination /
site_media/{{ modelxx.objectyy.url }} worked fine and now the
{{ .url }} usage seems to have thrown in full path. I was trying
some experiments with external apps and app some includes but I do not
see how this would affect any thing. I did turn off USE_I18n in
settings file. Here are my 3 url settings, and below is most of my
settings file:
Is there a setting that forces the {{.url }} call to give a full path
rather than relative?
ANY thoughts would be appreciated.
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': '/home/trak/media'}),
MEDIA_ROOT = ''
MEDIA_URL = '/home/trak/media/'
###################################### Django settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# system time zone.
TIME_ZONE = 'America/Chicago'
SITE_ID = 1
# If you set this to False, Django will make some optimizations so as
not
# to load the internationalization machinery.
USE_I18N = False
# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale
USE_L10N = True
# Absolute filesystem path to the directory that will hold user-
uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = ''
# Examples: "http://media.lawrence.com/media/", "http://example.com/
media/"
MEDIA_URL = '/home/trak/media/'
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = ''
# 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.
)
# 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',
)
# List of callables that know how to import templates from various
sources.
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'user_profiles.middleware.CurrentUserMiddleware',
)
ROOT_URLCONF = 'trakdrop.urls'
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'registration',
'tdcreative',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
)
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment