我在我的应用程序中对 urls.py 进行了更改,但 AWS EC2 显示找不到页面错误,我重新启动了服务器几次,但仍然得到相同的结果。
我在AWS上使用 Nginx + gunicorn + MySQL + Django 。我在StackOverflow上找到了这个question但没有人回答。
from django.conf.urls import url
from django.contrib import admin
from django.conf.urls.static import static
import settings
from collapp.views import get_branch, get_college, get_course, get_university, get_department, signup, login, \
email_exist, forget_password, change_password, username_exist, get_newsfeed
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^exist/email/(?P<email_id>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/$', email_exist),
url(r'^exist/username/(?P<username>[\w\W]+)/$', username_exist),
url(r'^forgot/email/(?P<email_id>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/$', forget_password),
url(r'^change/password/(?P<email_id>[\w.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4})/$', change_password),
url(r'^newsfeed/$', get_newsfeed)
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
有用的建议将不胜感激。