librelist archives

« back to archive

flask vs extjs directory structure

flask vs extjs directory structure

From:
Gardner Pomper
Date:
2012-04-18 @ 17:11
I am just getting started with both extjs4 and flask. I like both of
them on their own, but it is a real pain that they both want their own
server side directory structure. So far, I have just been altering all
the javascript files, but this is a real pain when working through
examples, and it seems like something that would be completely
unnecessary if flask did not require the static subdirectory. Here is
the "recommended" directory structure for an extjs app:oo

- appname
    - app
        - namespace
            - Class1.js
            - Class2.js
            - ...
    - extjs
    - resources
        - css
        - images
        - ...
    - app.js
    - index.html

I have been googling, trying to find out how to change the directory
structure restrictions in Flask, and can't find anything. My primary
question is how to change it, but I am also curious on why it was
deemed necessary to hard code a directory structure.

Thanks,

- Gardner

Re: [flask] flask vs extjs directory structure

From:
Steven Kryskalla
Date:
2012-04-18 @ 17:41
On Wed, Apr 18, 2012 at 10:11 AM, Gardner Pomper <gardner@networknow.org> wrote:
> I have been googling, trying to find out how to change the directory
> structure restrictions in Flask, and can't find anything. My primary
> question is how to change it, but I am also curious on why it was
> deemed necessary to hard code a directory structure.

The "static" folder in flask is not hardcoded, it's just a default, so
it's easier to get started.

You can change which static folder is used on disk and where it gets
mounted on the app with these parameters:

static_folder
static_url_path

See the docs here:

http://flask.pocoo.org/docs/api/#flask.Flask

You can also mount multiple static directories to your app using
send_from_directory:

http://flask.pocoo.org/docs/api/#flask.send_from_directory

-Steve