当我运行新的project server时,我正在使用ATOM ide,它打开了以前的项目urls。
我也试过重新启动编辑器和系统,但仍然不能工作。有没有人能建议一下。这是正在运行的新项目。enter image description here
PS C:\Users\IBM_ADMIN\Desktop\Django_Projects\simplesocial> python manage.py
runserver
Performing system checks...
System check identified no issues (0 silenced).
August 06, 2018 - 21:23:25
Django version 1.11.13, using settings 'simplesocial.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK
发布于 2018-08-07 08:53:03
在你的图片里面,你只包含了2个url路径
1. ^admin/
2. employee/
这意味着您必须在(此处为http://127.0.0.1:8000/ <===right )后添加,或者在urls.py ===> urlpattern中添加路径,这是我的url路径列表
from django.contrib import admin
from django.urls import include, path
from pages.views import home_view, contact_view, about_view
urlpatterns = [
path('blog/', include('blog.urls')),
path('courses/', include('courses.urls')),
path('products/', include('products.urls')),
path('', home_view, name='home'),
path('about/<int:id>/', about_view, name='product-detail'),
path('contact/', contact_view),
path('admin/', admin.site.urls),
]
我非常确定您的urls.py位于C:\Users\IBM_ADMIN\Desktop\Django_Projects\simplesocial\urls.py,或者如果您添加了额外的路径,希望它会对您有所帮助
发布于 2018-08-07 09:52:29
您是否从旧项目中复制了新项目?如果是这样的话,您可能有旧项目遗留下来的.pyc
文件。
试着删除你的.pyc
文件(不用担心,Python会从你的.py
文件重新生成新的文件)。切换到项目根目录,删除所有.pyc
文件,然后重新启动开发服务器。
这是Windows上的命令:
del /S *.pyc
这是Mac/Linux上的命令:
find . -name "*.pyc" -exec rm -f {} \;
https://stackoverflow.com/questions/51711860
复制相似问题