2014-04-10 4 views
0

webpy + Apache 서버를 실행 중입니다./projects/Index (항상 과거에 작동했던)로 이동하려고하면 404 찾을 수없는 오류가 발생합니다. ctx.fullpath를 검사 할 때 요청 된 경로는 /redirect:/code.py/projects.pyc/Index/Index이며 실제로/projects/Index 일 때 나타납니다. 왜 이런 일이 일어나고 그것을 해결하기 위해 무엇을 할 수 있습니까?
이상한 URL이있는 webpy 404 오류

urls = (
    "/stream","stream", 
    "/","index", 
    "/projects","projects", 
    "/prj/(.+)", "projects", 
    "/projects/(.+)", "projects", 
    "/files","files", 
    "/login", "login", 
    "/Firewall", collector.app_firewall, 
) 

app = web.application(urls, globals()) 
session = web.session.Session(app, web.session.DiskStore('/var/www/sessions'), initializer={'count': 0}) 
application = app.wsgifunc() 
class Content: 
    root = "/var/www/static" #default document root for open() 
    title = "Brian Barrett" #default title 
content = Content() 
content.user = "login" 

class index: 
    def GET(self): 
     content.title = "Brian Barrett" 
     content.content = open(content.root + "/index.html", "r").read() 
     return render.layout(content) 

class projects: 
    def GET(self, project): 
     content.title = project 
     content.content = "Project not found! Check <a href='/projects/index'>here</a>." 
     if project.endswith("js"): 
      return open(content.root + "/projects/" + project).read() 
     #the following returns the index of all projects 
     if project.lower() == "index" or not project or project == "": 
      content.title = "Projects" 
      content.content = open(content.root + "/prj/projects.html", "r").read() 
      return render.layout(content) 
     #find project in /static/projects, return that 
     else: 
      html_projects = [] # new array 
      for root, dirs, files in os.walk("/var/www/static/prj/"): 
       for file in files: 
        if file.endswith(".html"): #if it is an html file 
         html_projects.append(os.path.join(root, file)) #put HTML in array 
      for p in html_projects: 
       if p.find(str(project.lower())) != -1: #if the filename has the request in it 
        content.content = open(p, "r").read() # set content to said HTML 
      content.title = project.replace("_"," ") # important! links must have capitalized titles 
      return render.layout(content) 

답변

0

대답은 내가 projects.pyc라는 같은 디렉토리에 파이썬 바이트 코드 파일을했고 그것을 분명히 거기에 사용자를 리디렉션하려고 시도했습니다 것입니다 : 내 기본 응용 프로그램 파일에서

나는이 코드를 가지고있다. 파일을 삭제하고 문제를 해결했습니다. 그래도 왜 그렇게했는지 혼란스러워.