我是Django的新手,我的第一个主要项目是通过现有的Django Web App来更新它,简化它并以任何方式对其进行优化。但是,我在使用我的机器上运行时遇到了一些困难。
在localhost:8000 /导航到本地开发服务器时,我收到以下错误:
Using the URLconf defined in core.urls, Django tried these URL patterns, in this order:
^home/$ [name='portal']
^agentexoplanet/admin/
^agentexoplanet/agentex/ [name='agentex_redirect']
^agentexoplanet/admin/agentex/event/(?P<planetid>\d+)/calibrators/(?P<calid>\d+)/$ [name='agentex_admin_calib']
^agentexoplanet/admin/agentex/event/(?P<planetid>\d+)/calibrators/$ [name='agentex_all_calib']
^agentexoplanet/admin/
^agentexoplanet/
^static/(?P<path>.*)$
The current URL, , didn't match any of these.
这是core.urls文件:
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles import views
from django.views.generic import RedirectView
from django.contrib.auth.views import login, logout
from agentex import urls
from agentex.views import home
from agentex.admin import calibrator_check, allcalibrators_check
#from admin.site import urls
#from showmestars.views import newimage, latestimages
admin.autodiscover()
urlpatterns = [
#(r'^api/', include('odin.api.urls')),
url(r'^home/$', home, name='portal'),
url(r'^agentexoplanet/admin/', include(admin.site.urls), name='agentexo_admin'),
url(r'^agentexoplanet/agentex/', RedirectView.as_view(url='/agentexoplanet/'), name='agentex_redirect'),
url(r'^agentexoplanet/admin/agentex/event/(?P<planetid>\d+)/calibrators/(?P<calid>\d+)/$',calibrator_check, name='agentex_admin_calib'),
url(r'^agentexoplanet/admin/agentex/event/(?P<planetid>\d+)/calibrators/$',allcalibrators_check, name='agentex_all_calib'),
url(r'^agentexoplanet/admin/', include(admin.site.urls), name=''), # QUERY
url(r'^agentexoplanet/',include(admin.site.urls), name='agentexo_urls'),
#url(r'^showmestars/newimage/$', newimage, {'eventid':0}, name='showmestars_newimage'),
#url(r'^showmestars/(?P<eventid>\w+)/$', latestimages, name='showmestars_latestimage'),
#url(r'^showmestars/$', latestimages, {'eventid':0}, name='showmestars_latestimage_event'),
#url(r'^login/$',login, name='site_login'),
#url(r'^logout/$',logout, name='site_logout'),
]
if settings.DEBUG:
urlpatterns += [
url(r'^static/(?P<path>.*)$', views.serve),
]
我的项目(agentex)url文件:
from django.conf.urls import include, url
from django.contrib.auth.views import login, logout
from .views import *
from django.conf import settings
urlpatterns = [
url(r'^$',index, name='index'),
url(r'^account/login/$', login, {'template_name' :'login.html'}, name='login'),
url(r'^account/logout/$', logout,{'template_name' :'logout.html'}, name='logout'),
url(r'^account/register/$', register, name='register'),
url(r'^account/$', editaccount, name='editaccount'),
url(r'^profile/$',profile, name='profile'),
url(r'^planets/$',target, name='target'),
url(r'^fitsanalyse',fitsanalyse, name='fitsanalyse'),
url(r'^test',tester, name='tester'),
url(r'^briefing/read/$',read_manual_check, name='read_manual_check'),
url(r'^briefing/$',briefing, name='briefing'),
url(r'^comment/$',addcomment, name='addcomment'),
url(r'^(?P<code>\w+)/view/$',addvalue, name='addvalue'),
url(r'^(?P<code>\w+)/graph/update/$',updatedataset, name='updatedataset'),
url(r'^(?P<code>\w+)/lightcurve/advanced/$',graphview, {'mode' : 'advanced','calid':None}, name='advanced-graph'),
url(r'^(?P<code>\w+)/lightcurve/me/$',graphview, {'mode' : 'simple','calid':None}, name='my-graph'),
url(r'^(?P<code>\w+)/lightcurve/calibrator/update/$',classifyupdate, name='classifyupdate'),
url(r'^(?P<code>\w+)/lightcurve/calibrator/$',graphview, {'mode' : 'ave','calid':None}, name='average-graph'),
url(r'^(?P<code>\w+)/lightcurve/calibrator/(?P<calid>\w+)/$',graphview, {'mode' : 'ave'}, name='calibrator-graph'),
url(r'^(?P<code>\w+)/lightcurve/$',graphsuper,name='super-graph'),
url(r'^(?P<code>\w+)/$',infoview, name='infoview'),
url(r'^(?P<code>\w+)/data.(?P<format>\w+)',measurementsummary, name='measurementsummary'),
]
我不完全确定这里的错误。我的core.urls文件链接到index.html,但我想它没有正确链接。有没有人有任何想法?
提前致谢(并且对于不发布图片道歉 - StackOverflow不允许我这样做。)