Why is this Django URL resolution not working
<p>I have the following Django url configuration in /urls.py file </p>

<pre><code>from django.conf.urls import url
from django.conf.urls import include, url
from django.contrib import admin
import core
import core.views as coreviews

urlpatterns = [
    #url(r'^admin/', admin.site.urls),
    #url(r'^create/$', coreviews.handleFile), #Uncommenting this works
    url(r'^create/$', include('core.urls')),  #This doesn't work
    url(r'^$', include('core.urls')),#Make msg app the the default one
    #url(r'^upload/', include('core.urls')),
]
</code></pre>

<p>My core/urls.py file is defined as follows</p>

<pre><code>from django.conf.urls import include, url
from django.contrib import admin
import core.views as coreviews
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.decorators import login_required

urlpatterns = [
    url(r'my$', coreviews.handleFile),
    url(r'^$', coreviews.index),
]
</code></pre>

<p>Finally, core/views.py file is defined as follows</p>

<pre><code>def index(request):
    return render_to_response('AudioRecorder/index.html', context_instance=RequestContext(request))

def handleFile(request):
    return render_to_response('AudioRecorder/index.html', context_instance=RequestContext(request))
</code></pre>

<p>show_urls output is as follows</p>

<pre><code>/   core.views.index        
/create/    core.views.index        
/create/my  core.views.handleFile       
/my core.views.handleFile
</code></pre>

<p><strong>Question:</strong>
I am running on localhost. When I send get request to url <a href="http://localhost:8000/" rel="nofollow">http://localhost:8000/</a>, I get proper response with 200 code. But when I send get request to url <a href="http://localhost:8000/create/my" rel="nofollow">http://localhost:8000/create/my</a>, I get 404 not found error. Why is it happening like this? Shouldn't second URL also return 200 code?</p>

<p>Because you're terminating the including url pattern with a $, which means the end of the pattern. Nothing can match past that. Remove those characters:</p>

<pre><code>url(r'^create/', include('core.urls')),
url(r'', include('core.urls')),
</code></pre>

python django django-views