页面刷新一次出现一篇文章,代码改成这样:
def edit_action(request):
...
...
...
# articles = models.Article.objects.all()
# return render(request,'blog/index.html',{'articles':articles })
return HttpResponseRedirect('/blog/index')
def edit_action(request):
...
...
...
# articles = models.Article.objects.all()
# return render(request,'blog/index.html',{'articles':articles })
return HttpResponseRedirect('/blog/index')
2017-09-27
页面刷新一次出现一篇文章,代码改成这样:
def edit_action(request):
...
...
...
# articles = models.Article.objects.all()
# return render(request,'blog/index.html',{'articles':articles })
return HttpResponseRedirect('/blog/index')
def edit_action(request):
...
...
...
# articles = models.Article.objects.all()
# return render(request,'blog/index.html',{'articles':articles })
return HttpResponseRedirect('/blog/index')
2017-09-27
我就是按照老师代码敲的,一点问题都没有现在。。我settings.py里的TEMPLATES中的'DIES':[]啥也没添加,注销这一行都能运行成功。。
2017-09-26
在urls.py也能这样写:
from django.conf.urls import include, url
from django.contrib import admin
# from blog.views import index
import blog.views as bv
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^index/',bv.index),
# url(r'^index/',index,name="index"),
]
from django.conf.urls import include, url
from django.contrib import admin
# from blog.views import index
import blog.views as bv
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^index/',bv.index),
# url(r'^index/',index,name="index"),
]
2017-09-25