python - 创建完django项目,最后runserver有如下提示,求大神指点一下
PHP中文网
PHP中文网 2017-04-18 09:57:41
0
5
247

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(5)
洪涛

Title: After creating a new project, let’s create an app.
Then add views, models, urls, etc. in the app.

PHPzhong

You haven’t imported your new project yet, when you are writing urlpatterns

迷茫

There is a problem with the url syntax, and views are not imported

PHPzhong

The code in the urlpatterns part of your urls module should be as follows:

urlpatterns = [
    '',
    url(r'^index$','newproject.views.hello'),
    ...
]
洪涛

The writing method of URL after Django 1.10 is different from the previous version. The above comments describe three supported writing methods. The function should be introduced first and then called. You may be seeing an old version of the tutorial

import newproject.views

urlpatterns = [
    url(r'^index$',newproject.views.hello,name='hello'),
    ...
]
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!