Flask

python技术面试题(十八)

左心房为你撑大大i 提交于 2021-01-30 10:29:32
正文共: 992 字 5 图 预计阅读时间:3 分钟 每日分享 Children are wonderfully confident in their own imaginations. Most of us lose this confidence as we grow up. 孩子们对自己的想象力非常自信。但是随着我们的成长,大多数人都失去了信心。 猪猪语录 : 今天的分享由我们的猪猪同学提供。 很多时候蒙蔽我们双眼的不是假象,而是自己的执念。 承认自己并非你所以为的那种人,称得上是一种相当可怕的经历。 python技术面试题(十八) 1.给定一个列表,使用sort对其进行去重操作,从最后一个元素开始。 ids = [ 1 , 4 , 3 , 3 , 4 , 2 , 3 , 4 , 5 , 6 , 1 ] ids . reverse () news_ids = list ( set ( ids )) news_ids . sort ( key = ids . index ) print ( news_ids ) ---------------- [ 1 , 6 , 5 , 4 , 3 , 2 ] sort()函数 语法: list . sort ( self , key = None , reverse = False ) 用于对原列表进行排序。 key ---

Python flask app routing in cpanel: can only access root url

安稳与你 提交于 2021-01-30 09:11:50
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

Python flask app routing in cpanel: can only access root url

与世无争的帅哥 提交于 2021-01-30 09:11:32
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

Python flask app routing in cpanel: can only access root url

女生的网名这么多〃 提交于 2021-01-30 09:09:57
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

Python flask app routing in cpanel: can only access root url

穿精又带淫゛_ 提交于 2021-01-30 09:09:41
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

Python flask app routing in cpanel: can only access root url

会有一股神秘感。 提交于 2021-01-30 09:08:40
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

Python flask app routing in cpanel: can only access root url

倾然丶 夕夏残阳落幕 提交于 2021-01-30 09:08:25
问题 I have a python app set up in cPanel. I have set the app URL to backend and when I query mydomain.com/backend/ it gives back the app's root view (which is just an html "hello there"). The rest of the endpoints are the ones I need but I get back a 404 on every other URL @app.route('/') def hello_world(): logger.debug("Hi there") return "<h1 style='color:red'>Hi there</h1>" @app.route('/test', methods=['POST','GET']) def test(): logger.info("Got test request") return {'ok' : 'success!'}

SSL Error - wrong version number (HTTPS to HTTP)

喜你入骨 提交于 2021-01-29 21:30:22
问题 I receive an error when i try to "redirect" and https request to http by a stunnel server. construction: flask server: serve https which includes an button with a https request to another server (stunnel4). stunnel: receives the request and redirect it to a local (http) server. the stunnel server failes by following error: Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG5[1744]: Service [https] accepted connection from <external_IP>:51874 Mär 27 19:27:20 raspberrypi stunnel[1400]: LOG5[1744]: s

JavaScript Date() inconsistence with Safari's and non-Safari implementation

允我心安 提交于 2021-01-29 20:28:55
问题 I have following trivial JS code: document.getElementById ("testLastTime").innerHTML=new Date ('2020-07-01T11:59:45').toLocaleString() On Chrome, Edge, Firefox (all on Windows) is shows correct date: 7/1/2020, 11:59:45 AM However on iOS devices this date is interpreted as UTC and following date is shown (I am on PST): 7/1/2020 4:59:45 AM This code is part of the larger project, where datetime ISO formated string in local time (without TZ) is send to client by the server (Python flask). What

redis connection error within docker container

泪湿孤枕 提交于 2021-01-29 19:59:32
问题 I'm trying to setup a light-weight RQ task queue app running in Docker. I keep on getting this error: ValueError: Redis URL must specify one of the following schemes (redis://, rediss://, unix://) When grabbing from environmental variable ( os.getenv() ) it doesn't work, but somehow when hard-coding in redis://redis:6379/0 , it seems to work. However, this is not really a long-term solution in my opinion. I looked at: link1 and link2, but there wasn't really a solution, the thread went dead.