Looks like your regex isn't matching:
reverse('view-project', args=['blue-dog'])
is trying the regex here:
url(r'^(?P<slug>\w+)/$', 'view_project', name="view-project"),
I think you want (?P<slug>[\w\-]+). Whenever I'm unsure about a
regex, I open up a shell "import re" and test it out.
--
Peter
On Sep 23, 6:01 pm, Streamweaver <[email protected]> wrote:
> I'm still having considerable problems with my reverse URLs and can't
> find what I'm doing wrong. For reference I'm pasting in my
> localsettings file (with some info scrubbed out), my root urls.py file
> as well as an included urls.py file relevant to the error.
>
> My problem is that I am getting various errors for the reverse
> function not being able to find URLs. The most noticable one when I
> try to load the site overall I get a template error of
>
> "Caught an exception while rendering: Reverse for 'view-release' with
> arguments '()' and keyword arguments '{'slug': u'paint-dog-in-dev',
> 'project_slug': u'blue-dog'}' not found."
>
> Even in the manage.py shell though I'm having trouble as some URLs are
> found and other seem not to be.
>
> For instance if I try 'reverse('list-project') I get the expected
> result of '/project/list/'
>
> but if I try another URL from the same file I get a NoReverseMatch
> error
>
> So if I try 'reverse('view-project', args=['blue-dog']) I would expect
> the result '/project/blue-dog/' but instead get a NoReverseMatch
> error. I get those on a number of other URLs as well and I can't seem
> to find the problem
>
> If anyone would point out what I'm doing wrong I would be very
> grateful.
>
> *************** INCLUDED FOR REFERENCE BELOW *****************
> *** urls.py file ********************
> from django.conf.urls.defaults import *
> from django.conf import settings
>
> # Uncomment the next two lines to enable the admin:
> from django.contrib import admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
> url(r'^$', 'dwrangler.project.views.summary_in_development',
> name="dwrangler-root"),
> url(r'^admin/(.*)', admin.site.root),
> url(r'^project/', include('dwrangler.project.urls')),
> url(r'^accounts/', include('dwrangler.accounts.urls')),
> url(r'^accounts/login/$', 'django.contrib.auth.views.login',
> {'template_name': 'accounts/login.xhtml'}, "login-account"),
> url(r'^accounts/logout/$', 'django.contrib.auth.views.logout',
> {'template_name': 'accounts/logout.xhtml'}, "logout-account")
> )
>
> # DISABLE THIS IN PRODUCTION
> if settings.DEV_ENV:
> from os import path
> urlpatterns += patterns('',
> (r'^static/(?P<path>.*)$', 'django.views.static.serve', {
> 'document_root': path.join(settings.BASE_DIR, '../media')
> }),
> )
>
> *** project/urls.p file *************
> from django.conf.urls.defaults import *
> from dwrangler.project.feeds import *
>
> rssfeeds = {
> 'in_development': RssInDevelopment,
> 'awaiting_development': RssAwaitingDevelopment,
> 'in_planning_review': RssInPlanningReview,
> 'in_tech_review': RssInTechReview,
>
> }
>
> atomfeeds = {
> 'in_development': AtomInDevelopment,
> 'awaiting_development': AtomAwaitingDevelopment,
> 'in_planning_review': AtomInPlanningReview,
> 'in_tech_review': AtomInTechReview,
>
> }
>
> **** localsettings.py file *****
> # Local settings file. This should NEVER be checked in.
>
> # Django settings for dwrangler project.
> from os import path
>
> # Get the directory of this file for relative dir paths.
> # Django sets too many absolute paths.
> BASE_DIR = path.dirname(path.abspath(__file__))
>
> # Set this to teh same value returned by request.MET['SCRIPT_NAME'] as
> a
> # workaround for Django not picking up URL subdirectory installs.
> # A pox on you Django!!! May Digo's eat your baby!
> SUB_URL = ''
>
> # Some default login and logout URL information.
> LOGIN_URL = '%s/accounts/login/' % SUB_URL
> LOGIN_REDIRECT_URL = '%s/accounts/profile/' % SUB_URL
> LOGOUT_URL = '%s/accounts/logout/' % SUB_URL
>
> # Look to see if the Development flag is set.
> DEV_ENV = True
> DEBUG = True
> TEMPLATE_DEBUG = True
>
> ADMINS = (
> # Name and email address of people to email as admins.
> # 'Name', '[email protected]'
> 'Scott Turnbull', '[email protected]'
> )
>
> MANAGERS = ADMINS
>
> DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql',
> 'mysql', 'sqlite3' or 'oracle'.
> DATABASE_NAME = 'dwrangler_dvl' # Or path to database file if using
> sqlite3.
> DATABASE_USER = 'dwrangler' # Not used with sqlite3.
> DATABASE_PASSWORD = ########## Not used with sqlite3.
> DATABASE_HOST = '' # Set to empty string for localhost. Not used with
> sqlite3.
> DATABASE_PORT = '' # Set to empty string for default. Not used with
> sqlite3.
>
> # EULCORE LDAP SETTINGS
> # LDAP login settings. These are configured for emory, but you'll need
> # to get a base user DN and password elsewhere.
> AUTH_LDAP_SERVER = ############
> AUTH_LDAP_BASE_USER = ##################
> AUTH_LDAP_BASE_PASS = ################# password for USERNAME above
> AUTH_LDAP_SEARCH_SUFFIX = #############
> AUTH_LDAP_SEARCH_FILTER = ############
> AUTH_LDAP_CHECK_SERVER_CERT = False # ALWAYS SET True in production.
> AUTH_LDAP_CA_CERT_PATH = '' # absolute path of cert
>
> # DJANGO-PAGINATION SETTINGS
> # Pagination settings for use with django-pagination middleware
> PAGINATION_DEFAULT_PAGINATION = 10 # The default amount of items to
> show on a page if no number is specified.
> # PAGINATION_DEFAULT_WINDOW = 3 # The number of items to the left and
> to the right of the current page
> # PAGINATION_DEFAULT_ORPHANS = 3 # The minimum number of items allowed
> on the last page, defaults to zero.
> # PAGINATION_INVALID_PAGE_RAISES_404 = False # True or False to raise
> 404 for invalid pages.
>
> # SOUTH MIGRATIONS SETTINGS
> # See various setting documentations
> underhttp://south.aeracode.org/wiki/Documentation
> SKIP_SOUTH_TESTS = True # Disable south app tests.py, they shouldn't
> run during mine.
> # SOUTH_TESTS_MIGRATE = True # If migrations are needed to run
> fixtures.
> # SOUTH_AUTO_FREEZE_APP = False # Related to freezing apps during
> migrations.
>
> # Local time zone for this installation. Choices can be found here:
> #http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
> # although not all choices may be available on all operating systems.
> # If running in a Windows environment this must be set to the same as
> your
> # system time zone.
> TIME_ZONE = 'America/New_York'
>
> # Language code for this installation. All choices can be found here:
> #http://www.i18nguy.com/unicode/language-identifiers.html
> LANGUAGE_CODE = 'utf-8'
>
> # IMPORTANT! Configure the proper site in the central applications
> Admin
> # interface so Syndication links work properly.
> SITE_ID = 1
>
> # If you set this to False, Django will make some optimizations so as
> not
> # to load the internationalization machinery.
> USE_I18N = True
>
> # Absolute path to the directory that holds media.
> # Example: "/home/media/media.lawrence.com/"
> MEDIA_ROOT = ''
>
> # URL that handles the media served from MEDIA_ROOT. Make sure to use
> a
> # trailing slash if there is a path component (optional in other
> cases).
> # Examples: "http://media.lawrence.com", "http://example.com/media/"
> MEDIA_URL = ''
>
> # URL prefix for admin media -- CSS, JavaScript and images. Make sure
> to use a
> # trailing slash.
> # Examples: "http://foo.com/media/", "/media/".
> ADMIN_MEDIA_PREFIX = '/media/'
>
> # Make this unique, and don't share it with anybody.
> # You can grab one herehttps://www.grc.com/passwords.htm
> SECRET_KEY = '##########################'
>
> # Enable additional backends.
> # Enable this for LDAP and see ReadMe for install dependencies.
> AUTHENTICATION_BACKENDS =
> ('django.contrib.auth.backends.ModelBackend',
> 'eulcore.ldap.emory.EmoryLDAPBackend')
>
> # List of callables that know how to import templates from various
> sources.
> TEMPLATE_LOADERS = (
> 'django.template.loaders.filesystem.load_template_source',
> 'django.template.loaders.app_directories.load_template_source',
> # 'django.template.loaders.eggs.load_template_source',
> )
>
> MIDDLEWARE_CLASSES = (
> 'django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'pagination.middleware.PaginationMiddleware',
> )
>
> TEMPLATE_CONTEXT_PROCESSORS = (
> 'django.core.context_processors.auth',
> 'django.core.context_processors.debug',
> 'django.core.context_processors.i18n',
> 'django.core.context_processors.media',
> 'django.core.context_processors.request',
> )
>
> ROOT_URLCONF = 'dwrangler.urls'
>
> TEMPLATE_DIRS = (
> # Put strings here, like "/home/html/django_templates" or "C:/www/
> django/templates".
> # Always use forward slashes, even on Windows.
> # Don't forget to use absolute paths, not relative paths.
>
> # BAH!!! to Django. I fly in the face of absolute paths. BEHOLD
> MY POWER!
> path.join(BASE_DIR, '../templates')
> )
>
> INSTALLED_APPS = (
> 'django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.admin',
> 'dwrangler.project',
> 'dwrangler.accounts',
> 'dwrangler.lib',
> 'pagination',
> 'south',
> )
>
> EXTENSION_DIRS = (
> # This property needs to added to the python path for externals to
> work.
> # See README.txt for information.
> path.join(BASE_DIR, '../external/django-external')
> )
>
> try:
> # use xmlrunner if it's installed; default runner otherwise.
> download
> # it fromhttp://github.com/danielfm/unittest-xml-reporting/to
> output
> # test results in JUnit-compatible XML.
> import xmlrunner
> TEST_RUNNER='xmlrunner.extra.djangotestrunner.run_tests'
> TEST_OUTPUT_DIR='test-results'
> except ImportError:
> pass
>
> urlpatterns = patterns('dwrangler.project.views',
> url(r'^$', 'summary_in_development', name="project-root"),
> url(r'^search/$', 'project_search', name="search-project"),
> url(r'^release/search/$', 'release_search', name="search-
> release"),
> url(r'^list/$', 'project_index', name="list-project"),
> url(r'^add/$', 'create_project', name="create-project"),
> url(r'^(?P<slug>\w+)/$', 'view_project', name="view-project"),
> url(r'^(?P<slug>\w+)/edit/$', 'update_project', name="update-
> project"),
> url(r'^(?P<slug>\w+)/delete/$', 'delete_project', name="delete-
> project"),
> url(r'^(?P<slug>\w+)/addrelease/$', 'create_release', name="create-
> release"),
> url(r'^(?P<project_slug>\w+)/(?P<slug>\w+)/$', 'view_release',
> name="view-release"),
> url(r'^(?P<project_slug>\w+)/(?P<slug>\w+)/edit/$',
> 'update_release', name="update-release"),
> url(r'^(?P<project_slug>\w+)/(?P<slug>\w+)/delete/$',
> 'delete_release', name="delete-release"),
> url(r'^(?P<project_slug>\w+)/(?P<slug>\w+)/burndowndata/$',
> 'release_burndown_data', name="burndowndata-release"),
> url(r'^in_development/$', 'summary_in_development', name="in-
> development"),
> url(r'^in_development/chart_data/$',
> 'summary_in_development_chart_data', name="in-development-chartdata"),
> url(r'^awaiting_development/$', 'summary_development_backlog',
> name="awaiting-development"),
> url(r'^in_planning_review/$', 'summary_in_planning_review',
> name="planning-review"),
> url(r'^in_tech_review/$', 'summary_in_tech_review', name="tech-
> review"),
> url(r'^completed/$', 'summary_completed', name="completed-
> releases"),
> url(r'^work_summary/$', 'project_effort', name="work-summary"),
> url(r'^work_summary/chart_data/$', 'project_effort_data',
> name="work-summary-data"),
> url(r'^owners/$', 'owner_index', name="list-owners"),
> url(r'^owners/search/$', 'owner_search', name="search-owners"),
> url(r'^owners/(?P<username>\w+)/$', 'view_owner', name="view-
> owner"),
> )
>
> urlpatterns += patterns('django.contrib.syndication.views',
> url(r'^rss/(?P<url>.*)/$', 'feed', {'feed_dict': rssfeeds}, "rss-
> feed"),
> )
>
> urlpatterns += patterns('django.contrib.syndication.views',
> url(r'^atom/(?P<url>.*)/$', 'feed', {'feed_dict': atomfeeds},
> "atom-feed")
> )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---