2015-10-09 82 views
0

我有一個網址,配置的問題我Django項目,在我的根URL的配置我有這樣的:Django中找不到網頁(404)的錯誤與URL配置

from django.conf import settings 
from django.conf.urls import patterns, include, url 
from django.conf.urls.static import static 
from django.contrib.staticfiles.urls import staticfiles_urlpatterns 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
        url(r'^$', include('main.urls')), 
        url(r'^admin/', include(admin.site.urls)), 
        url(r'^profile/', include('accounts.urls')), 
        ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 
urlpatterns += staticfiles_urlpatterns() 

在我的應用程序網址的配置,我有這樣的:

from django.conf.urls import patterns, url 
urlpatterns = patterns('', 
        url(r'^$', 'main.view.home', name='main_home'), 
        url(r'^integrations/$', 'main.view.integrations', name='main_integrations'), 
) 

但是,當我去渲染這個網址http://127.0.0.1:8000/integrations/我得到一個錯誤404未找到。

謝謝你的答案。

+0

什麼是您的應用程序的名稱?主要?可以顯示視圖代碼? –

回答

-1

是的,我的應用程序命名爲「主」,這是我的看法代碼:

def home(request): 
user = request.user 
if not user.is_authenticated(): 
    data = { 
     'messages': get_messages(request), 
    } 

    return render_to_response('home.html', data, context_instance=RequestContext(request)) 

data = { 
    'messages': get_messages(request), 
} 
return render_to_response('home_user.html', data, context_instance=RequestContext(request)) 


def integrations(request): 
    return render_to_response('/main/integrations.html', context_instance=RequestContext(request)) 
+0

編輯您的帖子,刪除這個答案 –