New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media URL wrong in Django 1.8.2 #198
Comments
what's your MEDIA_URL setting? |
Here's some scope of settings.py TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.media',
],
},
},
]
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
CKEDITOR_UPLOAD_PATH = 'uploads/'
#CKEDITOR_UPLOAD_PATH = ''
CKEDITOR_JQUERY_URL = '//code.jquery.com/jquery-1.11.1.min.js'
CKEDITOR_CONFIGS = {
'default': {
#'toolbar': 'Basic',
'toolbar': 'Full',
},
}
CKEDITOR_IMAGE_BACKEND = 'pillow'
I haven't set the MEDIA_URL in the settings.py yet. and in the urls.py of the project, if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_LOCAL)
urlpatterns += patterns('',
(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT})) |
Problem solved!
The MEDIA_URL must be included in the settings.py |
But I think this should be included in the README.md if any. |
No media files will link correctly without MEDIA_URL. |
but i have an error : "patterns" is not defined |
Did you looked at the traceback? |
The django-ckeditor did successfully upload the media and stored the image under a folder, say, ./media/uploads/
Every time after I successfully upload the picture to the server using django-ckeditor, the django-ckeditor would request a URL which looks like this
And that indicates the browser is requesting to
http://localhost:8000/somewhere/someplace/uploads/2015/06/11/app_software_360.jpg
but not http://localhost:8000/media/uploads/2015/06/11/app_software_360.jpg This is the actually right URL location, but django-ckeditor just can not find it out. I guess this has something to do with the settings.py
You just can not fetch the right media URL, how to fix this?
The text was updated successfully, but these errors were encountered: