django - 当前路径...与这些中的任何一个都不匹配

django - The current path ... didn't match any of these

http://127.0.0.1:8000/contextual/main/ works, but for some reason http://127.0.0.1:8000/contextual/main/create/ 说 url 不存在,即使我包含了它。怎么了?

urls.py

from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
from django.urls import path, re_path, include


urlpatterns = [
    #url('admin/', admin.site.urls),
    #url(r'^user/', include('base.urls')),
    #url(r'^contextual/', include('base.urls')),
    #url(r'^home/', TemplateView.as_view(template_name='home.html'), name='home'),
    #url(r'^plots/', include('plots.urls')),

    # url(r'^welldata/', include('welldata.urls')),

    # eric's
    path('contextual/', include('eric_base.urls'))

eric_base/urls.py

from django.urls import re_path, include
from eric_base import views as base_views

app_name = 'eric_base'

urlpatterns = [
    re_path(r'^main/$', include([
        re_path(r'^$', base_views.ContextualMainView.as_view(), name='main'),
        re_path(r'^create/$', base_views.WellCreateView.as_view(), name='create'),
    ])),
]

views.py

from django.shortcuts import render
from django.views.generic import View, TemplateView, ListView, DetailView, CreateView, UpdateView, DeleteView

from . import models

class ContextualMainView(TemplateView):
    template_name = 'contextual_main.html'


class WellCreateView(CreateView):
    template_name = 'practice_add_well.html'
    model = models.WellInfo
    fields = '__all__'

models.py

from django.db import models


# Create your models here.
class WellInfo(models.Model):
    name = models.CharField(max_length=100)
    region_location = models.CharField(max_length=100)
    spud_date = models.CharField(max_length=100)
    well_bore = models.CharField(max_length=100)
    rig_name = models.CharField(max_length=100)
    status = models.CharField(max_length=100)

主模式后有终止符 $,因此不会匹配更多字符。你应该删除它。

    re_path(r'^main/', include([...]))