r/learnflask • u/domtomthedev • Oct 16 '19
learnflask has been created
A community for people who want to learn Flask or for those beginner questions
r/learnflask • u/domtomthedev • Oct 16 '19
This is a helpful community of Flask developers who want to help out the beginner questions.
r/learnflask • u/domtomthedev • Oct 16 '19
A community for people who want to learn Flask or for those beginner questions
r/learnflask • u/[deleted] • Nov 04 '22
First, a disclaimer. I am not a front end dev but I have to do some simple ui work for my job and I'm just geting started figuring out javascript (as well as flask) so I may have done something stupid.
Any help to get the "action" and "unitid" out of the request would be appreciated
frontend code:
cellClick: function(e, cell) {
let stuff = cell.getData().StuffId
fetch("/example/remove_stuff", {
method: 'POST',
body: JSON.stringify({
action: "delete",
stuffId: stuff
})
});
cell.getRow().delete();backend code:
@example.route('/remove_stuff', methods=['POST'])
def remove_stuff():
# try to access the body of the given post requestTHINGS I'VE TRIED:
request.body -> invalid attribute (I find this hard to understand since request.method works)
request.args -> gives me an ImmutableMultiDict([]) which appears to be empty
request.get_json() -> returns None
r/learnflask • u/No_Pain1033 • Sep 26 '22
Im trying to render some data through a Jinja template in python. However this is all done inside a website. My website is made using flask and the views function i need the rendering done inside of is in a Blueprint.
Can i just make a new env to render the data in? Or do i need to use the one used for the website?
r/learnflask • u/[deleted] • Mar 06 '23
Hello. Thanks for any help. I have a form similar to this
NOTE: I'm using WTForms
class MyForm(FlaskForm)
is_edit_mode = HiddenField(default=False)
field_a = StringField(validators=[DataRequired()]
field_b = StringField(validators=[DataRequired()]
field_c = StringField(validators=[DataRequired()]If is_edit_mode is true, I want to skip validation on field_a and b because they will be set to disabled=True in the HTML.
r/learnflask • u/Mescallan • Aug 28 '23
I had to do a bunch of troubleshooting to get to this point already and GPT4 is basically walking me in circles.
I have an app with a directory
Root
|--folder1
|----folder2
|------__init__.py
|------script1.py
|------script2.py
|------script3.py
|--__init__.py
|--models.py
|--views.py
etc
the only way I've been able to import classes from models.py into script1.py is with:
from root.folder1.models import class1
this will not return an error running manually from within the script or from a terminal
but when I run the script from the flask app the modules do not import, giving me the error:ModuleNotFoundError: No module named 'Root'
I have also tried:from folder1.models import class1
and it will return:ModuleNotFoundError: No module named 'folder1'
I have __init__.py files in the proper position and the script is running in isolation. Please help I have been banging my head against the wall for a few days now trying to solve this.
r/learnflask • u/Piwi9000 • Nov 01 '24
I upgraded Weasyprint after way too long. I haven't written any tests for my web app (because I'm stupid), but I went and tested the thing Weasyprint was supposed to do and I got an internal server error (500). When I went (in Pythonanywhere) to look in the error log however, I only got this:
2024-11-01 21:31:45,533: Ignored `box-shadow: 1` at 7:13, unknown property.
2024-11-01 21:31:45,535: Ignored `justify-content: left` at 26:9, invalid value.
2024-11-01 21:35:53,921: Ignored `box-shadow: 1` at 7:13, unknown property.
2024-11-01 21:35:53,923: Ignored `justify-content: left` at 26:9, invalid value.I guessed it was probably because of upgrading Weasyprint so I downgraded it again and it works again. But are these lines errors? How can I identify what goes wrong ?
r/learnflask • u/Godfist96 • Dec 19 '21
Hello Everyone,
I am new to Flask/HTML i.e. Web development area. I would like to create a web interface using Flask and HTML such that the user inputs certain parameters like the value of variables x and y. User also types a function in another input field on HTML (e.g. x^2 + y^2). I would like to send this input to my flask and then evaluate the values entered and based on the function(x^2 + y^2) provided my the user. Is there a way I could do this?