Flask ignore FLASK_STATIC_FOLDER setted outside of constructor. #1126

Closed
proofit404 opened this Issue Jul 21, 2014 · 5 comments

3 participants

@proofit404

If I do following:

app = Flaks(__name__, static_folder='/var/www/static')

all works just fine, but if I do

class Config(object):
    FLASK_STATIC_FOLDER = '/var/www/static'

app = Flask(__name__)
app.config.from_object(Config)

current_app.send_static_file can't find static file. Is it any difference between those two settings?

@docapotamus

As far as I know there is no way of setting this from a config file.

You could do it yourself if you have an application factory and set it from there.

Also, why not use /static and then map that with the webserver to point directly to the static files? It would be a lot faster to have the web server send these files.

@danielchatfield

@pjuu is correct

@proofit404

We use application factory. We setup webserver to serve static files. I notice this behaviour during refactoring of some project today and just want to know is it correct or not.

@docapotamus

That's not too bad then. At least you have the answer :D

@proofit404

Thanks for help!

@proofit404 proofit404 closed this Jul 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment