python - django 1.6.2 : CSS not extending to child templates -
i´m having problem this. appreciate help. base.html
has {% block content %}{% endblock %}
. made signup.html looks this:
{%extends 'base.html'%} {% block content %} <h1>join now</h1> <form method='post' action=''>{% csrf_token%} {{form.as_p}} <input type='submit' class= 'btn btn-success btn-block'> </form> {% endblock %}
base.html
has few css links work fine when launch signup.html. made thankyou.html
extends base.html
in same way signup.html
:
{% extends "base.html" %} {% load staticfiles %} <!-- bootstrap core css --> <link href="{%static "css/bootstrap.min.css" rel="stylesheet"%}"/> <!-- custom styles template --> <link href="{%static "css/jumbotron.css" rel="stylesheet"%}"/> <!-- custom css --> <link href="{%static "css/custom.css" rel="stylesheet"%}"/> {% block side %} <h4>thank joining!</h4> {% endblock %}
but not showing css, it´s plain html.
here urls.py
:
from django.conf.urls import patterns, include, url django.conf import settings django.conf.urls.static import static django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # examples: url(r'^$', 'signups.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^thank-you/$', 'signups.views.thankyou', name='thankyou'), url(r'^admin/', include(admin.site.urls)), ) if settings.debug: urlpatterns += static(settings.static_url, document_root= settings.static_root) urlpatterns += static(settings.media_url, document_root= settings.media_root)
my views.py
:
from .forms import signupform def home(request): form = signupform(request.post or none) if form.is_valid(): save_it = form.save(commit = false) save_it.save() messages.success(request, 'we in touch') return httpresponseredirect('/thank-you/') #se agrega la pagina 'than-you' asi que hay #que agregarla en -urls.py- return render_to_response("signup.html", locals(), context_instance= requestcontext(request)) def thankyou(request): return render_to_response("thankyou.html", locals(), context_instance= requestcontext(request))
my settings.py
:
static_url = '/static/' #template location template_dirs = ( os.path.join(os.path.dirname(base_dir),"static", "templates"), # '/users/user/desktop/skillshare/static/templates', ) if debug: media_url= '/media/' static_root= os.path.join(os.path.dirname(base_dir),"static", "static-only") media_root= os.path.join(os.path.dirname(base_dir),"static", "media") staticfiles_dirs= ( os.path.join(os.path.dirname(base_dir),"static", "static"), )
thank you.
the css stuff in thankyou.html not in block. if you're extending parent template, actual content in child template must inside block defined parent.
Comments
Post a Comment