Flask

How to execute long requests

人盡茶涼 提交于 2021-02-08 11:27:03
问题 I am working on building a gui/dashboard type of thing thru which I take input from user.. and when user press submits.. I gather response and fire a job in back end. What I am hoping to achive is.. When the user press submits: and that long job is being processed, I show something like: "Your job has been submitted succesfully) submitted and when it is finished.. I refresh the page to take user to that page. Here is how my route.py snippet looks like @app.route('/',methods=['POST']) def get

How can I get information from 2 separate tables with a single request in Flask?

折月煮酒 提交于 2021-02-08 11:26:30
问题 class posts(db.Model): __tablename__ = "posts" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100)) postName = db.Column(db.String(100)) postDescription = db.Column(db.String(500)) postLike = db.Column(db.Integer) class postComment(db.Model): __tablename__ = "postComment" id = db.Column(db.Integer, primary_key=True) postID = db.Column(db.Integer) senderName = db.Column(db.String(20)) commentPost = db.Column(db.String(300)) class PostsSchema(ma.Schema): class Meta:

Correct way to handle pagination with form submission?

折月煮酒 提交于 2021-02-08 11:21:51
问题 I have a form for doing a search on a search page: <form action="{{ url_for('searchresults') }}" method="get" name="noname" id="theform"> {{ form2.page(id="hiddenpage") }} ... some form inputs <button id = "mybutton" type = "submit" >Apply</button> </form> The form is a SearchForm , where class SearchForm(Form): page = HiddenField() categories = SelectMultipleField(u'Text', validators=[Optional()]) # some other stuff... The view for searchresults handles the form: @app.route('/searchresults',

How do i properly install flask-socketIO?

流过昼夜 提交于 2021-02-08 11:15:46
问题 I have installed multiple times Flask-socketio on my mac, closely reading the instructions and installing the requirements (eventlet/gevent). Athough when i run my simple code to test, it either says that i have not imported the modules or show nothing until i open index.html in my browser where it then displays : The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO) Here is my app.py code: from

How do i properly install flask-socketIO?

冷暖自知 提交于 2021-02-08 11:14:11
问题 I have installed multiple times Flask-socketio on my mac, closely reading the instructions and installing the requirements (eventlet/gevent). Athough when i run my simple code to test, it either says that i have not imported the modules or show nothing until i open index.html in my browser where it then displays : The client is using an unsupported version of the Socket.IO or Engine.IO protocols (further occurrences of this error will be logged with level INFO) Here is my app.py code: from

Flask + Sqlite3 incorrect formatting

两盒软妹~` 提交于 2021-02-08 10:30:44
问题 I am building a website where people can apply for the team, it's been going well so far however when I display the applications on a page, this shows up. (' IGN:\r\n Age:\r\n Server Proxy:\r\n Nationality:\r\n TeamSpeak?:\r\n Discord?:\r\n Twitter?:\r\n YouTube?:\r\n Requirement Option:\r\n Exceptions:\r\n Current Clans?:\r\n Why Ominous?:\r\n\t\t\t\t\t\t',) The textarea looks like this, </header> <h1>Enter Application</h1> <form action="/memberapp" method="POST"> <textarea type="text" name=

Passing Javascript array in Python Flask

倾然丶 夕夏残阳落幕 提交于 2021-02-08 10:27:29
问题 I'm developing and application with python flask and I want to send the return value of a Javascript function(an array) to a python function. Given below is the code. Javascript <script> function getVals(){ a = [ab, cd]; return a; } </script> HTML <a href="/end_stu_live_session">End This</a> Python @app.route('/end_stu_live_session') def end_stu_live_session(): return render_template('stu_dashboard.html') I want the array from the Javascript function getVals() to be passed to the python

Can I use Heroku to host a web app on a path of my custom domain?

北城余情 提交于 2021-02-08 10:14:58
问题 I have a personal website currently hosted on Weebly and the domain was bought on NameCheap. I'm creating a little flask web app that just displays a graph/table and I'm most likely going to use Heroku to deploy it. Is there anyway that I can make the web app display whenever someone visits a specific path of my domain? I guess I could just redirect to the url provided by heroku, but I would rather have it on my domain. 回答1: Short answer: Yes. There is an article explaining how to do this

Can I create a flask webapp in the same url with other pages(like wordpress)?

只愿长相守 提交于 2021-02-08 09:48:17
问题 I have a self-hosted server, only for my lan, with a Wordpress(miservidor.com) and Owncloud(miservidor.com/owncloud) page, those pages work perfectly, and i recentlly decided to create a webapp with flask under the same domain like miservidor.com/musicdownloader. I have tried to make it works but with no results, my config files are these: /etc/apache2/sites-available/000-default.conf <VirtualHost *:80> ServerName miservidor.com Redirect / https://miservidor.com/ </VirtualHost> /etc/apache2

How to pass recorded video data from javascript to python

只谈情不闲聊 提交于 2021-02-08 09:43:13
问题 I'm trying to pass recorded blobs of video data from some javascript code to my routes so that i can save it im a newbie The javascript records video using users webcam and saves it as recordedBlob. I'm trying to pass that recordedBlob data to my python routes for saving. This is the javascript code..it is in my html file <script type="text/javascript"> let video = document.getElementById("video"); let recording = document.getElementById("recording"); let startButton = document.getElementById