hi I created a simple website to calculate the square of the number. below is the code calculate.html homepage.html python now I want to display input number in URL path. e.g. http://127.0.0.1:3000/square/10 so I’ve tried this but it didn’t work. What could I do? Answer You could get variables directly parsed from Flask URL Edit:
Tag: flask
Python, Mqtt : can publish but can’t receive message on docker
I’m running two dockers : one for the mqtt server using mosquitto the other using flask_mqtt the flask container is receiving the CONNACK and is sending the subscribe to the broker but never get any SUBACK however it manages to publish hello word to /home/mytopic (mqtt-explorer proof) this is quite strange because it works without any problem outside of a
Can a website’s controlling Python code be viewed?
I am trying to place a simple Flask app within a Docker container to be hosted on Firebase as per David East’s article on https://medium.com/firebase-developers/hosting-flask-servers-on-firebase-from-scratch-c97cfb204579 Within the app, I have used Flask email to send emails automatically. Is it safe to leave the password as a string in the Python code? Answer It’s extremely unsafe. The password shouldn’t be in
Flask-SQLAlchemy db.create_all() raises RuntimeError working outside of application context
I recently updated Flask-SQLAlchemy, and now db.create_all is raising RuntimeError: working outside of application context. How do I call create_all? This raises the following error: Answer As of Flask-SQLAlchemy 3.0, all access to db.engine (and db.session) requires an active Flask application context. db.create_all uses db.engine, so it requires an app context. When Flask handles requests or runs CLI commands, a
How to run server in development mode with flask?
I am learning to use flask and I want to run the server for an application in development mode, for this I do the following: When I run I get the following in the terminal: enter image description here Environment:development does not appear to me as I understand it should appear. In fact, before doing this I don’t get Environment:production
Flask error: Method Not Allowed The method is not allowed for the requested URL
Everytime I register a new person in my website, it appears the “Method Not Allowed The method is not allowed for the requested URL.” Page. Can anyone help me? /// Toda vez que eu cadastro uma nova pessoa no meu site, aparece a página “Method Not Allowed. The method is not allowed for the requested URL.” Alguém pode me ajudar?
How to add a function to app context in flask
I am trying to use flask blueprints to organize the flask projects I build. And I found out a that context can be used to export variables from main.py to blueprints. main.py(or _init_.py) my_data can be retrieved from a blueprint using current_app bp1.py Now I created a function rand_string in main.py and want to add it to the context. main.py
Im managed to display values of a table in html with flask and python but i dont understand the logic behind my solution
this part of code im using to Display the entries in the database on index.html birthday database and this is the html code i use to display the name, the month , and day can someone explain if i have assign and the variable name = people whats the logic behind this loop ? Answer I recommend you to learn
How to collect WTForms data through loop without explicitly stating the name of each field?
I am following CoreyMSchafer’s Flask-blog tutorial. Here, I can create, update and delete posts using WTForms and SQLAlchemy. However, to do that, I have to explicitly mention the name of the form fields. For example, to update a post (assuming a post only has title and content): where the model is and the WTForm is However, what if my form
Why does my flask route show 404, after trying to link it into my starting page
enter image description here[ How my search route appears This the code used in my app.py. I have tried {href=”./search.html”} but there is no difference. Edit How my project folder looks like Edit 2: My mistake in the routing Answer EDIT to link your routes from within your HTML pages, you can use the url_for function inside double curly brackets.