#๐ Why isn't my method in Flask working properly?
50 messages ยท Page 1 of 1 (latest)
Please react with โ
to upload your file(s) to our paste bin, which is more accessible for some users.
@wild fjord
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
I didn't delete the explanation I wrote, idk why it's showing that
I'll type it again
The second method in the "app.py" file takes some input, after which it's supposed to run the third method if the method is 'POST', instead it says 'The method is not allowed for the requested URL.'
please use the pastebin, it helps so much with reading your code
you can use multiple files
How do I do that?
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
yeah it does
I see the issue
your input name in the html form should match the key used in your function
<input type="text" name="un" placeholder="Username"><br/>
``` as opposed to ```py
username = request.form["username"]
@wild fjord
Try this for username and password
@dim vault I didn't get what you mean
change this line
username = request.form["username"]
``` to ```py
username = request.form["un"]
if you mean change
username = request.form["username"]
to
username = request.form["un"]
I did that, no change as far as I can see
I did that
I think this line needs to be rechecked
redirect(url_for("user", usr=username))
Ok, I will try
So far I only did static analysis
I think I found out what the problem is
<form action="/hehe" method="POST">
"hehe" doesn't exist
It works now?
any time
I have other apps open. The memory got used fully. It is not an issue with vs code itself.
ah, i see
Now you know what are the action in form and name in inputs are for
You're welcome
!close
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.