问题
I am trying to host my website at a2hosting shared hosting plan. I was told to use cpanel to create a virtualenv and then, use passenger to run django. My virtualenv folder and project folder are in the root directory. After setting everything and running collectstatic and creating a superuser, I tried going to the django admin site. I get the login page, however, trying to login results in a page not found error. It states:
Page not found (404)
Request Method: POST
Request URL: https://www.website.com/admin/login/?next=/admin/
Raised by: django.contrib.admin.sites.login
Using the URLconf defined in readerspoint.urls, Django tried these URL patterns, in this order:
1) admin/
The empty path didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page.
I trired looking at the CPanel errors, here is what it states:
WARNING: /home/username/public_html/admin/login: Can't access file /home/username/public_html/admin/login: No such file or directory
WARNING: /home/username/public_html/admin/login: Can't access file /home/username/public_html/admin/login: No such file or directory
WARNING: /home/username/public_html/admin: Can't access file /home/username/public_html/admin: No such file or directory
[ N 2018-02-28 18:53:10.6076 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 830971, application /home/username/website
[ N 2018-02-28 18:53:10.4069 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 836756, application /home/username/public_html
[ N 2018-02-28 18:53:10.4067 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 835949, application /home/username/public_html
[ N 2018-02-28 18:53:10.3932 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 836756, application /home/username/public_html
[ N 2018-02-28 18:53:10.3930 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 835949, application /home/username/public_html
[ N 2018-02-28 18:53:10.3928 766038/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 830971, application /home/username/website
[ N 2018-02-28 18:49:24.1637 766038/Tt age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 790124, application /home/username/public_html
[ N 2018-02-28 18:48:35.3971 766038/Tr age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 787169, application /home/username/website
[ N 2018-02-28 18:40:57.7578 766038/T9 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 780233, application /home/username/website
[ N 2018-02-28 18:37:16.8870 607641/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 686858, application /home/username/public_html
[ N 2018-02-28 18:37:16.8766 607641/T1 age/Cor/CoreMain.cpp:994 ]: Checking whether to disconnect long-running connections for process 686858, application /home/username/public_html
URLconf of my the project currently looks like:
from django.contrib import admin
from django.urls import path
urlpatterns = [
path('admin/', admin.site.urls),
]
Any help is appreciated. Thank You
来源:https://stackoverflow.com/questions/49028254/cant-login-to-admin-site-returns-a-page-not-found-error