用Django编写Hello World
用Django写Hello World | まめも
http://torokeru.tv/mameblog/?p=35
由于没有动,所以尝试重新书写一下。
>django-admin startproject myproject
>cd myproject
>python manage.py startapp myapp
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
]
from django.http import HttpResponse
def main(request):
return HttpResponse("Hello World!!")
from django.conf.urls import url
from django.contrib import admin
from myapp import views
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.main)
]
请提供更多上下文以便我完成任务。
“在include的情况下,视图必须是可调用的或者是一个列表/元组” –
TypeError: 视图必须是可调用的或者是一个列表/元组 in include() – Google グループ