python_lj

作者: 大心脏 | 来源:发表于2017-11-28 09:28 被阅读11次

    -2017.6.15 15:45 macbookpro--------------------------------------------------------------------------

    1.安装Django: python3 -m pip install django

    2.建立以Django项目:django-admin startproject projectname

    3.进入项目目录(第二步创建的项目目录下),命令行运行查看帮助:python3 manager.py help

    4,建立项目模块:python3 manage.py startapp modulename

    5.运行python3自带的服务器:python3 manage.py runserver

    ---------------------------------------问题集锦--------------------------------------------

    2017.7.19  版本:python 3.6.1; django 1.11.3;

    1.urls.py

    fromdjango.conf.urlsimporturl

    fromdjango.contribimportadmin

    urlpatterns=[

    url(r'^blog/$','blog.views.hello'),

    url(r'^admin/', admin.site.urls),

    ]

    命令行运行python3 manage.py runserver报下面做这个错

    TypeError: view must be a callable or a list/tuple in the case of include().

    解决:urls.py

    fromdjango.conf.urlsimporturl

    fromdjango.contribimportadmin

    fromblogimportviews

    urlpatterns=[

    url(r'^blog/$',views.hello),

    url(r'^admin/', admin.site.urls),

    ]

    2.已安装python3

    相关文章

      网友评论

          本文标题:python_lj

          本文链接:https://www.haomeiwen.com/subject/dmqckxtx.html