python - Can't display new html page with href from homepage -
the examples find. related issues login page , iteration other pages not in way have problem, here issue have deal -
i want display form creating account multiple steps, using modals, when user access button "subscribe"
on homepage.html have this:
<a onclick="window.location.href='account'" target="_blank"> <input type="submit" value="account"> </a> `
...which supposed go new account.html page, in same folder homepage.html
in app's urls.py, apps' name homepage have:
from django.conf.urls import patterns, url homepage import views urlpatterns = patterns('', url(r'^$', views.homepage, name='homepage'), url(r'^account$', views.account, name='account'), )
and in views have:
from django.shortcuts import render homepage.models import email def tmp(request): latest_email_list = email.objects.order_by('-pub_date')[:0] context = {'latest_email_list': latest_email_list} return render(request, 'home_page/homepage.html', context) def homepage(request): return render(request, 'home_page/homepage.html') def account(request): return render(request, 'home_page/account.html')`
when click on button
not found
the requested url /account not found on server.
i complete beginner in django , python haven't yet wrapped mind on how work urls, views, , models assume have wrongly defined in views
would grate if me setting up, thanks
i want thank took time check question , tried give solution.
i think mistake did not post code have in main urls.py file, here is:
from django.conf.urls import patterns, include, url django.contrib import admin urlpatterns = patterns('', url(r'^$', include('home_page.urls', namespace="homepage")), url(r'^admin/', include(admin.site.urls)), ) django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns += staticfiles_urlpatterns()
apparently, problem in first prefix of first url in list:
i changed
url(r'^$'
for
url(r''
and calls whatever links provide in html pages.
thanks again, victor
Comments
Post a Comment