2013-05-14 6 views
4

Flask를 통해 AngularJS 앱이 제공됩니다. HTML5 라우팅 모드를 사용 중이므로 여러 URL을 클라이언트 앱으로 리디렉션해야합니다. 와일드 카드 일치를 올바르게 수행해야하는 방법을 잘 모르겠습니다. HTML5 URL 모드를 사용하는 AngularJS의 플라스크 경로

@app.route('/ui/') 
def ui(): 
    return app.send_static_file('index.html') 
@app.route('/ui/<path>') 
def ui(path): 
    return app.send_static_file('index.html') 
@app.route('/ui/<path>/<path2>') 
def ui(path,path2): 
    return app.send_static_file('index.html') 

은 분명히 좋아요하지 않고 하나 개의 경로를 (모든 ui/로 시작)하고 싶은 : 현재 난 그냥 같은 경로의 여러 수준을 일치합니다.

답변

6

경로 url converter 당신을 위해이 작업을 수행 할 수 있습니다

@app.route('/ui/<path:p>') 
def ui(p): 
    return app.send_static_file('index.html') 
관련 문제