要http://127.0.0.1:8300/projects/cprshelp/edit_file/?filename=manage.py导致404错误问题与Django的URL
urls.py
(r'^projects/(?P<project_name>[\w ,-<>]+)/', include('projects.urls')),
项目/ urls.py
(r'edit_file/$', views.edit_file),
什么我需要改变我的网址文件,使这个特定的网址工作?
有效的URL列表:
^admin/doc/
^admin/
^projects/(?P<project_name>[\w ,-<>]+)/ edit_file/$
^media/(?P<path>.*)$
edit_file功能:
def edit_file(request, project_name):
print '**** project name ' + project_name
#project = Project.objects.get(name=project_name)
filename = request.GET['filename']
#content_of_file = open(project.file_location + filename, 'r')
#content_of_file = '\n'.join(content_of_file.readlines())
context = RequestContext(request, {
#"project": project,
#"files": get_files_and_directories(project.file_location),
"filename": filename,
#"content_of_file": content_of_file,
})
return render_to_response("edit_file.html", context)
它是一个实际的404或没有告诉你,这是一个无效的网址给你有效的URL列表?如果是后者,你可以发布它提供的URL吗? – spulec 2011-05-03 02:04:35
显示你的edit_file视图 – DTing 2011-05-03 02:43:05
查看编辑的问题描述 – 2011-05-03 03:11:14