librelist archives

« back to archive

Flask application standard skeleton

Flask application standard skeleton

From:
bruce bushby
Date:
2012-07-17 @ 09:52
Hi

I wanted to ask if there has been any discussions towards publishing
some "skeleton standards" with regards to Flask applications?

One of the joys of python is that all python programs are easy to read
because they look the same. Could the same be applied to Flask
applications?

There have been a number of questions to the list asking about
"blueprint" examples and some very helpful members have made their
code available via github...but it seems there are so many ways to
"skin this cat" that all the examples are different....in terms of
file and directory structure layout. I understand one of the strengths
of Flask is it's flexibility, but it might help novices adopt the
framework when they're able to reference a standard application
structure.

Are there any "gold" examples....ie the "true flask way" .... even if
it's just an empty dir/file layout?


Thanks
Bruce

Re: [flask] Flask application standard skeleton

From:
Redouane Zait
Date:
2012-07-17 @ 11:38
HI, i don't know wether its good enough or not but here's the
layout I've been using lately :

/config_dev.py
/config_test.py
/manage.py <-- self explanatory, cmd line tools script, imports db from the
app package, handles stuff like db.create_all(), db.drop_all()  fill db
with initial data and much more. uses flask-script.
/fabfile.py <-- deployment / sysadmin script
/run.py <-- ( imports create_app from the app packages, calls the function
it with the appropriate config as an argument, then runs the app

/tests/
  .. /__init__.py
  .. /access_test.py

/app/
   ../__init__.py     ( create_app app factory function defined here, it
initializes a flask app, configures extensions, imports blueprints ( from
app.users.views import users as users_blueprint ), then registers the
blueprints to the app and eventually returns an app

   ../templates/
         ../base.html
         ../users/
            ../signup.html
            ../login.html
        ../admin/
    ../static/
    ../users/    <-- ( users package)
       ../__init__.py
       ../views.py   <-- ( users blueprint defined here, aswell as its
associated routes ( @users.signup, @users.login, @users.profile )
       ../models.py  <-- (user - related sqlalchemy models
       ../forms.py  <-- (user - related forms ( signup, login, etc.. )
       ../utils.py



On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <bruce.bushby@gmail.com>wrote:

> Hi
>
> I wanted to ask if there has been any discussions towards publishing
> some "skeleton standards" with regards to Flask applications?
>
> One of the joys of python is that all python programs are easy to read
> because they look the same. Could the same be applied to Flask
> applications?
>
> There have been a number of questions to the list asking about
> "blueprint" examples and some very helpful members have made their
> code available via github...but it seems there are so many ways to
> "skin this cat" that all the examples are different....in terms of
> file and directory structure layout. I understand one of the strengths
> of Flask is it's flexibility, but it might help novices adopt the
> framework when they're able to reference a standard application
> structure.
>
> Are there any "gold" examples....ie the "true flask way" .... even if
> it's just an empty dir/file layout?
>
>
> Thanks
> Bruce
>

Re: [flask] Flask application standard skeleton

From:
bruce bushby
Date:
2012-07-17 @ 13:42
Thanks Redouane, appreciated!!

I'm guessing the responses will answer the question if such a standard
is something worth progressing. It would certainly help newbies and
people asking the list questions. Rather then spend a paragraph
explaining your layout before asking your question, your would simply
discuss the "standard"





There are

On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com> wrote:
> HI, i don't know wether its good enough or not but here's the layout I've
> been using lately :
>
> /config_dev.py
> /config_test.py
> /manage.py <-- self explanatory, cmd line tools script, imports db from the
> app package, handles stuff like db.create_all(), db.drop_all()  fill db with
> initial data and much more. uses flask-script.
> /fabfile.py <-- deployment / sysadmin script
> /run.py <-- ( imports create_app from the app packages, calls the function
> it with the appropriate config as an argument, then runs the app
>
> /tests/
>   .. /__init__.py
>   .. /access_test.py
>
> /app/
>    ../__init__.py     ( create_app app factory function defined here, it
> initializes a flask app, configures extensions, imports blueprints ( from
> app.users.views import users as users_blueprint ), then registers the
> blueprints to the app and eventually returns an app
>
>    ../templates/
>          ../base.html
>          ../users/
>             ../signup.html
>             ../login.html
>         ../admin/
>     ../static/
>     ../users/    <-- ( users package)
>        ../__init__.py
>        ../views.py   <-- ( users blueprint defined here, aswell as its
> associated routes ( @users.signup, @users.login, @users.profile )
>        ../models.py  <-- (user - related sqlalchemy models
>        ../forms.py  <-- (user - related forms ( signup, login, etc.. )
>        ../utils.py
>
>
>
> On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <bruce.bushby@gmail.com>
> wrote:
>>
>> Hi
>>
>> I wanted to ask if there has been any discussions towards publishing
>> some "skeleton standards" with regards to Flask applications?
>>
>> One of the joys of python is that all python programs are easy to read
>> because they look the same. Could the same be applied to Flask
>> applications?
>>
>> There have been a number of questions to the list asking about
>> "blueprint" examples and some very helpful members have made their
>> code available via github...but it seems there are so many ways to
>> "skin this cat" that all the examples are different....in terms of
>> file and directory structure layout. I understand one of the strengths
>> of Flask is it's flexibility, but it might help novices adopt the
>> framework when they're able to reference a standard application
>> structure.
>>
>> Are there any "gold" examples....ie the "true flask way" .... even if
>> it's just an empty dir/file layout?
>>
>>
>> Thanks
>> Bruce
>
>

Re: [flask] Flask application standard skeleton

From:
ol
Date:
2012-07-17 @ 14:00
Hi.
Recently started 'opener' at github.com/o1/opener

Was like you looking for some "standard" starting point for my
projects(layout).

Used the official docs for larger apps to create it so for me it feels
kindoff "standard". It easy to modify to your liking anyway.

Will add more features soon, just sorting out some personal business first.

The project is public domain so feel free to do what you want with it. Or I
can do it if you have ideas/modifications.
On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com> wrote:

> Thanks Redouane, appreciated!!
>
> I'm guessing the responses will answer the question if such a standard
> is something worth progressing. It would certainly help newbies and
> people asking the list questions. Rather then spend a paragraph
> explaining your layout before asking your question, your would simply
> discuss the "standard"
>
>
>
>
>
> There are
>
> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
> wrote:
> > HI, i don't know wether its good enough or not but here's the layout I've
> > been using lately :
> >
> > /config_dev.py
> > /config_test.py
> > /manage.py <-- self explanatory, cmd line tools script, imports db from
> the
> > app package, handles stuff like db.create_all(), db.drop_all()  fill db
> with
> > initial data and much more. uses flask-script.
> > /fabfile.py <-- deployment / sysadmin script
> > /run.py <-- ( imports create_app from the app packages, calls the
> function
> > it with the appropriate config as an argument, then runs the app
> >
> > /tests/
> >   .. /__init__.py
> >   .. /access_test.py
> >
> > /app/
> >    ../__init__.py     ( create_app app factory function defined here, it
> > initializes a flask app, configures extensions, imports blueprints ( from
> > app.users.views import users as users_blueprint ), then registers the
> > blueprints to the app and eventually returns an app
> >
> >    ../templates/
> >          ../base.html
> >          ../users/
> >             ../signup.html
> >             ../login.html
> >         ../admin/
> >     ../static/
> >     ../users/    <-- ( users package)
> >        ../__init__.py
> >        ../views.py   <-- ( users blueprint defined here, aswell as its
> > associated routes ( @users.signup, @users.login, @users.profile )
> >        ../models.py  <-- (user - related sqlalchemy models
> >        ../forms.py  <-- (user - related forms ( signup, login, etc.. )
> >        ../utils.py
> >
> >
> >
> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <bruce.bushby@gmail.com>
> > wrote:
> >>
> >> Hi
> >>
> >> I wanted to ask if there has been any discussions towards publishing
> >> some "skeleton standards" with regards to Flask applications?
> >>
> >> One of the joys of python is that all python programs are easy to read
> >> because they look the same. Could the same be applied to Flask
> >> applications?
> >>
> >> There have been a number of questions to the list asking about
> >> "blueprint" examples and some very helpful members have made their
> >> code available via github...but it seems there are so many ways to
> >> "skin this cat" that all the examples are different....in terms of
> >> file and directory structure layout. I understand one of the strengths
> >> of Flask is it's flexibility, but it might help novices adopt the
> >> framework when they're able to reference a standard application
> >> structure.
> >>
> >> Are there any "gold" examples....ie the "true flask way" .... even if
> >> it's just an empty dir/file layout?
> >>
> >>
> >> Thanks
> >> Bruce
> >
> >
>

Re: [flask] Flask application standard skeleton

From:
Italo Maia
Date:
2012-07-17 @ 15:07
Most said "standarts" for flask are published in the flask documentation.
The skeleton projects for flask available online are just compilation of
those techniques some people identify themselfs with. If you're starting,
the good thing to do is read flask docs and other peoples code, then choose
your own design.

ps: there was quite some talk in the flask list about this subject. Try
looking for it.

2012/7/17 ol <ol@o1.no>

> Hi.
> Recently started 'opener' at github.com/o1/opener
>
> Was like you looking for some "standard" starting point for my
> projects(layout).
>
> Used the official docs for larger apps to create it so for me it feels
> kindoff "standard". It easy to modify to your liking anyway.
>
> Will add more features soon, just sorting out some personal business first.
>
> The project is public domain so feel free to do what you want with it. Or
> I can do it if you have ideas/modifications.
> On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com> wrote:
>
>> Thanks Redouane, appreciated!!
>>
>> I'm guessing the responses will answer the question if such a standard
>> is something worth progressing. It would certainly help newbies and
>> people asking the list questions. Rather then spend a paragraph
>> explaining your layout before asking your question, your would simply
>> discuss the "standard"
>>
>>
>>
>>
>>
>> There are
>>
>> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
>> wrote:
>> > HI, i don't know wether its good enough or not but here's the layout
>> I've
>> > been using lately :
>> >
>> > /config_dev.py
>> > /config_test.py
>> > /manage.py <-- self explanatory, cmd line tools script, imports db from
>> the
>> > app package, handles stuff like db.create_all(), db.drop_all()  fill db
>> with
>> > initial data and much more. uses flask-script.
>> > /fabfile.py <-- deployment / sysadmin script
>> > /run.py <-- ( imports create_app from the app packages, calls the
>> function
>> > it with the appropriate config as an argument, then runs the app
>> >
>> > /tests/
>> >   .. /__init__.py
>> >   .. /access_test.py
>> >
>> > /app/
>> >    ../__init__.py     ( create_app app factory function defined here, it
>> > initializes a flask app, configures extensions, imports blueprints (
>> from
>> > app.users.views import users as users_blueprint ), then registers the
>> > blueprints to the app and eventually returns an app
>> >
>> >    ../templates/
>> >          ../base.html
>> >          ../users/
>> >             ../signup.html
>> >             ../login.html
>> >         ../admin/
>> >     ../static/
>> >     ../users/    <-- ( users package)
>> >        ../__init__.py
>> >        ../views.py   <-- ( users blueprint defined here, aswell as its
>> > associated routes ( @users.signup, @users.login, @users.profile )
>> >        ../models.py  <-- (user - related sqlalchemy models
>> >        ../forms.py  <-- (user - related forms ( signup, login, etc.. )
>> >        ../utils.py
>> >
>> >
>> >
>> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <bruce.bushby@gmail.com>
>> > wrote:
>> >>
>> >> Hi
>> >>
>> >> I wanted to ask if there has been any discussions towards publishing
>> >> some "skeleton standards" with regards to Flask applications?
>> >>
>> >> One of the joys of python is that all python programs are easy to read
>> >> because they look the same. Could the same be applied to Flask
>> >> applications?
>> >>
>> >> There have been a number of questions to the list asking about
>> >> "blueprint" examples and some very helpful members have made their
>> >> code available via github...but it seems there are so many ways to
>> >> "skin this cat" that all the examples are different....in terms of
>> >> file and directory structure layout. I understand one of the strengths
>> >> of Flask is it's flexibility, but it might help novices adopt the
>> >> framework when they're able to reference a standard application
>> >> structure.
>> >>
>> >> Are there any "gold" examples....ie the "true flask way" .... even if
>> >> it's just an empty dir/file layout?
>> >>
>> >>
>> >> Thanks
>> >> Bruce
>> >
>> >
>>
>


-- 
"A arrogância é a arma dos fracos."

===========================
Italo Moreira Campelo Maia
Bacharel em Ciência da Computação - UECE
Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile (Python, Java,
Lua)
Coordenador do Pug-CE
-----------------------------------------------------
http://www.italomaia.com/
http://twitter.com/italomaia/
http://eusouolobomau.blogspot.com/
-----------------------------------------------------
Turtle Linux  9.10 - http://tiny.cc/blogturtle910
Turtle Linux 10.10 - http://bit.ly/cEw4ET
===========================

Re: [flask] Flask application standard skeleton

From:
Nathan M
Date:
2012-07-18 @ 13:30
There is this link on the Github wiki, which is dubbed for large
applications, but it can really be used even for small projects :
https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
Last but not least, it's a complete blueprint example.


--
/*
** "What do you despise? By this you are truly known."
**	from Manual of Muad'Dib by the Princess Irulan.

*/




On Tue, Jul 17, 2012 at 5:07 PM, Italo Maia <italo.maia@gmail.com> wrote:

> Most said "standarts" for flask are published in the flask documentation.
> The skeleton projects for flask available online are just compilation of
> those techniques some people identify themselfs with. If you're starting,
> the good thing to do is read flask docs and other peoples code, then choose
> your own design.
>
> ps: there was quite some talk in the flask list about this subject. Try
> looking for it.
>
>
> 2012/7/17 ol <ol@o1.no>
>
>> Hi.
>> Recently started 'opener' at github.com/o1/opener
>>
>> Was like you looking for some "standard" starting point for my
>> projects(layout).
>>
>> Used the official docs for larger apps to create it so for me it feels
>> kindoff "standard". It easy to modify to your liking anyway.
>>
>> Will add more features soon, just sorting out some personal business
>> first.
>>
>> The project is public domain so feel free to do what you want with it. Or
>> I can do it if you have ideas/modifications.
>> On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com> wrote:
>>
>>> Thanks Redouane, appreciated!!
>>>
>>> I'm guessing the responses will answer the question if such a standard
>>> is something worth progressing. It would certainly help newbies and
>>> people asking the list questions. Rather then spend a paragraph
>>> explaining your layout before asking your question, your would simply
>>> discuss the "standard"
>>>
>>>
>>>
>>>
>>>
>>> There are
>>>
>>> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
>>> wrote:
>>> > HI, i don't know wether its good enough or not but here's the layout
>>> I've
>>> > been using lately :
>>> >
>>> > /config_dev.py
>>> > /config_test.py
>>> > /manage.py <-- self explanatory, cmd line tools script, imports db
>>> from the
>>> > app package, handles stuff like db.create_all(), db.drop_all()  fill
>>> db with
>>> > initial data and much more. uses flask-script.
>>> > /fabfile.py <-- deployment / sysadmin script
>>> > /run.py <-- ( imports create_app from the app packages, calls the
>>> function
>>> > it with the appropriate config as an argument, then runs the app
>>> >
>>> > /tests/
>>> >   .. /__init__.py
>>> >   .. /access_test.py
>>> >
>>> > /app/
>>> >    ../__init__.py     ( create_app app factory function defined here,
>>> it
>>> > initializes a flask app, configures extensions, imports blueprints (
>>> from
>>> > app.users.views import users as users_blueprint ), then registers the
>>> > blueprints to the app and eventually returns an app
>>> >
>>> >    ../templates/
>>> >          ../base.html
>>> >          ../users/
>>> >             ../signup.html
>>> >             ../login.html
>>> >         ../admin/
>>> >     ../static/
>>> >     ../users/    <-- ( users package)
>>> >        ../__init__.py
>>> >        ../views.py   <-- ( users blueprint defined here, aswell as its
>>> > associated routes ( @users.signup, @users.login, @users.profile )
>>> >        ../models.py  <-- (user - related sqlalchemy models
>>> >        ../forms.py  <-- (user - related forms ( signup, login, etc.. )
>>> >        ../utils.py
>>> >
>>> >
>>> >
>>> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <bruce.bushby@gmail.com
>>> >
>>> > wrote:
>>> >>
>>> >> Hi
>>> >>
>>> >> I wanted to ask if there has been any discussions towards publishing
>>> >> some "skeleton standards" with regards to Flask applications?
>>> >>
>>> >> One of the joys of python is that all python programs are easy to read
>>> >> because they look the same. Could the same be applied to Flask
>>> >> applications?
>>> >>
>>> >> There have been a number of questions to the list asking about
>>> >> "blueprint" examples and some very helpful members have made their
>>> >> code available via github...but it seems there are so many ways to
>>> >> "skin this cat" that all the examples are different....in terms of
>>> >> file and directory structure layout. I understand one of the strengths
>>> >> of Flask is it's flexibility, but it might help novices adopt the
>>> >> framework when they're able to reference a standard application
>>> >> structure.
>>> >>
>>> >> Are there any "gold" examples....ie the "true flask way" .... even if
>>> >> it's just an empty dir/file layout?
>>> >>
>>> >>
>>> >> Thanks
>>> >> Bruce
>>> >
>>> >
>>>
>>
>
>
> --
> "A arrogância é a arma dos fracos."
>
> ===========================
> Italo Moreira Campelo Maia
> Bacharel em Ciência da Computação - UECE
> Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile (Python, Java,
> Lua)
> Coordenador do Pug-CE
> -----------------------------------------------------
> http://www.italomaia.com/
> http://twitter.com/italomaia/
> http://eusouolobomau.blogspot.com/
> -----------------------------------------------------
> Turtle Linux  9.10 - http://tiny.cc/blogturtle910
> Turtle Linux 10.10 - http://bit.ly/cEw4ET
> ===========================
>

Re: [flask] Flask application standard skeleton

From:
chrickso
Date:
2012-07-18 @ 14:48
I have combined https://bitbucket.org/imwilsonxu/fbone/src with elements of
https://github.com/mitsuhiko/flask/wiki/Large-app-how-to for a very nice
base to my medium-sized app.

If you are a beginner (like I was), fbone will completely blow your mind.
It's a pretty advanced skeleton. Stick with it, learn why/how it does what
it does, slowly convert it into your own, and you will come out a pretty
advanced beginner.

- chrickso



On Wed, Jul 18, 2012 at 8:30 AM, Nathan M <feydaykyn@yahoo.fr> wrote:

> There is this link on the Github wiki, which is dubbed for large
> applications, but it can really be used even for small projects :
> https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
> Last but not least, it's a complete blueprint example.
>
>
> --
> /*
> ** "What do you despise? By this you are truly known."
> **	from Manual of Muad'Dib by the Princess Irulan.
>
>
> */
>
>
>
>
> On Tue, Jul 17, 2012 at 5:07 PM, Italo Maia <italo.maia@gmail.com> wrote:
>
>> Most said "standarts" for flask are published in the flask documentation.
>> The skeleton projects for flask available online are just compilation of
>> those techniques some people identify themselfs with. If you're
>> starting, the good thing to do is read flask docs and other peoples code,
>> then choose your own design.
>>
>> ps: there was quite some talk in the flask list about this subject. Try
>> looking for it.
>>
>>
>> 2012/7/17 ol <ol@o1.no>
>>
>>> Hi.
>>> Recently started 'opener' at github.com/o1/opener
>>>
>>> Was like you looking for some "standard" starting point for my
>>> projects(layout).
>>>
>>> Used the official docs for larger apps to create it so for me it feels
>>> kindoff "standard". It easy to modify to your liking anyway.
>>>
>>> Will add more features soon, just sorting out some personal business
>>> first.
>>>
>>> The project is public domain so feel free to do what you want with it.
>>> Or I can do it if you have ideas/modifications.
>>> On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com> wrote:
>>>
>>>> Thanks Redouane, appreciated!!
>>>>
>>>> I'm guessing the responses will answer the question if such a standard
>>>> is something worth progressing. It would certainly help newbies and
>>>> people asking the list questions. Rather then spend a paragraph
>>>> explaining your layout before asking your question, your would simply
>>>> discuss the "standard"
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> There are
>>>>
>>>> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
>>>> wrote:
>>>> > HI, i don't know wether its good enough or not but here's the layout
>>>> I've
>>>> > been using lately :
>>>> >
>>>> > /config_dev.py
>>>> > /config_test.py
>>>> > /manage.py <-- self explanatory, cmd line tools script, imports db
>>>> from the
>>>> > app package, handles stuff like db.create_all(), db.drop_all()  fill
>>>> db with
>>>> > initial data and much more. uses flask-script.
>>>> > /fabfile.py <-- deployment / sysadmin script
>>>> > /run.py <-- ( imports create_app from the app packages, calls the
>>>> function
>>>> > it with the appropriate config as an argument, then runs the app
>>>> >
>>>> > /tests/
>>>> >   .. /__init__.py
>>>> >   .. /access_test.py
>>>> >
>>>> > /app/
>>>> >    ../__init__.py     ( create_app app factory function defined here,
>>>> it
>>>> > initializes a flask app, configures extensions, imports blueprints (
>>>> from
>>>> > app.users.views import users as users_blueprint ), then registers the
>>>> > blueprints to the app and eventually returns an app
>>>> >
>>>> >    ../templates/
>>>> >          ../base.html
>>>> >          ../users/
>>>> >             ../signup.html
>>>> >             ../login.html
>>>> >         ../admin/
>>>> >     ../static/
>>>> >     ../users/    <-- ( users package)
>>>> >        ../__init__.py
>>>> >        ../views.py   <-- ( users blueprint defined here, aswell as its
>>>> > associated routes ( @users.signup, @users.login, @users.profile )
>>>> >        ../models.py  <-- (user - related sqlalchemy models
>>>> >        ../forms.py  <-- (user - related forms ( signup, login, etc.. )
>>>> >        ../utils.py
>>>> >
>>>> >
>>>> >
>>>> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby <
>>>> bruce.bushby@gmail.com>
>>>> > wrote:
>>>> >>
>>>> >> Hi
>>>> >>
>>>> >> I wanted to ask if there has been any discussions towards publishing
>>>> >> some "skeleton standards" with regards to Flask applications?
>>>> >>
>>>> >> One of the joys of python is that all python programs are easy to
>>>> read
>>>> >> because they look the same. Could the same be applied to Flask
>>>> >> applications?
>>>> >>
>>>> >> There have been a number of questions to the list asking about
>>>> >> "blueprint" examples and some very helpful members have made their
>>>> >> code available via github...but it seems there are so many ways to
>>>> >> "skin this cat" that all the examples are different....in terms of
>>>> >> file and directory structure layout. I understand one of the
>>>> strengths
>>>> >> of Flask is it's flexibility, but it might help novices adopt the
>>>> >> framework when they're able to reference a standard application
>>>> >> structure.
>>>> >>
>>>> >> Are there any "gold" examples....ie the "true flask way" .... even if
>>>> >> it's just an empty dir/file layout?
>>>> >>
>>>> >>
>>>> >> Thanks
>>>> >> Bruce
>>>> >
>>>> >
>>>>
>>>
>>
>>
>> --
>> "A arrogância é a arma dos fracos."
>>
>> ===========================
>> Italo Moreira Campelo Maia
>> Bacharel em Ciência da Computação - UECE
>> Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile (Python, Java,
>> Lua)
>> Coordenador do Pug-CE
>> -----------------------------------------------------
>> http://www.italomaia.com/
>> http://twitter.com/italomaia/
>> http://eusouolobomau.blogspot.com/
>> -----------------------------------------------------
>> Turtle Linux  9.10 - http://tiny.cc/blogturtle910
>> Turtle Linux 10.10 - http://bit.ly/cEw4ET
>> ===========================
>>
>
>

Re: [flask] Flask application standard skeleton

From:
bruce bushby
Date:
2012-07-18 @ 16:02
Just wanted to offer a thanks for the great examples.  I asked about a
"standard" layout because, although there are excellent examples in
the list, they are all a little different.

I find myself wondering if I should call my "index" stuff from a
blueprint called "main" .... or simply leave it inside the top level
of the
application. Should I have a file called "views.py" for my index/main
page view....or simply run it from "runserver" ...should
"authentication code" sit in a blueprint....or simply alongside the
"index files" .

These are mostly silly questions...but it's what prompted the question
about a "flask standard" layout. Looking at the responses I would say
people prefer to use flask in a way that suits them rather then stick
to a "best practices layout" layout.


Adding these links for people searching similar topics:

https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
https://github.com/ajford/RGVRSEF
https://github.com/sean-/flask-skeleton
https://bitbucket.org/imwilsonxu/fbone/src


Bruce




On Wed, Jul 18, 2012 at 3:48 PM, chrickso <chrickso@gmail.com> wrote:
> I have combined https://bitbucket.org/imwilsonxu/fbone/src with elements of
> https://github.com/mitsuhiko/flask/wiki/Large-app-how-to for a very nice
> base to my medium-sized app.
>
> If you are a beginner (like I was), fbone will completely blow your mind.
> It's a pretty advanced skeleton. Stick with it, learn why/how it does what
> it does, slowly convert it into your own, and you will come out a pretty
> advanced beginner.
>
> - chrickso
>
>
>
> On Wed, Jul 18, 2012 at 8:30 AM, Nathan M <feydaykyn@yahoo.fr> wrote:
>>
>> There is this link on the Github wiki, which is dubbed for large
>> applications, but it can really be used even for small projects :
>> https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
>> Last but not least, it's a complete blueprint example.
>>
>>
>> --
>> /*
>> ** "What do you despise? By this you are truly known."
>> **	from Manual of Muad'Dib by the Princess Irulan.
>>
>>
>>
>> */
>>
>>
>>
>>
>> On Tue, Jul 17, 2012 at 5:07 PM, Italo Maia <italo.maia@gmail.com> wrote:
>>>
>>> Most said "standarts" for flask are published in the flask documentation.
>>> The skeleton projects for flask available online are just compilation of
>>> those techniques some people identify themselfs with. If you're starting,
>>> the good thing to do is read flask docs and other peoples code, then choose
>>> your own design.
>>>
>>> ps: there was quite some talk in the flask list about this subject. Try
>>> looking for it.
>>>
>>>
>>> 2012/7/17 ol <ol@o1.no>
>>>>
>>>> Hi.
>>>> Recently started 'opener' at github.com/o1/opener
>>>>
>>>> Was like you looking for some "standard" starting point for my
>>>> projects(layout).
>>>>
>>>> Used the official docs for larger apps to create it so for me it feels
>>>> kindoff "standard". It easy to modify to your liking anyway.
>>>>
>>>> Will add more features soon, just sorting out some personal business
>>>> first.
>>>>
>>>> The project is public domain so feel free to do what you want with it.
>>>> Or I can do it if you have ideas/modifications.
>>>>
>>>> On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com> wrote:
>>>>>
>>>>> Thanks Redouane, appreciated!!
>>>>>
>>>>> I'm guessing the responses will answer the question if such a standard
>>>>> is something worth progressing. It would certainly help newbies and
>>>>> people asking the list questions. Rather then spend a paragraph
>>>>> explaining your layout before asking your question, your would simply
>>>>> discuss the "standard"
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> There are
>>>>>
>>>>> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
>>>>> wrote:
>>>>> > HI, i don't know wether its good enough or not but here's the layout
>>>>> > I've
>>>>> > been using lately :
>>>>> >
>>>>> > /config_dev.py
>>>>> > /config_test.py
>>>>> > /manage.py <-- self explanatory, cmd line tools script, imports db
>>>>> > from the
>>>>> > app package, handles stuff like db.create_all(), db.drop_all()  fill
>>>>> > db with
>>>>> > initial data and much more. uses flask-script.
>>>>> > /fabfile.py <-- deployment / sysadmin script
>>>>> > /run.py <-- ( imports create_app from the app packages, calls the
>>>>> > function
>>>>> > it with the appropriate config as an argument, then runs the app
>>>>> >
>>>>> > /tests/
>>>>> >   .. /__init__.py
>>>>> >   .. /access_test.py
>>>>> >
>>>>> > /app/
>>>>> >    ../__init__.py     ( create_app app factory function defined here,
>>>>> > it
>>>>> > initializes a flask app, configures extensions, imports blueprints (
>>>>> > from
>>>>> > app.users.views import users as users_blueprint ), then registers the
>>>>> > blueprints to the app and eventually returns an app
>>>>> >
>>>>> >    ../templates/
>>>>> >          ../base.html
>>>>> >          ../users/
>>>>> >             ../signup.html
>>>>> >             ../login.html
>>>>> >         ../admin/
>>>>> >     ../static/
>>>>> >     ../users/    <-- ( users package)
>>>>> >        ../__init__.py
>>>>> >        ../views.py   <-- ( users blueprint defined here, aswell as
>>>>> > its
>>>>> > associated routes ( @users.signup, @users.login, @users.profile )
>>>>> >        ../models.py  <-- (user - related sqlalchemy models
>>>>> >        ../forms.py  <-- (user - related forms ( signup, login, etc..
>>>>> > )
>>>>> >        ../utils.py
>>>>> >
>>>>> >
>>>>> >
>>>>> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby
>>>>> > <bruce.bushby@gmail.com>
>>>>> > wrote:
>>>>> >>
>>>>> >> Hi
>>>>> >>
>>>>> >> I wanted to ask if there has been any discussions towards publishing
>>>>> >> some "skeleton standards" with regards to Flask applications?
>>>>> >>
>>>>> >> One of the joys of python is that all python programs are easy to
>>>>> >> read
>>>>> >> because they look the same. Could the same be applied to Flask
>>>>> >> applications?
>>>>> >>
>>>>> >> There have been a number of questions to the list asking about
>>>>> >> "blueprint" examples and some very helpful members have made their
>>>>> >> code available via github...but it seems there are so many ways to
>>>>> >> "skin this cat" that all the examples are different....in terms of
>>>>> >> file and directory structure layout. I understand one of the
>>>>> >> strengths
>>>>> >> of Flask is it's flexibility, but it might help novices adopt the
>>>>> >> framework when they're able to reference a standard application
>>>>> >> structure.
>>>>> >>
>>>>> >> Are there any "gold" examples....ie the "true flask way" .... even
>>>>> >> if
>>>>> >> it's just an empty dir/file layout?
>>>>> >>
>>>>> >>
>>>>> >> Thanks
>>>>> >> Bruce
>>>>> >
>>>>> >
>>>
>>>
>>>
>>>
>>> --
>>> "A arrogância é a arma dos fracos."
>>>
>>> ===========================
>>> Italo Moreira Campelo Maia
>>> Bacharel em Ciência da Computação - UECE
>>> Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile (Python, Java,
>>> Lua)
>>> Coordenador do Pug-CE
>>> -----------------------------------------------------
>>> http://www.italomaia.com/
>>> http://twitter.com/italomaia/
>>> http://eusouolobomau.blogspot.com/
>>> -----------------------------------------------------
>>> Turtle Linux  9.10 - http://tiny.cc/blogturtle910
>>> Turtle Linux 10.10 - http://bit.ly/cEw4ET
>>> ===========================
>>
>>
>

Re: [flask] Flask application standard skeleton

From:
Nathan M
Date:
2012-07-19 @ 09:54
Blueprint allow you to logically divide your application, so you should
really use them. Your auth code should reside into its own blueprint inside
a "auth" folder for instance.
If you read the large app wiki, you'll see that the "/" url is in the
__init__.py  of the app folder. It is a good starting point and a complete
example, which will answer your questions (at least it answered mines).
More generally speaking, it looks like you have the "architectural white
page syndrome", so here is my advise:
- try the 3-4 options you already know of with the same goal (e.g : simple
login system)
- stick with the one you're the most comfortable with. Bonus point if its
structure can be grasped within the 5-10mn time frame and will not be a
mess when you add more functionalities.
- document your choices, for the future maintainer.
- once your choice is made, don't look back for at least one week, so that
if you really to change, you'll know better what you need.

Besides, I think the point of a micro-framework is to adaptable to your
needs/wishes, so layouts will have a propensy to be non-standard.


--
/*
** "What do you despise? By this you are truly known."
**	from Manual of Muad'Dib by the Princess Irulan.
*/




On Wed, Jul 18, 2012 at 6:02 PM, bruce bushby <bruce.bushby@gmail.com>wrote:

> Just wanted to offer a thanks for the great examples.  I asked about a
> "standard" layout because, although there are excellent examples in
> the list, they are all a little different.
>
> I find myself wondering if I should call my "index" stuff from a
> blueprint called "main" .... or simply leave it inside the top level
> of the
> application. Should I have a file called "views.py" for my index/main
> page view....or simply run it from "runserver" ...should
> "authentication code" sit in a blueprint....or simply alongside the
> "index files" .
>
> These are mostly silly questions...but it's what prompted the question
> about a "flask standard" layout. Looking at the responses I would say
> people prefer to use flask in a way that suits them rather then stick
> to a "best practices layout" layout.
>
>
> Adding these links for people searching similar topics:
>
> https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
> https://github.com/ajford/RGVRSEF
> https://github.com/sean-/flask-skeleton
> https://bitbucket.org/imwilsonxu/fbone/src
>
>
> Bruce
>
>
>
>
> On Wed, Jul 18, 2012 at 3:48 PM, chrickso <chrickso@gmail.com> wrote:
> > I have combined https://bitbucket.org/imwilsonxu/fbone/src with
> elements of
> > https://github.com/mitsuhiko/flask/wiki/Large-app-how-to for a very nice
> > base to my medium-sized app.
> >
> > If you are a beginner (like I was), fbone will completely blow your mind.
> > It's a pretty advanced skeleton. Stick with it, learn why/how it does
> what
> > it does, slowly convert it into your own, and you will come out a pretty
> > advanced beginner.
> >
> > - chrickso
> >
> >
> >
> > On Wed, Jul 18, 2012 at 8:30 AM, Nathan M <feydaykyn@yahoo.fr> wrote:
> >>
> >> There is this link on the Github wiki, which is dubbed for large
> >> applications, but it can really be used even for small projects :
> >> https://github.com/mitsuhiko/flask/wiki/Large-app-how-to
> >> Last but not least, it's a complete blueprint example.
> >>
> >>
> >> --
> >> /*
> >> ** "What do you despise? By this you are truly known."
> >> **   from Manual of Muad'Dib by the Princess Irulan.
> >>
> >>
> >>
> >> */
> >>
> >>
> >>
> >>
> >> On Tue, Jul 17, 2012 at 5:07 PM, Italo Maia <italo.maia@gmail.com>
> wrote:
> >>>
> >>> Most said "standarts" for flask are published in the flask
> documentation.
> >>> The skeleton projects for flask available online are just compilation
> of
> >>> those techniques some people identify themselfs with. If you're
> starting,
> >>> the good thing to do is read flask docs and other peoples code, then
> choose
> >>> your own design.
> >>>
> >>> ps: there was quite some talk in the flask list about this subject. Try
> >>> looking for it.
> >>>
> >>>
> >>> 2012/7/17 ol <ol@o1.no>
> >>>>
> >>>> Hi.
> >>>> Recently started 'opener' at github.com/o1/opener
> >>>>
> >>>> Was like you looking for some "standard" starting point for my
> >>>> projects(layout).
> >>>>
> >>>> Used the official docs for larger apps to create it so for me it feels
> >>>> kindoff "standard". It easy to modify to your liking anyway.
> >>>>
> >>>> Will add more features soon, just sorting out some personal business
> >>>> first.
> >>>>
> >>>> The project is public domain so feel free to do what you want with it.
> >>>> Or I can do it if you have ideas/modifications.
> >>>>
> >>>> On Jul 17, 2012 3:47 PM, "bruce bushby" <bruce.bushby@gmail.com>
> wrote:
> >>>>>
> >>>>> Thanks Redouane, appreciated!!
> >>>>>
> >>>>> I'm guessing the responses will answer the question if such a
> standard
> >>>>> is something worth progressing. It would certainly help newbies and
> >>>>> people asking the list questions. Rather then spend a paragraph
> >>>>> explaining your layout before asking your question, your would simply
> >>>>> discuss the "standard"
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> There are
> >>>>>
> >>>>> On Tue, Jul 17, 2012 at 12:38 PM, Redouane Zait <unrealdz@gmail.com>
> >>>>> wrote:
> >>>>> > HI, i don't know wether its good enough or not but here's the
> layout
> >>>>> > I've
> >>>>> > been using lately :
> >>>>> >
> >>>>> > /config_dev.py
> >>>>> > /config_test.py
> >>>>> > /manage.py <-- self explanatory, cmd line tools script, imports db
> >>>>> > from the
> >>>>> > app package, handles stuff like db.create_all(), db.drop_all()
>  fill
> >>>>> > db with
> >>>>> > initial data and much more. uses flask-script.
> >>>>> > /fabfile.py <-- deployment / sysadmin script
> >>>>> > /run.py <-- ( imports create_app from the app packages, calls the
> >>>>> > function
> >>>>> > it with the appropriate config as an argument, then runs the app
> >>>>> >
> >>>>> > /tests/
> >>>>> >   .. /__init__.py
> >>>>> >   .. /access_test.py
> >>>>> >
> >>>>> > /app/
> >>>>> >    ../__init__.py     ( create_app app factory function defined
> here,
> >>>>> > it
> >>>>> > initializes a flask app, configures extensions, imports blueprints
> (
> >>>>> > from
> >>>>> > app.users.views import users as users_blueprint ), then registers
> the
> >>>>> > blueprints to the app and eventually returns an app
> >>>>> >
> >>>>> >    ../templates/
> >>>>> >          ../base.html
> >>>>> >          ../users/
> >>>>> >             ../signup.html
> >>>>> >             ../login.html
> >>>>> >         ../admin/
> >>>>> >     ../static/
> >>>>> >     ../users/    <-- ( users package)
> >>>>> >        ../__init__.py
> >>>>> >        ../views.py   <-- ( users blueprint defined here, aswell as
> >>>>> > its
> >>>>> > associated routes ( @users.signup, @users.login, @users.profile )
> >>>>> >        ../models.py  <-- (user - related sqlalchemy models
> >>>>> >        ../forms.py  <-- (user - related forms ( signup, login,
> etc..
> >>>>> > )
> >>>>> >        ../utils.py
> >>>>> >
> >>>>> >
> >>>>> >
> >>>>> > On Tue, Jul 17, 2012 at 10:52 AM, bruce bushby
> >>>>> > <bruce.bushby@gmail.com>
> >>>>> > wrote:
> >>>>> >>
> >>>>> >> Hi
> >>>>> >>
> >>>>> >> I wanted to ask if there has been any discussions towards
> publishing
> >>>>> >> some "skeleton standards" with regards to Flask applications?
> >>>>> >>
> >>>>> >> One of the joys of python is that all python programs are easy to
> >>>>> >> read
> >>>>> >> because they look the same. Could the same be applied to Flask
> >>>>> >> applications?
> >>>>> >>
> >>>>> >> There have been a number of questions to the list asking about
> >>>>> >> "blueprint" examples and some very helpful members have made their
> >>>>> >> code available via github...but it seems there are so many ways to
> >>>>> >> "skin this cat" that all the examples are different....in terms of
> >>>>> >> file and directory structure layout. I understand one of the
> >>>>> >> strengths
> >>>>> >> of Flask is it's flexibility, but it might help novices adopt the
> >>>>> >> framework when they're able to reference a standard application
> >>>>> >> structure.
> >>>>> >>
> >>>>> >> Are there any "gold" examples....ie the "true flask way" .... even
> >>>>> >> if
> >>>>> >> it's just an empty dir/file layout?
> >>>>> >>
> >>>>> >>
> >>>>> >> Thanks
> >>>>> >> Bruce
> >>>>> >
> >>>>> >
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> "A arrogância é a arma dos fracos."
> >>>
> >>> ===========================
> >>> Italo Moreira Campelo Maia
> >>> Bacharel em Ciência da Computação - UECE
> >>> Analista de Sistemas / Desenvolvedor Web, Desktop e Mobile (Python,
> Java,
> >>> Lua)
> >>> Coordenador do Pug-CE
> >>> -----------------------------------------------------
> >>> http://www.italomaia.com/
> >>> http://twitter.com/italomaia/
> >>> http://eusouolobomau.blogspot.com/
> >>> -----------------------------------------------------
> >>> Turtle Linux  9.10 - http://tiny.cc/blogturtle910
> >>> Turtle Linux 10.10 - http://bit.ly/cEw4ET
> >>> ===========================
> >>
> >>
> >
>