Flask

Can't get dash app run on IIS with flask server

徘徊边缘 提交于 2021-02-11 18:10:19
问题 I have two websites (both are using Dash & Flask) on my IIS (Windows Server 2016). The first one is a minimal working example consisting of app.py and web.config. For somehow I cannot get the second site working. Below both examples and the error message is attached. 1 Working Example FastCGI-Settings: PYTHONPATH: C:\inetpub\wwwroot\mvp WSGI_HANDLER: app.server app.py import flask import dash import dash_core_components as dcc import dash_html_components as html server = flask.Flask(__name__)

Can't get dash app run on IIS with flask server

依然范特西╮ 提交于 2021-02-11 18:07:33
问题 I have two websites (both are using Dash & Flask) on my IIS (Windows Server 2016). The first one is a minimal working example consisting of app.py and web.config. For somehow I cannot get the second site working. Below both examples and the error message is attached. 1 Working Example FastCGI-Settings: PYTHONPATH: C:\inetpub\wwwroot\mvp WSGI_HANDLER: app.server app.py import flask import dash import dash_core_components as dcc import dash_html_components as html server = flask.Flask(__name__)

Flask-WTF FileField Uploaded file disappears after a couple days and doesn't show up in the folder

笑着哭i 提交于 2021-02-11 16:49:21
问题 So I'm just using the FileField to add files to the server and it worked the time I tested it on Heroku (by worked I mean the image was rendering properly, granted I should be using some more proper ways to render images), but after a couple days I checked again and the image is no longer rendering properly. I checked my uploads folder and the image is not there any longer (one of the old images were). I ran the test again and the image is showing but the picture file is not in the uploads

Check duplication when edit an exist database field with WTForms custom validator

心不动则不痛 提交于 2021-02-11 16:13:51
问题 I'm having this form with this validator for uniqueness: class CreateTypeForm(FlaskForm): type_name = StringField("Type", validators=[DataRequired()]) description = TextAreaField("Description") submit = SubmitField("Create") def validate_type_name(self, type_name): typeName = mongo.db.types.find_one({"type_name": type_name.data}) if typeName: raise ValidationError("The type already exists.") But need to alter the validator for the form I have when I edit my type : class EditTypeForm(FlaskForm

Check duplication when edit an exist database field with WTForms custom validator

烈酒焚心 提交于 2021-02-11 16:13:31
问题 I'm having this form with this validator for uniqueness: class CreateTypeForm(FlaskForm): type_name = StringField("Type", validators=[DataRequired()]) description = TextAreaField("Description") submit = SubmitField("Create") def validate_type_name(self, type_name): typeName = mongo.db.types.find_one({"type_name": type_name.data}) if typeName: raise ValidationError("The type already exists.") But need to alter the validator for the form I have when I edit my type : class EditTypeForm(FlaskForm

Pymongo get inserted id's even with duplicate key error

▼魔方 西西 提交于 2021-02-11 15:15:51
问题 I am working on a flask app and using mongodb with it. In one endpoint i took csv files and inserts the content to mongodb with insert_many() . Before inserting i am creating a unique index for preventing duplication on mongodb. When there is no duplication i can reach inserted_ids for that process but when it raises duplication error i get None and i can't get inserted_ids . I am using ordered=False also. Is there any way that allows me to get inserted_ids even with duplicate key error ? def

Requests-html: error while running on flask

本小妞迷上赌 提交于 2021-02-11 15:01:28
问题 I've prepared a script that was using requests-html which was working fine. I deployed it in the flask app and now it's giving me RuntimeError: There is no current event loop in thread 'Thread-3'. Here's the full error: Traceback (most recent call last): File "C:\Users\intel\AppData\Local\Programs\Python\Python38\Lib\site-packages\flask\app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) . . . File "C:\Users\intel\Desktop\One page\main.py", line 18, in hello_world r

Connecting Flask Socket.IO Server and Flutter

。_饼干妹妹 提交于 2021-02-11 14:59:50
问题 Basically, I have a socket io flask code: import cv2 import numpy as np from flask import Flask, render_template from flask_socketio import SocketIO, emit from threading import Lock,Timer as tmr from engineio.payload import Payload import base64 from PIL import Image import io app = Flask(__name__) app.config['SECRET_KEY'] = 'secret!' socketio = SocketIO(app) @socketio.on('connect') def connect(): print("a client connected") @socketio.on('disconnect') def disconnect(): print('Client

bootstrap 4 css is not working with mail html template in flask

耗尽温柔 提交于 2021-02-11 14:48:09
问题 so i have this html template that i am using as mail template to send my users for reset their password's. i want to use bootstrap 4 classes in the template but it's not working. How do i make this work ? I've tried inline css and it works fine but i want to use bootstrap 4 css . Any help would be appreciated. HTML template <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{title}}</title>

AttributeError: Object has no attribute 'user_loader'

丶灬走出姿态 提交于 2021-02-11 14:40:56
问题 I'm programming a Website with Authentification while using the Flask Framework. I've tried every solution that i found on the internet but nothing worked for me. My first idea was, that the Project Structure was corrupt. e.g. missing imports from other files. But thats not the problem i think. My models.py File: from flask_login import UserMixin, LoginManager from flaskapp import db, login_manager @login_manager.user_loader def get_user(user): try: return get_id(user) except: return None