News for hackers. Stuff that matters.
Re:How I Structure My Flask Applications by mattdeboard on Wednesday June 26, 2013 @07:18PM (#5949753)
A couple other things I'd add to this good article:

- I took a couple of good things from Django's manage.py by using Flask-Script. It looks like [1]

- I'm not sure if there's a better way of doing this, but I really want to be able to swap out configurations based on which environment I'm using. I think I've forced some Django structure onto Flask, but that said, I dynamically load in a `settings` object and use that to configure my `app` object. I use something like [2]. Just looking over it again I think I have some extraneous code in there but I'm tired. It works pretty well, so far.

- Flask-SQLAlchemy has some good stuff too but I'm not entirely sold on using it. I'm using it on one project, but not the other. I don't miss it when I don't have it.

1. https://gist.github.com/mattdeboard/5872584

2. https://gist.github.com/mattdeboard/3cbe5395052128e60328

Re:How I Structure My Flask Applications by mattupstate on Wednesday June 26, 2013 @10:17PM (#5950365)
Good call on the Flask-Script mention. I will add a note about that.

As far as configuration based on environment goes, I really dislike environment based configuration in my project repository. So I use Flask's instance folder functionality:

http://flask.pocoo.org/docs/config/#instance-folders

This file can be used to configure the app based on its environment wether it be local development or my production environment. The shared factory method attempts to load this file and fails silently if it does not exist.

Regarding your SQLAlchemy comment, well...thats just not really something to add to the article now, is it? ;)

Re:How I Structure My Flask Applications by mattdeboard on Thursday June 27, 2013 @01:22AM (#5950831)
Yeah but how would this solve having identical app installations in dev, prod and staging?
Re:How I Structure My Flask Applications by mattupstate on Thursday June 27, 2013 @10:44AM (#5952530)
The settings.cfg file that I place in the instance folder is generally placed on the server during deployment. Any values in this file will override defaults. I generally do this with Chef or Fabric. Perhaps that answers your question
Re:How I Structure My Flask Applications by hartror on Wednesday June 26, 2013 @08:05PM (#5949910)
Not sold on using it? What are the reasons?
Re:How I Structure My Flask Applications by mattdeboard on Wednesday June 26, 2013 @08:49PM (#5950044)
Well, I just haven't had a TON of use for it yet. I'm a little wary that I'll need to work around leaky abstractions. I'm not poo-pooing it, just ... cynical.
Re:How I Structure My Flask Applications by jp_sc on Wednesday June 26, 2013 @09:57PM (#5950278)
Flask-SQLAlchemy is a thin layer over SQLAlchemy, so the risk of leakage is low. That said, what I don't like is that it's too coupled with Flask, so I prefer to use my own version: https://github.com/lucuma/orm
Re:How I Structure My Flask Applications by mattdeboard on Thursday June 27, 2013 @12:20AM (#5950708)
Nice, thanks for the link. I'll look into this next week.