フォームからデータを投稿してwebapp2で処理する際に問題があります。webapp2 - フォームデータの投稿方法 - アプリケーションエンジン
フォームアクションでデータを送信するページを含む、一般的なwebapp2のフォームからデータを処理する方法がわかりません。
私のフォームは '/ schedule/create-consult'ページにあります。私は最初、最初の2つのフィールドを同じページに提出することをテストしています(つまり、最初の名前と最後の名前が/ schedule/create-consultsに投稿されています)。 - メソッドのPOSTがこのリソースに対して許可されていない
405メソッドが許可されていない:私はメッセージを取得し、[保存]ボタンをクリックすると
私のフォームは、この
<form method="post" action="/schedule/create-consult">
<div class="row">
<div class="col-md-6">
<label>First Name</label>
<input class="form-control input-lg" type="text" name="first_name" />
<br/>
</div>
<div class="col-md-6">
<label>Last Name</label>
<input class="form-control input-lg" type="text" name="last_name" />
</div>
<input type="submit" value="save">
</div>
</form>
のように見えます。
私のルートは次のようになり、この
app = webapp2.WSGIApplication([
('/', MainPage),
('/schedule', SchedulePage),
('/consults', ConsultsPage),
('/schedule/create-consult', CreateConsultPage),
('/consults/john-smith-030617-0930', JohnSmithPage)
], debug=True)
CreateConsultsPageのための私のハンドラは、この
class CreateConsultPage(webapp2.RequestHandler):
def get(self):
template = JINJA_ENVIRONMENT.get_template('/templates/create-consult.html')
self.response.out.write(template.render())
のように見え、私のapp.yamlは以下のとおりである:それはしようとしている
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /css
static_dir: css
- url: /images
static_dir: images
- url: /js
static_dir: js
- url:/
script: main.app
- url: /schedule
script: main.app
- url: /consults
script: main.app
- url: /schedule/create-consult
script: main.app
- url: /consults/john-smith-030617-0930
script: main.app
libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
[メソッドのPOSTがこのリソースAppEngineのFacebookのアプリケーションのために許可されていない許可されていません405方法](http://stackoverflow.com/questions/13346309/405-method-not-allowed-the-の可能性のある重複メソッドのpost-is-not-for-this-resource-appengin) –
def get(self):と次の行の間にインデントがあるはずです –