from django.conf.urls import url
from ruth import views
urlpatterns = [
url(r'^$', views.index, name="index"),
]
这是我的urls.py
from django.shortcuts import render
from django.http import HttpResponse
def index(request)
return HttpResponse("Hello World")
这是view.py
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r'^ruth/', include('ruth.urls')),
url(r'^admin/', admin.site.urls),
]
这是主要的urls.py
def index(request)
我在这里关注django教程 https://docs.djangoproject.com/en/1.11/intro/tutorial01/
我的错误说明了第4行from ruth import views
并在第3行的urls.py上url(r'^ruth/', include('ruth.urls')),
在主urls.py第6行是错误,这是#include <stdio.h>
int main(int argc, char *argv[]){
char line1[128];
char line2[128];
char line3[128];
char rem_text[128];
FILE *f;
f = fopen((argv[1]), "r");
if (!f) {
printf("error");
} else {
fscanf(f, "%127[^\n]\n%127[^\n]\n%127[^\n]\n%127[^\n] ", line1, line2,line3, rem_text);
printf("1:%s\n", line1);
printf("2:%s\n", line2);
printf("3:%s\n", line3);
printf("4:%s\n", rem_text);
fclose(f);
}
return 0;
}
行
我是python的新手,我需要一些帮助,谢谢。
答案 0 :(得分:1)
每个函数中的代码块以冒号(:)
开头def index(request): # you missed the semicolon
return HttpResponse("Hello World")