[英]Django website saying “Page not found (404)”
I just deployed a django website that I made.我刚刚部署了一个我制作的 django 网站。 This is my first time of doing something like this.. still a newbie.这是我第一次做这样的事情..仍然是新手。 The problem is that whenever I try to upload something to the website, I get the following error while DEBUG is True问题是每当我尝试将某些内容上传到网站时,当 DEBUG 为 True 时,我会收到以下错误
Page not found (404)
Request Method: POST
Request URL: https://majestylink.com/admin/music/music/add/
Raised by: django.contrib.admin.options.add_view
Using the URLconf defined in majestylink.urls, Django tried these URL patterns, in this order:
[name='index']
advertise/ [name='advertise']
about-us/ [name='about-us']
promote/ [name='promote']
privacy-policy/ [name='privacy-policy']
s/ [name='search']
admin/
poem/
video/
music/ [name='index']
music/ <slug:slug>/ [name='detail']
ckeditor/
^media\/(?P<path>.*)$
The current path, music/music/add/, didn't match any of these.
The code below is my music app url..下面的代码是我的音乐应用 url..
from django.urls import path
from . import views
app_name = 'music'
urlpatterns = [
path('', views.IndexView.as_view(), name='index'),
path('<slug:slug>/', views.detail, name='detail'),
]
And this one is my project url..而这个是我的项目 url..
from django.contrib import admin
from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', include('home.urls')),
path('admin/', admin.site.urls),
path('poem/', include('poems.urls')),
path('video/', include('video.urls')),
path('music/', include('music.urls', namespace='music')),
path('ckeditor/', include('ckeditor_uploader.urls'))
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
What else am I supposed to do in order to be able to publish something on the website?为了能够在网站上发布内容,我还应该做什么? Am still new so I have a limited knowledge on how these things works我还是新手,所以我对这些东西的工作原理知之甚少
Everything works fine on local server, I get any error while testing it on local machine.在本地服务器上一切正常,在本地机器上测试时出现任何错误。 I made a slight change while deploying the website which is changing the database from the default sqlite3 to MySQL , will this be the cause?我在部署将数据库从默认sqlite3更改为MySQL的网站时进行了轻微更改,这会是原因吗? If yes, how can I resolve it.如果是,我该如何解决。 All migrations were run successfully所有迁移均已成功运行
Your URL points to a admin/music/music/add path.您的 URL 指向 admin/music/music/add 路径。 I'm guessing you meant admin/music/add.我猜你的意思是管理员/音乐/添加。 You may want to share the template that triggers the add command.您可能希望共享触发添加命令的模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.