django 1.8 cant serve img static file -
new problem: django app isnt able show image.
using ubuntu, tried chrome , firefox. django 1.8 in local server (so run ./manage.py runserver).
i have followed https://docs.djangoproject.com/en/dev/howto/static-files/ quite , read , searched more documentation on google, there isnt 1.8 , problem, last resource. here files:
settings.py: ...
static_url = '/home/user/escritorio/des/proyect/static/' media_root = '/home/user/escritorio/des/proyect/static/media/'
urls.py:
from django.conf.urls import include, url, patterns django.contrib import admin django.conf.urls.static import static import settings admin.autodiscover() urlpatterns = patterns('', url(r'^root/', include(admin.site.urls)), url(r'^index$', 'views.index.page',name='index'), ) if settings.debug: urlpatterns += patterns('', url(r'^media/(?p<path>.*)$', 'django.views.static.serve', { 'document_root': settings.media_root, }), )
index.py:
from django.shortcuts import render def page(request): return render(request,'index.html')
index.html:
<!doctype html> <html> <head> </head> <body> {% load staticfiles %} <img src="{% static "media/media/escudo.jpg" %}" alt="img"/> hello! </body> </html>
so can't see img :( "alt". when inspect object developer tool, route image correct, linking '/home/user/escritorio/des/proyect/static/media/escudo.jpg' wich correct: there img is, cant see on internet navigator.
please help, , in advance :)
Comments
Post a Comment