-1
我在製作和合並第二個應用程序時遇到了與我的網站有關的問題。第一個完美的作品。 您可以在這裏看到演示網站:http://216.158.236.51 但是,當我嘗試訪問創建的新網址頁面http://216.158.236.51/signup時,它只是給了我一個HTTP 404
響應。 它爲新應用頁面和提供了一個404
,用於在第一個應用中創建的其他新頁面。在django上添加新應用程序時出現404錯誤
我很確定我從django方面做了一切正確的事情。不知道是否需要重新加載nginx或gunicorn,或者後端存在哪些問題......任何建議都會很棒。
我的網址模式是這樣的:
from django.conf.urls import url, include
from django.contrib import admin
from blackcrowtours import views
from accounts import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('accounts.urls'), name='accounts'),
url(r'^signup/', accounts.views.signup, name='signup'),
url(r'^$', views.home, name='home'),
url(r'^yourtrips/', views.yourtrips, name='yourtrips'),
url(r'^about/', views.about, name='about'),
url(r'^whyus/', views.whyus, name='whyus'),
url(r'^accommodations/', views.accommodations, name='accommodations'),
url(r'^yourguides/', views.yourguides, name='yourguides'),
url(r'^westerneurotrip/', views.westerneurotrip, name='westerneurotrip'),
url(r'^contact/', views.contact, name='contact'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
帳戶應用的觀點
from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
def signup(request):
return render(request, 'accounts/signup.html')
帳戶應用網址
from django.conf.urls import url
from . import views
app_name = 'accounts'
urlpatterns = [
url(r'^signup/', views.signup, name='signup'),
url(r'^login/', views.loginview, name='login'),
]
blackcrowtours AP p意見
from django.shortcuts import render
def home(request):
return render (request, 'blackcrowtours/home.html',)
def yourtrips(request):
return render (request, 'blackcrowtours/yourtrips.html',)
def about(request):
return render (request, 'blackcrowtours/about.html',)
def whyus(request):
return render (request, 'blackcrowtours/whyus.html',)
def accommodations(request):
return render (request, 'blackcrowtours/accommodations.html',)
def yourguides(request):
return render (request, 'blackcrowtours/yourguides.html',)
def westerneurotrip(request):
return render (request, 'blackcrowtours/westerneurotrip.html',)
def contact(request):
return render (request, 'blackcrowtours/contact.html',)
所有這些意見工作EXCEPT爲此,我事後剛剛添加的聯繫人地址。
urm ...我收集你沒有使用runserver。在runserver下,只要您更改文件,django就會自動重新加載。但是,如果你正在運行帶有django(或fastcgi,或其他)的wsgi鏈接的常規web服務器,那麼你需要重新加載你的web服務器或你的wsgi服務器。 – zBeeble