これが私のコードと私の問題です。
import web
render = web.template.render('templates/')
urls = (
'/(.+)', 'index'
)
class index:
def GET(self, lang):
return render.index(lang)
if __name__=="__main__":
app = web.application(urls, globals())
app.run()
私のindex.htmlはこれです:
$def with (lang)
$if lang == 'en':
I just wanted to say <em>hello</em>
$elif lang =='es' or lang == '':
<em>Hola</em>, mundo!
$else:
página no disponible en este idioma
問題は、このコードを実行すると 404 エラーが発生することです。問題は URL 部分、具体的には /(.+) である可能性があると思います。私はそれを正しく使用していないと思います。複数のパラメーターを使用できるように機能させたいと思います。/(.*) を使用すると機能しますが、複数のパラメーターでは機能しません。ドキュメントによると、複数のパラメーターには * の代わりに + を使用する必要があります
事前に感謝します。