From connollymorg at gmail.com Tue Aug 4 16:31:24 2015 From: connollymorg at gmail.com (Morgan Connolly) Date: Tue, 4 Aug 2015 20:01:24 +0530 Subject: [Flask] Multiple backend servers with Flask Message-ID: Hello! I have a Flask application that has an architecture like so: http://i.stack.imgur.com/wfVRI.png It currently all runs on a single server, but I need to be able to scale the application by adding in more servers. I know how I can scale the database(by creating a cluster), I do not really care about scaling the message queue at this point, but I can create a cluster for that too. What I am not sure about scaling is the application itself. My sessions are stored client side in cookies (Flask-Login), so that shouldn't be a problem. I am using Redis for storing temporary data that needs to be accessible from every node(application server). This data has a lifetime of 5 minutes, so no big deal. I am using Celery as a task queue, with RabbitMQ as the broker. This is used for running background processes and executing tasks asynchronously. All pages served are basically static HTML, with no AJAX or anything fancy like that. I've thought of setting up two application servers, have each one connect to the same database, same RabbitMQ instance, and same Redis instance, and set up a load balancer in front of it to forward requests to either server. But I'm worried this might cause problems like tasks getting executed twice by Celery; would it? Is there a better way to scale Flask applications? Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From dorian.hoxha at gmail.com Tue Aug 4 18:41:29 2015 From: dorian.hoxha at gmail.com (Dorian Hoxha) Date: Tue, 4 Aug 2015 18:41:29 +0200 Subject: [Flask] Multiple backend servers with Flask In-Reply-To: References: Message-ID: Scaling the app is the ~easiest way. On celery, what is should do (haven't checked) is that it reserves a job so other processes don't get it while 1 is working on it (and if it succeeds, it deletes the job, and if it failes the job can be retrieved by another process) So you should be fine. On Tue, Aug 4, 2015 at 4:31 PM, Morgan Connolly wrote: > Hello! > > I have a Flask application that has an architecture like so: > > http://i.stack.imgur.com/wfVRI.png > > It currently all runs on a single server, but I need to be able to scale > the application by adding in more servers. I know how I can scale the > database(by creating a cluster), I do not really care about scaling the > message queue at this point, but I can create a cluster for that too. > > What I am not sure about scaling is the application itself. > > My sessions are stored client side in cookies (Flask-Login), so that > shouldn't be a problem. I am using Redis for storing temporary data that > needs to be accessible from every node(application server). This data has a > lifetime of 5 minutes, so no big deal. > > I am using Celery as a task queue, with RabbitMQ as the broker. This is > used for running background processes and executing tasks asynchronously. > > All pages served are basically static HTML, with no AJAX or anything fancy > like that. > > I've thought of setting up two application servers, have each one connect > to the same database, same RabbitMQ instance, and same Redis instance, and > set up a load balancer in front of it to forward requests to either server. > But I'm worried this might cause problems like tasks getting executed twice > by Celery; would it? > > Is there a better way to scale Flask applications? > > Thanks. > > _______________________________________________ > 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 Tue Aug 4 18:47:25 2015 From: tamasiaina at gmail.com (Jonathan Chen) Date: Tue, 4 Aug 2015 09:47:25 -0700 Subject: [Flask] Multiple backend servers with Flask In-Reply-To: References: Message-ID: There shouldn't be an issue. Try running multiple celery workers. If you are not experiencing duplication of work there then it shouldn't make a difference when you scale it out. ~Jonathan C. On Tue, Aug 4, 2015 at 9:41 AM, Dorian Hoxha wrote: > Scaling the app is the ~easiest way. > > On celery, what is should do (haven't checked) is that it reserves a job > so other processes don't get it while 1 is working on it (and if it > succeeds, it deletes the job, and if it failes the job can be retrieved by > another process) > > So you should be fine. > > On Tue, Aug 4, 2015 at 4:31 PM, Morgan Connolly > wrote: > >> Hello! >> >> I have a Flask application that has an architecture like so: >> >> http://i.stack.imgur.com/wfVRI.png >> >> It currently all runs on a single server, but I need to be able to scale >> the application by adding in more servers. I know how I can scale the >> database(by creating a cluster), I do not really care about scaling the >> message queue at this point, but I can create a cluster for that too. >> >> What I am not sure about scaling is the application itself. >> >> My sessions are stored client side in cookies (Flask-Login), so that >> shouldn't be a problem. I am using Redis for storing temporary data that >> needs to be accessible from every node(application server). This data has a >> lifetime of 5 minutes, so no big deal. >> >> I am using Celery as a task queue, with RabbitMQ as the broker. This is >> used for running background processes and executing tasks asynchronously. >> >> All pages served are basically static HTML, with no AJAX or anything >> fancy like that. >> >> I've thought of setting up two application servers, have each one connect >> to the same database, same RabbitMQ instance, and same Redis instance, and >> set up a load balancer in front of it to forward requests to either server. >> But I'm worried this might cause problems like tasks getting executed twice >> by Celery; would it? >> >> Is there a better way to scale Flask applications? >> >> Thanks. >> >> _______________________________________________ >> 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 flebber.crue at gmail.com Wed Aug 5 04:16:06 2015 From: flebber.crue at gmail.com (Sayth Renshaw) Date: Wed, 05 Aug 2015 02:16:06 +0000 Subject: [Flask] Flask - data centric with mongo; & ember? Message-ID: Hi Just wondering if anyone can offer some good practical advice on working with flask and mongo for a data centric app. The base requirement is that there will be a lot of grids in the application, sports data based (fantasy) in first version. So was thinking of using something like ember and ember grids http://addepar.github.io/ember-table/#/overview . Open to opinion here that is why I am asking. If that was a good choice then with flask and mongo I should use https://github.com/MongoEngine/flask-mongoengine and to connect data to ember the rest framework http://flask-restful.readthedocs.org/en/0.3.4/ Would this be a good stack to start with ? -------------- next part -------------- An HTML attachment was scrubbed... URL: From seanmckaybeck at gmail.com Thu Aug 6 21:55:45 2015 From: seanmckaybeck at gmail.com (Sean Beck) Date: Thu, 6 Aug 2015 15:55:45 -0400 Subject: [Flask] Flask-Hashing In-Reply-To: References: Message-ID: I made an extension called Flask-Hashing and was hoping I could get some input on it. https://github.com/ThaWeatherman/flask-hashing It is already on PyPI and has docs on Read the Docs. It does work so I guess I'm just looking for anything else that may need to be done for it to be an official Flask extension. Please and thanks! Sean -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidbaumgold.com Thu Aug 6 22:00:38 2015 From: david at davidbaumgold.com (David Baumgold) Date: Thu, 6 Aug 2015 16:00:38 -0400 Subject: [Flask] Flask-Hashing In-Reply-To: References: Message-ID: This looks reasonable to me, but what?s the benefit Flask-Hashing instead of just using the hashlib module directly? From:?Sean Beck Reply:?Sean Beck > Date:?August 6, 2015 at 3:55:58 PM To:?flask at python.org > Subject:? [Flask] Flask-Hashing I made an extension called Flask-Hashing and was hoping I could get some input on it. https://github.com/ThaWeatherman/flask-hashing It is already on PyPI and has docs on Read the Docs. It does work so I guess I'm just looking for anything else that may need to be done for it to be an official Flask extension. Please and thanks! Sean _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From seanmckaybeck at gmail.com Thu Aug 6 22:15:23 2015 From: seanmckaybeck at gmail.com (Sean Beck) Date: Thu, 6 Aug 2015 16:15:23 -0400 Subject: [Flask] Flask-Hashing In-Reply-To: References: Message-ID: The same as Flask-Bcrypt. User only needs 1 line to generate a hash or check one which is common with web apps. I wrote it more to get my feet wet with extensions. On Aug 6, 2015 4:00 PM, "David Baumgold" wrote: > This looks reasonable to me, but what?s the benefit Flask-Hashing instead > of just using the hashlib module directly? > > > From: Sean Beck > Reply: Sean Beck > > Date: August 6, 2015 at 3:55:58 PM > To: flask at python.org > > Subject: [Flask] Flask-Hashing > > I made an extension called Flask-Hashing and was hoping I could get some > input on it. > > https://github.com/ThaWeatherman/flask-hashing > > It is already on PyPI and has docs on Read the Docs. It does work so I > guess I'm just looking for anything else that may need to be done for it to > be an official Flask extension. > > Please and thanks! > > Sean > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Mon Aug 10 05:01:00 2015 From: coreybrett at gmail.com (Corey Boyle) Date: Sun, 9 Aug 2015 23:01:00 -0400 Subject: [Flask] HTML5 validation Message-ID: Is there a supported method to have the return value of render_template validated during development? -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexandru at bluemasters.ro Tue Aug 11 08:53:14 2015 From: alexandru at bluemasters.ro (Alexandru) Date: Tue, 11 Aug 2015 09:53:14 +0300 Subject: [Flask] Allow user to sort DB output Message-ID: <55C99BDA.5040303@bluemasters.ro> Hello everyone, I've built a small Flask app that basically requires a a lot of database interaction. I'm almost done with it now, I just need a way for the user to sort the information that's received from the database (order by name, price, location, etc) The problem is I'm not that good at coding yet and I'm not sure how to go about doing this. I'm not going to paste my code here, to avoid clutter, so I'm going to use Pastebin This is the section of code that interogates the DB: http://pastebin.com/W76H0TSK And this is the template portion of the code: http://pastebin.com/BsCHiU3z I'm looking to insert anchors, or buttons, or something, into that template that would allow the users to sort by (for example) pct_lucru and/or data_expirarii and/or denumire_med. Any ideas for me? I'm kind of stumped. Cheers! -------------- next part -------------- An HTML attachment was scrubbed... URL: From westalto at gmail.com Tue Aug 11 19:14:11 2015 From: westalto at gmail.com (west alto) Date: Wed, 12 Aug 2015 01:14:11 +0800 Subject: [Flask] env variable not set Message-ID: Hi Gurus, Noob here. It makes me nuts figuring this out. Kindly help. 1. import os 2. 3. from flask.ext.script import Manager 4. from api import api 5. 6. 7. manager = Manager(api) 8. 9. 10. def runserver(): 11. api.run() 12. 13. 14. if __name__ == '__main__': 15. root_dir = os.path.abspath(os.path.dirname(__file__)) 16. os.environ["APP_CONFIG_FILE"] = os.path.join(root_dir, 'env/dev.py') 17. manager.run() running python manage.py runserver gives me this error RuntimeError: The environment variable 'APP_CONFIG_FILE' is not set and as such configuration could not be loaded. Set this variable and make it point to a configuration file Thanks, West -------------- next part -------------- An HTML attachment was scrubbed... URL: From robinsoncollado at gmail.com Tue Aug 11 20:14:39 2015 From: robinsoncollado at gmail.com (Robinson Collado) Date: Tue, 11 Aug 2015 20:14:39 +0200 Subject: [Flask] env variable not set In-Reply-To: References: Message-ID: Environmental variable are read through a command prompt. So if you want to set the variable "APP_CONFIG_FILE" you would have to type the following into a command prompt before running your program: On Linux or Max OSX: export APP_CONFIG_FILE = "path_to_file" On Windows: set APP_CONFIG_FILE = "path_to_file" I would suggest for you to read this to learn how to properly access the content in the environmental variable. Though, I believe that you're looking to load the config from a file. Then this should clear things up. On Tue, Aug 11, 2015 at 7:14 PM, west alto wrote: > Hi Gurus, > > Noob here. It makes me nuts figuring this out. Kindly help. > > > 1. import os > 2. > 3. from flask.ext.script import Manager > 4. from api import api > 5. > 6. > 7. manager = Manager(api) > 8. > 9. > 10. def runserver(): > 11. api.run() > 12. > 13. > 14. if __name__ == '__main__': > 15. root_dir = os.path.abspath(os.path.dirname(__file__)) > 16. os.environ["APP_CONFIG_FILE"] = os.path.join(root_dir, > 'env/dev.py') > 17. manager.run() > > > running python manage.py runserver gives me this error > > RuntimeError: The environment variable 'APP_CONFIG_FILE' is not set and as > such configuration could not be loaded. Set this variable and make it > point to a configuration file > > > Thanks, > > West > > > > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > > -- Robinson Collado Web Developer - robinsonc.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From unix.co at gmail.com Wed Aug 12 13:21:08 2015 From: unix.co at gmail.com (Umar Draz) Date: Wed, 12 Aug 2015 16:21:08 +0500 Subject: [Flask] flask with lemon-ldap Message-ID: Hi I have a python Flask application, is there way I can use lemon-ldap SSO with this? Br. Umar -------------- next part -------------- An HTML attachment was scrubbed... URL: From davidnieder at gmx.de Thu Aug 13 13:13:06 2015 From: davidnieder at gmx.de (David Nieder) Date: Thu, 13 Aug 2015 13:13:06 +0200 Subject: [Flask] Allow user to sort DB output In-Reply-To: <55C99BDA.5040303@bluemasters.ro> References: <55C99BDA.5040303@bluemasters.ro> Message-ID: <55CC7BC2.5090109@gmx.de> On 11.08.2015 08:53, Alexandru wrote: > Hello everyone, Hey! Since no one responded yet, I try to give you an answer. > > I've built a small Flask app that basically requires a a lot of database > interaction. If that's the case you really should look into an orm (e.g. SQLAlchemy). > I'm almost done with it now, I just need a way for the user to sort the > information that's received from the database (order by name, price, > location, etc) > The problem is I'm not that good at coding yet and I'm not sure how to > go about doing this. > > I'm not going to paste my code here, to avoid clutter, so I'm going to > use Pastebin > > This is the section of code that interogates the DB: > http://pastebin.com/W76H0TSK > And this is the template portion of the code: http://pastebin.com/BsCHiU3z > > I'm looking to insert anchors, or buttons, or something, into that > template that would allow the users to sort by (for example) pct_lucru > and/or data_expirarii and/or denumire_med. > > Any ideas for me? I'm kind of stumped. Well, you already have an ORDER clause in your sql-query. You just need to build the query more dynamically (meaning: depending on user input). You could have links in your template that look sth like this (maybe in the table head): PUNCT LUCRU Then in the 'rezultate'-function: if request.args.get('order') == 'pct_lucru-asc': order_by = 'ORDER BY stocuri_disponibile.pct_lucru ASC' else if request.args.get('order') == 'pct_lucru-desc': order_by = 'ORDER BY stocuri_disponibile.pct_lucru DESC' else: order_by = 'ORDER BY stocuri_disponibile.denumire_med ASC' query = 'SELECT [...] LIKE ? GROUP BY denumire_med ' query += order_by query += ' LIMIT ? OFFSET ?' cur1 = g.db.execute(query, ...) That would be the basic idea, pretty straight forward. Just keep in mind to not include sth into the query that comes directly from the user. Also: building sql statements like this isn't really fun. An orm can make your life a lot easier. If you are interested in an example, I have a simple blog software where I do sth similar (filter blog-posts) with sqlalchemy: https://github.com/davidnieder/blackboard-light/blob/master/app/query.py#L13 > > Cheers! > Cheers mate! I hope this was helpful From alexandru at bluemasters.ro Thu Aug 13 13:15:10 2015 From: alexandru at bluemasters.ro (Alexandru) Date: Thu, 13 Aug 2015 14:15:10 +0300 Subject: [Flask] Allow user to sort DB output In-Reply-To: <55CC7BC2.5090109@gmx.de> References: <55C99BDA.5040303@bluemasters.ro> <55CC7BC2.5090109@gmx.de> Message-ID: <55CC7C3E.8000701@bluemasters.ro> Thank you very much David! I'll be sure to check out SQLAlchemy and your blog as well! On 13.08.2015 14:13, David Nieder wrote: > On 11.08.2015 08:53, Alexandru wrote: >> Hello everyone, > Hey! > Since no one responded yet, I try to give you an answer. > >> >> I've built a small Flask app that basically requires a a lot of database >> interaction. > > If that's the case you really should look into an orm (e.g. SQLAlchemy). > >> I'm almost done with it now, I just need a way for the user to sort the >> information that's received from the database (order by name, price, >> location, etc) >> The problem is I'm not that good at coding yet and I'm not sure how to >> go about doing this. >> >> I'm not going to paste my code here, to avoid clutter, so I'm going to >> use Pastebin >> >> This is the section of code that interogates the DB: >> http://pastebin.com/W76H0TSK >> And this is the template portion of the code: >> http://pastebin.com/BsCHiU3z >> >> I'm looking to insert anchors, or buttons, or something, into that >> template that would allow the users to sort by (for example) pct_lucru >> and/or data_expirarii and/or denumire_med. >> >> Any ideas for me? I'm kind of stumped. > > Well, you already have an ORDER clause in your sql-query. You just > need to build the query more dynamically (meaning: depending on user > input). > > You could have links in your template that look sth like this (maybe > in the table head): > > PUNCT > LUCRU > > Then in the 'rezultate'-function: > > if request.args.get('order') == 'pct_lucru-asc': > order_by = 'ORDER BY stocuri_disponibile.pct_lucru ASC' > else if request.args.get('order') == 'pct_lucru-desc': > order_by = 'ORDER BY stocuri_disponibile.pct_lucru DESC' > else: > order_by = 'ORDER BY stocuri_disponibile.denumire_med ASC' > > query = 'SELECT [...] LIKE ? GROUP BY denumire_med ' > query += order_by > query += ' LIMIT ? OFFSET ?' > > cur1 = g.db.execute(query, ...) > > That would be the basic idea, pretty straight forward. Just keep in > mind to not include sth into the query that comes directly from the user. > Also: building sql statements like this isn't really fun. An orm can > make your life a lot easier. If you are interested in an example, I > have a simple blog software where I do sth similar (filter blog-posts) > with sqlalchemy: > https://github.com/davidnieder/blackboard-light/blob/master/app/query.py#L13 > > >> >> Cheers! >> > Cheers mate! > I hope this was helpful > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From westalto at gmail.com Sat Aug 15 00:41:02 2015 From: westalto at gmail.com (west alto) Date: Sat, 15 Aug 2015 06:41:02 +0800 Subject: [Flask] Flask-pymongo Message-ID: Hi Gurus, I wonder why I got his error File "/path/to/api/api/v1/profile/views.py", line 20, in from api import mongo ImportError: cannot import name mongo Why did flask cannot run this line in views.py file from api import mongo 1. api 2. api 3. __init__.py 4. from flask import Flask 5. from flask.ext.pymongo import PyMongo 6. from api.v1.profile.views import profile_v1_bp 7. 8. api = Flask(__name__) 9. api.config.from_object('config') 10. api.config.from_envvar('API_CONFIG_FILE') 11. mongo = PyMongo(api) 12. 13. api.register_blueprint(profile_v1_bp, url_prefix= '/v1/profile') 14. 15. v1 16. __init__.py 17. profile 18. __init__.py 19. views.py 20. from flask import Blueprint 21. from api import mongo 22. 23. profile_v1_bp = Blueprint('profile_v1', __name__) 24. 25. @profile_v1_bp.route('//msg', methods= ['GET', 'POST']) 26. def msg(user_name): 27. user = mongo.db.member.find({user_name: True} ) 28. return user Thanks for the help. West Alto -------------- next part -------------- An HTML attachment was scrubbed... URL: From lps at chireiden.net Sat Aug 15 14:48:30 2015 From: lps at chireiden.net (Lars Peter =?UTF-8?B?U8O4bmRlcmdhYXJk?=) Date: Sat, 15 Aug 2015 14:48:30 +0200 Subject: [Flask] Flask-pymongo In-Reply-To: References: Message-ID: <20150815144830.2c47ea4a@ikarus.ikarus> Am Sat, 15 Aug 2015 06:41:02 +0800 schrieb west alto : > 6. from api.v1.profile.views import profile_v1_bp > 7. > 8. api = Flask(__name__) > 9. api.config.from_object('config') > 10. api.config.from_envvar('API_CONFIG_FILE') > 11. mongo = PyMongo(api) Probably because you import your views, before mongo has been defined. If you change the order, that is, importing your views after defining mongo it should work. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digitale Signatur von OpenPGP URL: From projetmbc at gmail.com Tue Aug 18 17:47:56 2015 From: projetmbc at gmail.com (Christophe Bal) Date: Tue, 18 Aug 2015 17:47:56 +0200 Subject: [Flask] Jade instead of Jinja2 Message-ID: Hello. I am new to Flask. Is there a good support for Jade tempting instead of Jinja2 ? How hard would be the task to build such a new plugin that can also add some feature specific to Jinja2 ? *Christophe BAL* *Enseignant de math?matiques en Lyc?e **et d?veloppeur Python amateur* *---* *French math teacher in a "Lyc?e" **and **Python **amateur developer* -------------- next part -------------- An HTML attachment was scrubbed... URL: From alexandre_ at fastmail.com Tue Aug 18 21:04:50 2015 From: alexandre_ at fastmail.com (Alexandre Souza) Date: Tue, 18 Aug 2015 16:04:50 -0300 Subject: [Flask] Jade instead of Jinja2 In-Reply-To: References: Message-ID: <1439924690.643374.359575049.09758078@webmail.messagingengine.com> Hello, Christophe. I think Pyjade can be useful. Take a look: https://github.com/alexandre/pyjade-example [ ]'s (hugs) -- Twitter: @_AleSou || GitHub: alexandre || Reddit: ubbersith -- [...]o sentido disso tudo ? que n?o h? sentido em tentar enlouquecer para impedir-se de ficar louco...guarde sua sanidade para mais tarde[...] - Douglas Adams On Tue, Aug 18, 2015, at 12:47, Christophe Bal wrote: > Hello. > > I am new to Flask. Is there a good support for Jade tempting instead of Jinja2 ? How hard would be the task to build such a new plugin that can also add some feature specific to Jinja2 ?? > > *Christophe BAL* > *Enseignant de math?matiques en Lyc?e?**et d?veloppeur Python amateur* > *---* > *French math teacher in a "Lyc?e"?**and?**Python?**amateur developer* > _________________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at akwebsoft.com Wed Aug 19 00:46:14 2015 From: tim at akwebsoft.com (Tim Johnson) Date: Tue, 18 Aug 2015 14:46:14 -0800 Subject: [Flask] test : please disregard Message-ID: <20150818224614.GA56633@mail.akwebsoft.com> testing ml subscription. No action required. -- Tim http://www.akwebsoft.com, http://www.tj49.com From rahurkar at gmail.com Thu Aug 20 19:53:33 2015 From: rahurkar at gmail.com (Mandar Rahurkar) Date: Thu, 20 Aug 2015 10:53:33 -0700 Subject: [Flask] Session timeout/ User authentication Message-ID: Hi Follow users, I am currently using google oauth for authentication using rauth, Flask-Login extensions. I am also using "session['permanent'] = True" to remember the sessions for certain period when timing them out. However, what happens is the screen does not automatically refresh to logged out view upon session expiry and needs to be manually refreshed. One of the methods I have seen used is to pass a session id to the the browser and browser checks every few minutes if the session is valid and if not, refreshes the view to logged out view. How is this workflow usually implemented in Flask? I can pass session id when the application view is created, however how do you about authenticating session ids. thanks for the heads up, cheers, Mandar -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at davidbaumgold.com Thu Aug 20 19:57:20 2015 From: david at davidbaumgold.com (David Baumgold) Date: Thu, 20 Aug 2015 13:57:20 -0400 Subject: [Flask] Session timeout/ User authentication In-Reply-To: References: Message-ID: Mandar, if you?re using Google OAuth with Flask, and you?re having trouble getting it to work, I?d love for you to check out Flask-Dance, which is a Flask extension I wrote to handle OAuth login. It?s also has a contrib module specific to Google, and the quickstart is here:?http://flask-dance.readthedocs.org/en/latest/quickstarts/google.html?There?s also a quickstart that shows how to set up a multi-user system using Flask-Login and Flask-SQLAlchemy:?http://flask-dance.readthedocs.org/en/latest/quickstarts/sqla-multiuser.html Is that useful? David Baumgold From:?Mandar Rahurkar Reply:?Mandar Rahurkar > Date:?August 20, 2015 at 1:53:43 PM To:?flask at python.org > Subject:? [Flask] Session timeout/ User authentication Hi Follow users, I am currently using google oauth for authentication using rauth, Flask-Login extensions. I am also using "session['permanent'] = True" to remember the sessions for certain period when timing them out. However, what happens is the screen does not automatically refresh to logged out view upon session expiry and needs to be manually refreshed.? One of the methods I have seen used is to pass a session id to the the browser and browser checks every few minutes if the session is valid and if not, refreshes the view to logged out view. How is this workflow usually implemented in Flask? I can pass session id when the application view is created, however how do you about authenticating session ids. thanks for the heads up, cheers, Mandar _______________________________________________ Flask mailing list Flask at python.org https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: From arsh840 at gmail.com Mon Aug 24 01:48:10 2015 From: arsh840 at gmail.com (Great Avenger Singh) Date: Mon, 24 Aug 2015 05:18:10 +0530 Subject: [Flask] SVG Viewer Problem Message-ID: Hello Everyone, I am using following file manager for my project. https://github.com/vmi356/filemanager It is very helpful for me but when I try to open .svg file, It is returning svg code. Here is the screen shot: https://dl.dropboxusercontent.com/u/32435266/12.png Please tell me how to get static svg file? -- Thanks Arshpreet Singh I am Sikh boy, Learning by doing and Learning by teaching is my religion. ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ From projetmbc at gmail.com Mon Aug 24 08:32:45 2015 From: projetmbc at gmail.com (Christophe Bal) Date: Mon, 24 Aug 2015 08:32:45 +0200 Subject: [Flask] SVG Viewer Problem In-Reply-To: References: Message-ID: Hello. Can you give a Minimal Working Example showing the problem ? Christophe Le 24 ao?t 2015 01:48, "Great Avenger Singh" a ?crit : > Hello Everyone, > > I am using following file manager for my project. > > https://github.com/vmi356/filemanager > > It is very helpful for me but when I try to open .svg file, It is > returning svg code. > > Here is the screen shot: > > https://dl.dropboxusercontent.com/u/32435266/12.png > > Please tell me how to get static svg file? > > > -- > > Thanks > Arshpreet Singh > > I am Sikh boy, Learning by doing and Learning by teaching is my religion. > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -------------- next part -------------- An HTML attachment was scrubbed... URL: From espo58 at gmail.com Thu Aug 27 01:06:49 2015 From: espo58 at gmail.com (Joe Esposito) Date: Wed, 26 Aug 2015 23:06:49 +0000 Subject: [Flask] Flask-pytest Message-ID: Hey all, I can be pretty bad about running tests locally at times, so I wrote a little extension to help. It automatically runs pytest in the background when you app.run in debug mode, beeps when there's an error, shows the results in the terminal, and gets re-run by the reloader. This lowers the testing barrier since you don't have to manually run them separately (or even wait for your cloud CI tool after you push to GitHub, which has a much longer feedback loop). https://github.com/joeyespo/flask-pytest Would be happy to hear what you think. If this misses the mark, what's your current setup for writing and running tests? -------------- next part -------------- An HTML attachment was scrubbed... URL: From fededelgado at outlook.com Thu Aug 27 05:02:16 2015 From: fededelgado at outlook.com (Federico Delgado Doyle) Date: Wed, 26 Aug 2015 20:02:16 -0700 Subject: [Flask] SVG Viewer Problem In-Reply-To: References: , , Message-ID: Oh, good then it was only issue number one, the escaping. Please check the jinja2 documentation about "|safe" it is specially important to do so because it implies some security considerations. You are now going to push raw content to your html. http://jinja.pocoo.org/docs/dev/templates/#safe Federico > Date: Thu, 27 Aug 2015 01:57:58 +0530 > Subject: Re: [Flask] SVG Viewer Problem > From: arsh840 at gmail.com > To: fededelgado at outlook.com > > On Mon, Aug 24, 2015 at 6:19 AM, Federico Delgado Doyle > wrote: > > > > Hi Great Avenger, > > > > I have not used that file browser. But from a fast inspection I see that the file content is going to be escaped. That is one thing. The other one is, the SVG is not being requested as an image/svg+xml image so I don't thing that the browser is going to show it. The template says: > > > >
> >
{{ text }}
> >
> > > > Maybe you can try to render differently according to the type of file. For example if extension is a kind of image, >create a view_image action that renders differently. > > Hi Federico and Everyone. > > Thanks for reply I am able to solve it. > I just added > > {{text|safe}} in my html file and it worked. :) > > As Python code is as follows: > > http://pastebin.com/7sNgJgQ9 > > As only using {{text}} does not work but {{text|safe}} does work, What > "safe" keyword stands for? > > By the way I got it from following: > > http://stackoverflow.com/questions/25195290/generating-dynamic-pygal-chart-in-flask > > -- > > Thanks > Arshpreet Singh > > I am Sikh boy, Learning by doing and Learning by teaching is my religion. > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: