django-urls

Django Template not loading

折月煮酒 提交于 2019-12-25 14:08:37
问题 I have a project named 'src' and app named 'app' and i have a template folder inside my app. And inside my template folder i have another folder named pages and my html pages(base.html and view.html) are resides there. My view.py is below from django.shortcuts import render from django.utils import timezone # Create your views here. def home(request): return render(request, "pages/base.html", {}) and urls.py from django.conf import settings from django.conf.urls import include, url from

Django's URL regex engine is failing

最后都变了- 提交于 2019-12-25 10:01:21
问题 Django's URL regex engine is failing and I have no idea why. Even my sanity checks are failing horribly. Here's my urls.py : from django.conf.urls import patterns, include, url urlpatterns = patterns('', url(r'^a', 'placemyorder.views.home', name='home'), ) I get this 404 error: Page not found (404) Request Method: GET Request URL: http://[ip address]/a/ Using the URLconf defined in placemyorder.urls, Django tried these URL patterns, in this order: 1. ^a [name='home'] The current URL, , didn

No ReverseMatch : password reset activation email is not working in django?

∥☆過路亽.° 提交于 2019-12-25 05:19:11
问题 I am trying to see if password reset works in my development environment . The activation email is sent out to my console . but when I paste it on the browser , I get the following error: Request Method: GET Request URL: http://127.0.0.1:8000/accounts/password/reset/confirm/MQ/3q5-7f3106e0a0cfc67d8bee/ Django Version: 1.6.2 Exception Type: NoReverseMatch Exception Value: Reverse for 'password_reset_complete' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] I

How do I allow my django admin console URL to take priority?

心已入冬 提交于 2019-12-25 05:16:18
问题 I am currently using a system where anybody can see a user's public profile when typing in /{username} as a URL. This has somehow taken priority so therefore I cannot anymore access the admin console /admin . How do I make /admin take priority? urls.py from django.conf.urls import patterns, include, url from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^player/', include('player_details.urls')), (r'^profile/', include('userprofile.urls')), url(r'^admin/',

Django change_password NoReverseMatch at /accounts/password/change/

旧巷老猫 提交于 2019-12-25 01:24:49
问题 I have the following url config in accounts/urls.py: url(r'^password/change/$', 'django.contrib.auth.views.password_change', {'template_name': 'change_password.html'}, name='password_change'), url(r'^password/change/done/$', 'django.contrib.auth.views.logout_then_login', name='password_change_done'), But if I call the password-change url I get the following error: NoReverseMatch at /accounts/password/change/ Reverse for 'password_change_done' with arguments '()' and keyword arguments '{}' not

django url NoReverseMatch works in 3rd party app but not my project

给你一囗甜甜゛ 提交于 2019-12-24 19:07:03
问题 I am integrating django-zinnia 0.12.3 into my django 1.4 project. I have it installed and working. I want to override its zinnia/base.html template so that all the content appears using my site's template. The zinnia templates extend 'zinnia/base.html'. When I copy the file zinnia/templates/zinnia/base.html to myproject/templates/zinnia/base.html all the zinnia {% url %} stopped working and gave NoReverseMatch. Even if I made zero changes to the file. For example: {% url 'zinnia_entry_archive

Django url reverse: Non-reversible reg-exp portion: '(?='

匆匆过客 提交于 2019-12-24 15:06:08
问题 Django version: 1.5 (trunk) I'm using a positive look-ahead assertion in url pattern A, which works fine by itself. But when I try to reverse url pattern B, which is completelly unrelated, I get: ValueError: Non-reversible reg-exp portion: '(?=' Example urls: url(r'^foo(?=bar)/', test, name= 'bla'), url(r'bar/', test, name= 'bli'), Triggering the error: from django.core.urlresolvers import reverse reverse('bli') I found this related ticket, but didn't make me smarter sadly https://code

NoReverseMatch django Class based views

﹥>﹥吖頭↗ 提交于 2019-12-24 13:33:28
问题 I get this error NoReverseMatch at /author/add/4 Reverse for 'author_update' with arguments '()' and keyword arguments '{'pk': 39, 'user_id': >}' not found. 1 pattern(s) tried: ['author/(?P\d+)/(?P\d+)$'] urls.py url(r'^author/add/(?P<user_id>\d+)$', AuthorCreate.as_view(), name='author_add'), url(r'^author/(?P<user_id>\d+)/(?P<pk>\d+)$', AuthorUpdate.as_view(), name='author_update'), url(r'^author/(?P<user_id>\d+)/(?P<pk>\d+)/delete/$', AuthorDelete.as_view(), name='author_delete'), url(r'

Django root project url namespace not working

怎甘沉沦 提交于 2019-12-24 05:59:35
问题 I decided to have the front pages such as the main landing page and the 'about me' page etc. at the root of my project instead as a different app. This means the project looks like this: /django-helloworld /Hello_World __init__.py url.py views.py wsgi.py /static style.css /templates index.html My urls.py looks like this: from django.conf.urls import url, include from django.contrib import admin from . import views app_name = 'Hello_World' urlpatterns = [ url(r'^$', views.IndexView.as_view(),

After upgrade to Django 1.11 append_slash no longer works

痴心易碎 提交于 2019-12-24 00:12:26
问题 In Django 1.9 (and Python 3.4) the default of APPEND_SLASH worked correctly, i.e. I could enter 'localhost:8000/ideatree/videos' and the trailing slash would be added. After an upgrade to Django 1.11 (and Python 3.6), APPEND_SLASH is no longer working. I've looked for deprecation notices but so far found nothing that seems to apply. (side question: how do you turn 'loud deprecation warnings' back on, as they were in previous versions?) Here is my main urls.py: from django.conf.urls import