>
> The error I am getting now is:
>
>
>
>
> NoReverseMatch at /  Reverse for 'submit' with arguments '()' and keyword
arguments '{}' not found. 0     pattern(s) tried:[u'$submit'/]
>
> And the following is highlighted in my index file:
>
> <form class="form-mini" method="post" action="{% url 'iofcontrol:submit'
%}">
>
>
> My code is below:
>
>
>
> iofppysite/iofppysite/urls.py
>
>
> from django.conf.urls import include, url
> from django.contrib import admin
>
> urlpatterns = [
>
>     url(r'^admin/', admin.site.urls),
>     url(r'^', include('iofcontrol.urls', namespace='iofcontrol')),
> ]
>

Not sure what the other response was referring to, the namespace definition
is there.

>
> iofppysite/iofcontrol/urls.py
>
>
> from django.conf.urls import url
> from . import views
>
> urlpatterns = [
>
>     url(r'^', views.index, name='index'),
>     url(r'^submit/', views.submit, name='submit'),
> ]
>

And now we've come to the brunt of the problem. Your 'index' URL has a bad
regex. A simple r'^' will match every single URL in this namespace, because
all you are looking for is the beginning of a string, whether it is empty
or not. That renders the rest of the URL's in that namespace unusable,
since they are matched top-down.

That also explains your error where the URL that matched is listed as
'/$submit/' rather than just '/submit/'.

You probably want r'^$', which matches only an empty string (beginning and
end of string are next to each other).

Your second URL also probably needs some help: r'submit/$'

If you don't do that, you may get unexpected behavior later if you have
another overlapping URL defined like r'submit/thank_you/$', which your
current 'submit' URL would match. You probably don't want that to happen.

It's important to be as specific as possible with regular expressions. Be
sure to include a $ at the end of your URL regular expressions if that is
exactly the URL you are matching. In general, you won't have them for
definitions that include() other URL files, but they'll likely be on all of
your other definitions.

Also remember the trailing / before the $ as well, assuming that you have
ADD_SLASHES set to True (it is True by default).

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUm_QLAx1394rROi_M1T%2BLFACz_Lzh%3DNRcy55LbPKFOeQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to