From fvillarroel at yahoo.com Wed Nov 4 17:45:29 2015 From: fvillarroel at yahoo.com (Fernando Villarroel) Date: Wed, 4 Nov 2015 19:45:29 -0300 Subject: [Flask] Extra icon flask-admin Message-ID: <145FBA72-84AC-4F52-94D6-0434D7D57EE5@yahoo.com> Dear All. I am very new user of flask. I need to add extra icon men? to flask-admin like edit and delete icon. How i can do? I appreciate some example or link referente. Regards Enviado desde mi iPhone From jicenhower at yahoo.com Wed Nov 11 12:16:00 2015 From: jicenhower at yahoo.com (Jim Icenhower) Date: Wed, 11 Nov 2015 17:16:00 +0000 (UTC) Subject: [Flask] TypeError: xxxx is not JSON serializable References: <1222014601.2653770.1447262160811.JavaMail.yahoo.ref@mail.yahoo.com> Message-ID: <1222014601.2653770.1447262160811.JavaMail.yahoo@mail.yahoo.com> Hi, I'm using Flask Appbuilder which seems to provide it's own REST implemention instead of using Flask-Rest.I have the following class. When I call it's view's api/read function I get the error "TypeError: TXABCD2015 is not JSON serializable". Note that TXABCD2015 is the value returned by the?repr() method of the related Event object. It throws this error on all objects related through foreign keys. I really would like the Event?repr() value to be included in the json if possible. I would appreciate any advice on what should I do to handle this.Thanks!class CarClass(Model,ModelEnhancer): __tablename__ = "CarClass" CarClassID = Column(Integer, primary_key=True) CarClassKey = Column(String(30), unique=True, nullable=False) Marque = Column(String(30), nullable=False) Title = Column(String(30), nullable=False) Description = Column(Text(1000), nullable=False) StartYear = Column(Integer, nullable = True) EndYear = Column(Integer, nullable = True) EventID = Column(Integer, ForeignKey('event.EventID'), nullable=False) Event = relationship('Event') def setValues(self, row): self.validationMessages = "" for key, value in row.iteritems(): setattr(self, key, value) def list_mapped_columns(self): list_obj_mapped_columns(self) def isValid(self): validationMessage = "" columns = self.required_column_names for name in columns: print name if not getattr(self, name): # Add validation message self.validationMessages = self.validationMessages + ", " + name + " can not be empty." return len(self.validationMessages) == 0 def __repr__(self): return self.CarClassKey?Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Thu Nov 12 12:54:50 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Thu, 12 Nov 2015 12:54:50 -0500 Subject: [Flask] choosing a deployment for a web app Message-ID: So I have a web application that I think will have, at most, 20 users in a day. I can't imagine that more than 5 people would be using the application in a 15-20 minute range of each other. I have considered deployment with a few services; Heroku or AWS. I have looked into using VMware via Vagrant. I am at a point where I am not sure how choose the right service for my use case. The application deals with online ordering for a restaurant. At the moment I have a small database for storing user credentials for the restaurants order tracking UI. There are no particularly large tasks that happen, i.e. file uploads or sending out mass emails. Any guidance regarding a cheap, yet effective deployment for my application would be greatly appreciated. Fortunately I am doing this for a friends restaurant, so I have a testing ground. But the last thing I want is for users to have a bad experience, and think that my application sucks (obviously). Looking forward to hearing some responses. -Kyle (learning web development with Flask, :+1: for the awesome tool.) -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidbaumgold.com Thu Nov 12 13:00:07 2015 From: david at davidbaumgold.com (David Baumgold) Date: Thu, 12 Nov 2015 13:00:07 -0500 Subject: [Flask] choosing a deployment for a web app In-Reply-To: References: Message-ID: If your application is for online ordering for a restaurant, and this is your first time doing this sort of thing, then I recommend using Heroku. They?re not cheap, but they?re rock-solid reliable, and they make the process of making edits and deploying them SO EASY. If your friend is going to use this website as part of his business, then you should absolutely be sure that things like backups and security are taken into consideration, and Heroku handles a ton of that for you. If you want to go cheaper, AWS is a good option, but frankly you need to learn a lot in order to use it effectively. Digital Ocean is in the same boat. I think that Vagrant is only for development, not for deployment, but I could be wrong about that. David Baumgold From:?Kyle Lawlor Reply:?Kyle Lawlor Date:?November 12, 2015 at 12:55:02 PM To:?flask at python.org Subject:? [Flask] choosing a deployment for a web app So I have a web application that I think will have, at most, 20 users in a day. I can't imagine that more than 5 people would be using the application in a 15-20 minute range of each other. I have considered deployment with a few services; Heroku or AWS. I have looked into using VMware via Vagrant. I am at a point where I am not sure how choose the right service for my use case. The application deals with online ordering for a restaurant. At the moment I have a small database for storing user credentials for the restaurants order tracking UI. There are no particularly large tasks that happen, i.e. file uploads or sending out mass emails. Any guidance regarding a cheap, yet effective deployment for my application would be greatly appreciated. Fortunately I am doing this for a friends restaurant, so I have a testing ground. But the last thing I want is for users to have a bad experience, and think that my application sucks (obviously). Looking forward to hearing some responses. -Kyle (learning web development with Flask, :+1: for the awesome tool.) _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From tamasiaina at gmail.com Thu Nov 12 13:22:47 2015 From: tamasiaina at gmail.com (Jonathan Chen) Date: Thu, 12 Nov 2015 10:22:47 -0800 Subject: [Flask] choosing a deployment for a web app In-Reply-To: References: Message-ID: Just a food for thought. You could also look into Google App Engine. Their service is cheap and you could possibly be running in the free tier most of the time. ~Jonathan C. On Thu, Nov 12, 2015 at 9:54 AM, Kyle Lawlor wrote: > So I have a web application that I think will have, at most, 20 users in a > day. I can't imagine that more than 5 people would be using the application > in a 15-20 minute range of each other. > > I have considered deployment with a few services; Heroku or AWS. I have > looked into using VMware via Vagrant. I am at a point where I am not sure > how choose the right service for my use case. > > The application deals with online ordering for a restaurant. At the moment > I have a small database for storing user credentials for the restaurants > order tracking UI. There are no particularly large tasks that happen, i.e. > file uploads or sending out mass emails. > > Any guidance regarding a cheap, yet effective deployment for my > application would be greatly appreciated. Fortunately I am doing this for a > friends restaurant, so I have a testing ground. But the last thing I want > is for users to have a bad experience, and think that my application sucks > (obviously). > > Looking forward to hearing some responses. > > -Kyle > (learning web development with Flask, :+1: for the awesome tool.) > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jani.sumak at gmail.com Thu Nov 12 13:25:37 2015 From: jani.sumak at gmail.com (=?UTF-8?Q?Jani_=C5=A0umak?=) Date: Thu, 12 Nov 2015 18:25:37 +0000 Subject: [Flask] choosing a deployment for a web app In-Reply-To: References: Message-ID: Hitchiking on that last answer, pythonanywhere.com has some decent options. And it's easy to set up. Cheeres, Jani On Thu, Nov 12, 2015 at 7:22 PM Jonathan Chen wrote: > Just a food for thought. You could also look into Google App Engine. Their > service is cheap and you could possibly be running in the free tier most of > the time. > > > ~Jonathan C. > > On Thu, Nov 12, 2015 at 9:54 AM, Kyle Lawlor wrote: > >> So I have a web application that I think will have, at most, 20 users in >> a day. I can't imagine that more than 5 people would be using the >> application in a 15-20 minute range of each other. >> >> I have considered deployment with a few services; Heroku or AWS. I have >> looked into using VMware via Vagrant. I am at a point where I am not sure >> how choose the right service for my use case. >> >> The application deals with online ordering for a restaurant. At the >> moment I have a small database for storing user credentials for the >> restaurants order tracking UI. There are no particularly large tasks that >> happen, i.e. file uploads or sending out mass emails. >> >> Any guidance regarding a cheap, yet effective deployment for my >> application would be greatly appreciated. Fortunately I am doing this for a >> friends restaurant, so I have a testing ground. But the last thing I want >> is for users to have a bad experience, and think that my application sucks >> (obviously). >> >> Looking forward to hearing some responses. >> >> -Kyle >> (learning web development with Flask, :+1: for the awesome tool.) >> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> >> > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From klawlor419 at gmail.com Thu Nov 12 13:54:48 2015 From: klawlor419 at gmail.com (Kyle Lawlor) Date: Thu, 12 Nov 2015 13:54:48 -0500 Subject: [Flask] choosing a deployment for a web app In-Reply-To: References: Message-ID: Thanks for the responses, this is all very helpful. I will look into all of these. Any further comments and suggestions are welcome. On Thu, Nov 12, 2015 at 1:25 PM, Jani ?umak wrote: > Hitchiking on that last answer, pythonanywhere.com has some decent > options. And it's easy to set up. > > Cheeres, Jani > > On Thu, Nov 12, 2015 at 7:22 PM Jonathan Chen > wrote: > >> Just a food for thought. You could also look into Google App Engine. >> Their service is cheap and you could possibly be running in the free tier >> most of the time. >> >> >> ~Jonathan C. >> >> On Thu, Nov 12, 2015 at 9:54 AM, Kyle Lawlor >> wrote: >> >>> So I have a web application that I think will have, at most, 20 users in >>> a day. I can't imagine that more than 5 people would be using the >>> application in a 15-20 minute range of each other. >>> >>> I have considered deployment with a few services; Heroku or AWS. I have >>> looked into using VMware via Vagrant. I am at a point where I am not sure >>> how choose the right service for my use case. >>> >>> The application deals with online ordering for a restaurant. At the >>> moment I have a small database for storing user credentials for the >>> restaurants order tracking UI. There are no particularly large tasks that >>> happen, i.e. file uploads or sending out mass emails. >>> >>> Any guidance regarding a cheap, yet effective deployment for my >>> application would be greatly appreciated. Fortunately I am doing this for a >>> friends restaurant, so I have a testing ground. But the last thing I want >>> is for users to have a bad experience, and think that my application sucks >>> (obviously). >>> >>> Looking forward to hearing some responses. >>> >>> -Kyle >>> (learning web development with Flask, :+1: for the awesome tool.) >>> >>> _______________________________________________ >>> Flask mailing list >>> Flask at python.org >>> https://mail.python.org/mailman/listinfo/flask >>> >>> >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorian.hoxha at gmail.com Fri Nov 13 07:57:44 2015 From: dorian.hoxha at gmail.com (Dorian Hoxha) Date: Fri, 13 Nov 2015 13:57:44 +0100 Subject: [Flask] choosing a deployment for a web app In-Reply-To: References: Message-ID: You should look into webfaction (affiliate link). It is the best combination of advanced/cheap shared-hosting plan that exists. On Thu, Nov 12, 2015 at 7:54 PM, Kyle Lawlor wrote: > Thanks for the responses, this is all very helpful. I will look into all > of these. Any further comments and suggestions are welcome. > > On Thu, Nov 12, 2015 at 1:25 PM, Jani ?umak wrote: > >> Hitchiking on that last answer, pythonanywhere.com has some decent >> options. And it's easy to set up. >> >> Cheeres, Jani >> >> On Thu, Nov 12, 2015 at 7:22 PM Jonathan Chen >> wrote: >> >>> Just a food for thought. You could also look into Google App Engine. >>> Their service is cheap and you could possibly be running in the free tier >>> most of the time. >>> >>> >>> ~Jonathan C. >>> >>> On Thu, Nov 12, 2015 at 9:54 AM, Kyle Lawlor >>> wrote: >>> >>>> So I have a web application that I think will have, at most, 20 users >>>> in a day. I can't imagine that more than 5 people would be using the >>>> application in a 15-20 minute range of each other. >>>> >>>> I have considered deployment with a few services; Heroku or AWS. I have >>>> looked into using VMware via Vagrant. I am at a point where I am not sure >>>> how choose the right service for my use case. >>>> >>>> The application deals with online ordering for a restaurant. At the >>>> moment I have a small database for storing user credentials for the >>>> restaurants order tracking UI. There are no particularly large tasks that >>>> happen, i.e. file uploads or sending out mass emails. >>>> >>>> Any guidance regarding a cheap, yet effective deployment for my >>>> application would be greatly appreciated. Fortunately I am doing this for a >>>> friends restaurant, so I have a testing ground. But the last thing I want >>>> is for users to have a bad experience, and think that my application sucks >>>> (obviously). >>>> >>>> Looking forward to hearing some responses. >>>> >>>> -Kyle >>>> (learning web development with Flask, :+1: for the awesome tool.) >>>> >>>> _______________________________________________ >>>> Flask mailing list >>>> Flask at python.org >>>> https://mail.python.org/mailman/listinfo/flask >>>> >>>> >>> _______________________________________________ >>> Flask mailing list >>> Flask at python.org >>> https://mail.python.org/mailman/listinfo/flask >>> >> > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnieder at gmx.de Fri Nov 13 10:27:58 2015 From: davidnieder at gmx.de (David Nieder) Date: Fri, 13 Nov 2015 16:27:58 +0100 Subject: [Flask] TypeError: xxxx is not JSON serializable In-Reply-To: <1222014601.2653770.1447262160811.JavaMail.yahoo@mail.yahoo.com> References: <1222014601.2653770.1447262160811.JavaMail.yahoo.ref@mail.yahoo.com> <1222014601.2653770.1447262160811.JavaMail.yahoo@mail.yahoo.com> Message-ID: <5646017E.7050201@gmx.de> On 11.11.2015 18:16, Jim Icenhower via Flask wrote: > Hi, > I'm using Flask Appbuilder which seems to provide it's own REST implemention instead of using Flask-Rest.I have the following class. When I call it's view's api/read function I get the error "TypeError: TXABCD2015 is not JSON serializable". Note that TXABCD2015 is the value returned by the repr() method of the related Event object. It throws this error on all objects related through foreign keys. I really would like the Event repr() value to be included in the json if possible. I would appreciate any advice on what should I do to handle this.Thanks!class CarClass(Model,ModelEnhancer): > __tablename__ = "CarClass" > CarClassID = Column(Integer, primary_key=True) > CarClassKey = Column(String(30), unique=True, nullable=False) > Marque = Column(String(30), nullable=False) > Title = Column(String(30), nullable=False) > Description = Column(Text(1000), nullable=False) > StartYear = Column(Integer, nullable = True) > EndYear = Column(Integer, nullable = True) > EventID = Column(Integer, ForeignKey('event.EventID'), nullable=False) > Event = relationship('Event') > > def setValues(self, row): > self.validationMessages = "" > for key, value in row.iteritems(): > setattr(self, key, value) > > def list_mapped_columns(self): > list_obj_mapped_columns(self) > > def isValid(self): > validationMessage = "" > columns = self.required_column_names > for name in columns: > print name > if not getattr(self, name): > # Add validation message > self.validationMessages = self.validationMessages + ", " + name + " can not be empty." > return len(self.validationMessages) == 0 > > def __repr__(self): > return self.CarClassKey Jim > Hi Jim, I don't know Flask-Appbuilder at all but I gave the code a glance and it seems like flask's jsonify method is used to generate json. Flask extends the json module and calls an __html__ method if your object has one (see link below). So you could try adding sth like this to the objects in question: def __html__(self): return repr(self) David http://flask.pocoo.org/docs/0.10/api/#module-flask.json From petef4+usenet at gmail.com Fri Nov 13 16:20:42 2015 From: petef4+usenet at gmail.com (Pete Forman) Date: Fri, 13 Nov 2015 21:20:42 +0000 Subject: [Flask] choosing a deployment for a web app References: Message-ID: Dorian Hoxha writes: > You should look into webfaction > (affiliate link). It is the best combination of advanced/cheap > shared-hosting plan that exists. It's a bit early to judge but I deployed a Flask app on OpenShift Online a couple of weeks ago. It is operated by Red Hat. The two main reasons I chose it are the https support and for my usage it is free. -- Pete Forman https://payg-petef.rhcloud.com (moving from http://petef.22web.org/payg.html) From francisco at roque.com.pt Tue Nov 24 09:06:04 2015 From: francisco at roque.com.pt (Francisco Roque) Date: Tue, 24 Nov 2015 15:06:04 +0100 Subject: [Flask] Flask path route variable with a dot between two forward slashes Message-ID: Hi all, I am trying to capture an url from a flask request. All works fine except when the url has a dot in between two forward slashes, for example: http://met.no/Nyheter/./Fase+C:+Ekstremv?ret+Petra+p?g?r.b7C_xdrSX6.ips The route used is below: @app.route('/url/', methods=['GET']) def get_url(url): return url I understand flask is somehow resolving relative urls and ./ might mean the current directory, but how can I make it so the url is taken as is? Best, Francisco -------------- next part -------------- An HTML attachment was scrubbed... URL: From decipher.hk at gmail.com Tue Nov 24 20:51:06 2015 From: decipher.hk at gmail.com (=?utf-8?B?Um9kcmlnbyBSYW3DrXJleiBOb3JhbWJ1ZW5h?=) Date: Wed, 25 Nov 2015 01:51:06 +0000 Subject: [Flask] Flask path route variable with a dot between two forward slashes In-Reply-To: References: Message-ID: I thinks is as browser resolve the URL testing with your code example like @app.route('/url/', methods=['GET']) def get_url(url): app.logger.debug(url) return jsonify( url= url, ) Log from request from a browser 192.168.10.1 - - [24/Nov/2015 22:46:17] "GET /url/http://met.no/Nyheter/Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips HTTP/1.1" 200 - Using curl curl 'http://192.168.10.2:5000/url/http://met.no/Nyheter/./Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips' { "url": "http://met.no/Nyheter/./Fase+C:+Ekstremv\u00e6ret+Petra+p\u00e5g\u00e5r.b7C_xdrSX6.ips" }% 192.168.10.1 - - [24/Nov/2015 22:46:25] "GET /url/http://met.no/Nyheter/./Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips HTTP/1.1" 200 - Regards, November 24 2015 11:06 AM, "Francisco Roque" wrote: > Hi all, > > I am trying to capture an url from a flask request. All works fine except when the url has a dot in > between two forward slashes, for example: > > http://met.no/Nyheter/./Fase+C:+Ekstremv?ret+Petra+p?g?r.b7C_xdrSX6.ips > > The route used is below: > > @app.route('/url/', methods=['GET']) > def get_url(url): > return url > > I understand flask is somehow resolving relative urls and ./ might mean the current directory, but > how can I make it so the url is taken as is? > > Best, > Francisco From francisco at roque.com.pt Wed Nov 25 02:17:05 2015 From: francisco at roque.com.pt (Francisco Roque) Date: Wed, 25 Nov 2015 08:17:05 +0100 Subject: [Flask] Flask path route variable with a dot between two forward slashes In-Reply-To: References: Message-ID: Thank you, that was it. I was using curl and Chrome, but the curl version I have tried resolving the url. Using another client worked as intended. Best, Francisco On Wed, Nov 25, 2015 at 2:51 AM, Rodrigo Ram?rez Norambuena < decipher.hk at gmail.com> wrote: > I thinks is as browser resolve the URL > > testing with your code example like > > > @app.route('/url/', methods=['GET']) > def get_url(url): > app.logger.debug(url) > return jsonify( > url= url, > ) > > Log from request from a browser > 192.168.10.1 - - [24/Nov/2015 22:46:17] "GET /url/ > http://met.no/Nyheter/Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips > HTTP/1.1" 200 - > > Using curl > curl ' > http://192.168.10.2:5000/url/http://met.no/Nyheter/./Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips > ' > { > "url": " > http://met.no/Nyheter/./Fase+C:+Ekstremv\u00e6ret+Petra+p\u00e5g\u00e5r.b7C_xdrSX6.ips > " > }% > > 192.168.10.1 - - [24/Nov/2015 22:46:25] "GET /url/ > http://met.no/Nyheter/./Fase+C:+Ekstremv%C3%A6ret+Petra+p%C3%A5g%C3%A5r.b7C_xdrSX6.ips > HTTP/1.1" 200 - > > Regards, > > November 24 2015 11:06 AM, "Francisco Roque" > wrote: > > Hi all, > > > > I am trying to capture an url from a flask request. All works fine > except when the url has a dot in > > between two forward slashes, for example: > > > > http://met.no/Nyheter/./Fase+C:+Ekstremv?ret+Petra+p?g?r.b7C_xdrSX6.ips > > > > > The route used is below: > > > > @app.route('/url/', methods=['GET']) > > def get_url(url): > > return url > > > > I understand flask is somehow resolving relative urls and ./ might mean > the current directory, but > > how can I make it so the url is taken as is? > > > > Best, > > Francisco > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddwiggins at advpubtech.com Wed Nov 25 15:56:48 2015 From: ddwiggins at advpubtech.com (Don Dwiggins) Date: Wed, 25 Nov 2015 12:56:48 -0800 Subject: [Flask] Having troubles with template rendering in class-based routing Message-ID: I'm having trouble doing routing with class-based dispatching. In my url_map, I have a rule: "' (HEAD, OPTIONS, GET) -> Home>". The view_func set to: > self.RenderTemplateView.as_view( self.label, self.label+'.html', > 'templates') where self.label='Home', and there's a template in "templates/Home.html" that renders differently depending on whether has a value or is None. RenderTemplateView is defined as: > class RenderTemplateView(flask.views.View): > def __init__(self, template_name, *args, **kwargs): > self.template_name = template_name > > def dispatch_request(self, *args, **kwargs): > return flask.render_template(self.template_name) Call it with "http://127.0.0.1:5000/Home/thing" renders the template, except that the variable is bound to None, not to "thing". If I add "name='thing' " to the render_template call, it does get included in the display. I've tried a number of things, including inserting a line "x = 1/0" before the render_template call to get a traceback, then examining the sequence of calls; I couldn't find anything helpful. Decorator-based routing works fine, but isn't an option for me. Any good words appreciated, -- Don Dwiggins Advanced Publishing Technology -------------- next part -------------- An HTML attachment was scrubbed... URL: