Django 忽略 urls.py 的更新
Django Ignoring updates to urls.py
我的 Dango 项目中的 urls.py 文件被忽略;例如,我尝试从项目中注释掉管理员 URL,但我仍然可以使用管理员。我尝试添加名称 Space,但 Django 说它不存在。
mysite/urls.py:
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information, please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.conf.urls.static import static
from . import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('',include("Wallet.urls"),
path('',include("django.contrib.auth.urls"))
] + static(settings.STATIC_URL, document_root='/home/dh_hemuuv/minicoin.fztl.com/static')
Wallet/urls.py:
from django.urls import path
from .views import signup,viewWallet,transfer,userpage,collectgift
urlpatterns = [
path("signup/",signup,name="signup"),
path("",viewWallet,name="home"),
path("transfer/",transfer,name="transfer"),
path("account/<str:username>/",userpage),
path("collectgift/<int:id>/",collectgift,name="colgift"),
]
请帮忙!
哎呀我发现了我的问题我发现了一个讨厌的问题__pycache__
删除文件夹解决了我的问题
我的 Dango 项目中的 urls.py 文件被忽略;例如,我尝试从项目中注释掉管理员 URL,但我仍然可以使用管理员。我尝试添加名称 Space,但 Django 说它不存在。
mysite/urls.py:
"""mysite URL Configuration
The `urlpatterns` list routes URLs to views. For more information, please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.conf.urls.static import static
from . import settings
urlpatterns = [
path('admin/', admin.site.urls),
path('',include("Wallet.urls"),
path('',include("django.contrib.auth.urls"))
] + static(settings.STATIC_URL, document_root='/home/dh_hemuuv/minicoin.fztl.com/static')
Wallet/urls.py:
from django.urls import path
from .views import signup,viewWallet,transfer,userpage,collectgift
urlpatterns = [
path("signup/",signup,name="signup"),
path("",viewWallet,name="home"),
path("transfer/",transfer,name="transfer"),
path("account/<str:username>/",userpage),
path("collectgift/<int:id>/",collectgift,name="colgift"),
]
请帮忙!
哎呀我发现了我的问题我发现了一个讨厌的问题__pycache__
删除文件夹解决了我的问题