Skip to content
Advertisement

Tag: flask

How to display flask data on URL path

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:

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

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

Advertisement