Django:URL Mapping ,Page not found (404) - django

I am a newbie to Django. Trying to create my first webapp.
I ran into a problem. I have 3 templates store, kart and checkout. I am able to navigate from store to kart without any issues. Now I wish to move to checkout page from the kart page. I am using a button for this purpose.
Below given is the code present in my kart.html page.
I am facing the below issue:
Below given is my urls.py file
And this is my views.py file
Could anyone tell me what I am doing wrong. Thanks in advance!!

There is a typo you are missing %
href="{% url 'checkout' %}"

Related

Where is account login template under mezzanine?

I'm trying to look for the login page. I've created a folder registeration/login.html under templates, but it doesn't read my updated file at all.
Secondly, there's a button that says login but takes me to accounts/login page, how do I just forward the url to accounts/login then? and where do i customize the login page? I've tried creating an accounts/loginunder templates, that doesn't work.
urls.py
url('^', include('django.contrib.auth.urls')),
It is always a good idea to check out the source code of the framework when you're looking for the answer. In django.contrib.auth.views.LoginView default template is:
template_name = 'registration/login.html'
{% url 'login' %}
Use to retrieve pages from template (html)
I realize this is very late, but will hopefully be helpful for others facing similar issue.
This is the Mezzanine source code for login page which Mezzanine renders by default.
So, you can do something like
python manage.py collecttemplates -t accounts/account_login.html
to copy the above file to your app template directory, and modify the copied file as per your needs.
Bonus: You can find other account related templates (like sign up, password reset, etc.) here.

Django Wagtail pageurl template tag returning incorrect host name

I'm using Wagtail 1.8 and the pageurl template tag on a blog index page to hyperlink the titles of the blogs through to the actual blog pages. Pretty standard stuff. This is a Django 1.10 project.
<a class="blog-post-link" href="{% pageurl blog %}">
<h2>{{ blog.title }}</h2>
</a>
The very strange problem I'm having is that the host name of the site is being replaced by the host name of my server that is hosting the site. For example, a correct link would be:
https://beadtrails.com/blog/vernon-bc-what-to-do-on-and-off-the-trails/
However, it is sometime being returned as https://graphicearth.ca/blog/vernon-bc-what-to-do-on-and-off-the-trails/
When I say sometimes, if I go to the wagtail admin sites page, then into the host record and save it, it will fix the problem--for a while. It will then revert back to the incorrect url.
As you can imagine, this is not a great situation where your blog links end in a 404 error!
For trouble shooting, I've checked the config of both Wagtail and Django sites tables, checked the config files correctly identify the SITE_ID, done a text search through all the source code for 'graphicearth.ca', reviewed the uWSGI and nginx config files, checked that the blog hierarchy is correct within Wagtail relative to the home page, checked the headers in the browser to make sure the right host is being passed. Everything looks ok.
Digging into the source code for the template tag, which is in wagtailcore_tags.py, the comments for the function says:
Outputs a page's URL as relative (/foo/bar/) if it's within the same
site as the current page, or absolute (http://example.com/foo/bar/) if
not.
So for some reason, the code ends up thinking that the sites are different--but not all the time. As mentioned above, if I go into the Wagtail admin and re-save the sites entry it fixes things for a while.
As this is on a production system, it's rather hard to debug. Does anyone have any suggestions on what might be causing this and/or how to debug it?
Application stack is:
- Django 1.10.5
- Wagtail 1.8
- uWSGI
- nginx
Answer update:
Tom's response was what led me to find the solution so I've marked his answer as correct. I was using the same memcached instance for multiple sites and the keys must of been getting crossed. I reverted to basic django cache and it resolved the problem. Time to find a better solution for caching with multiple sites on the same server.
Do you have a cache configured on the production system? The pageurl template tag calls get_site_root_paths() which uses a cache of site root paths if one is available. The cache should be purged if sites are edited or deleted, but perhaps you could try configuring settings.CACHES to use DummyCache to help track down the issue.

Django-planet shows empty page, while the admin show data that supposed to be displayed

I'm playing with django-planet with Django 1.6, and after some (minor) adaptions. I uploaded some feeds (and I can see them in Django-admin) and mounted them in url.py like this:
url(r'^feeds/', include('planet.urls'))
but when I navigate to feeds/ or any other url specified in django-planet urls.py :
some examples:
url(r'^blogs/$', "blogs_list", name="planet_blog_list"),
url(r'^feeds/$', "feeds_list", name="planet_feed_list"),
I get a blank and empty page. not an error page. but a blank page. when I look at the request I see the django server returning a 200 status. where are django-planet default pages? When I look at django-planet code the views seem to exists..and else I would get an error page
urls.py doesn't look broken to me, since when I navigate to non existent urls in feeds/ or otherwise I do get the expected error page.
I have 2 suspicions:
django-planet not finding the templates. when I look at the lib structure it seems that views.py is naming views that sit in planet subfolder, but actually planet subfolder is under templates folder.
some missing django-planet and undocumented config in my settings.py
how can I solve this?
What am I missing? I'll be glad for help with this
I even downgraded to Django 1.5 but it didn't solve the problem

how to create pop up in articles in admin joomla2.5

I created an article in admin and want to show a pop-up with click event. I tried the following things:
Using script tag.But it did not work. And showed value to front side.
Used module fancybox and module simple pop-up. But they are showing error. I think because the core jquery file is loaded after the fancybox js file. But I did not know any way to change order of js files in head .
Could any body help me? I am new to joomla . Thanks in advance.
I found the solution. I added fancybox js in templates js and fancybox css in templates. Then $(".modalbox").fancybox();. Then adding div in articles admin.

Django admin action for photologue gallery change

I have a photologue site set up and I really wanted to add an admin action so that when looking at a list of photos in the Django admin I can select a few and mark their respective checkboxes and via an admin action change them to some other gallery. How can something like this be implemented? I already got creating an admin class without having to write the photologue package and adding the action.. but have got no clue on how to send the "gallery" parameter.
Actually I think I got the answer after some more googling in this tutorial here (a bit old but it appears to work) link