librelist archives

« back to archive

Another Skeleton Question

Another Skeleton Question

From:
Col Wilson
Date:
2012-05-22 @ 22:44
Can I ask some of you to please have a look at my skeleton at
https://github.com/colwilson/Flask-rename-your-application

The application is minimal, but I have tried to implement Unit testing
and fixtures in a sensible way.

Please help me by offering advice on best practice. I'm particularly
confused about database best practice.

The tests work, but I'm not convinced that the database I'm using is
as I would expect.

Love,
Col

Another Skeleton Question

From:
Col Wilson
Date:
2012-05-23 @ 07:10
Can I ask some of you to please have a look at my skeleton at
https://github.com/colwilson/Flask-rename-your-application

The application is minimal, but I have tried to implement Unit testing
and fixtures in a sensible way.

Please help me by offering advice on best practice. I'm particularly
confused about database best practice.

The tests work, but I'm not convinced that the database I'm using is
as I would expect.

Love,
Col

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-23 @ 08:20
Hi Col,

I can't claim to be a Flask expert, but you might want to look at my
Flask skeleton at: https://github.com/jhorneman/flask-skeleton

I'm using it in an app I'm currently working on. I'm fairly happy with
it so far.

I recognize your database code - I believe it's from a sample in the
docs somewhere? I had that too but wasn't happy with it. It doesn't
play nice with the way I handle configurations and app creation.

I can send you my database setup / testing code if that helps.

Jurie

On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
> Can I ask some of you to please have a look at my skeleton at
> https://github.com/colwilson/Flask-rename-your-application
>
> The application is minimal, but I have tried to implement Unit testing
> and fixtures in a sensible way.
>
> Please help me by offering advice on best practice. I'm particularly
> confused about database best practice.
>
> The tests work, but I'm not convinced that the database I'm using is
> as I would expect.
>
> Love,
> Col

Re: [flask] Another Skeleton Question

From:
Col Wilson
Date:
2012-05-23 @ 08:56
That looks simple (and thus in my head better) than where I end up.

Yes please, can I see your testing/db code?

On Wed, May 23, 2012 at 9:20 AM, Jurie Horneman <jhorneman@pobox.com> wrote:
> Hi Col,
>
> I can't claim to be a Flask expert, but you might want to look at my
> Flask skeleton at: https://github.com/jhorneman/flask-skeleton
>
> I'm using it in an app I'm currently working on. I'm fairly happy with
> it so far.
>
> I recognize your database code - I believe it's from a sample in the
> docs somewhere? I had that too but wasn't happy with it. It doesn't
> play nice with the way I handle configurations and app creation.
>
> I can send you my database setup / testing code if that helps.
>
> Jurie
>
> On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
>> Can I ask some of you to please have a look at my skeleton at
>> https://github.com/colwilson/Flask-rename-your-application
>>
>> The application is minimal, but I have tried to implement Unit testing
>> and fixtures in a sensible way.
>>
>> Please help me by offering advice on best practice. I'm particularly
>> confused about database best practice.
>>
>> The tests work, but I'm not convinced that the database I'm using is
>> as I would expect.
>>
>> Love,
>> Col



-- 
Col Wilson
http://real-jobs.appspot.com
http://terse-words.blogspot.com

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-23 @ 14:33
I'll try to find time to either copy it back to the skeleton or just
post it here.

On Wed, May 23, 2012 at 10:56 AM, Col Wilson <colwilson@bcs.org> wrote:
> That looks simple (and thus in my head better) than where I end up.
>
> Yes please, can I see your testing/db code?
>
> On Wed, May 23, 2012 at 9:20 AM, Jurie Horneman <jhorneman@pobox.com> wrote:
>> Hi Col,
>>
>> I can't claim to be a Flask expert, but you might want to look at my
>> Flask skeleton at: https://github.com/jhorneman/flask-skeleton
>>
>> I'm using it in an app I'm currently working on. I'm fairly happy with
>> it so far.
>>
>> I recognize your database code - I believe it's from a sample in the
>> docs somewhere? I had that too but wasn't happy with it. It doesn't
>> play nice with the way I handle configurations and app creation.
>>
>> I can send you my database setup / testing code if that helps.
>>
>> Jurie
>>
>> On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
>>> Can I ask some of you to please have a look at my skeleton at
>>> https://github.com/colwilson/Flask-rename-your-application
>>>
>>> The application is minimal, but I have tried to implement Unit testing
>>> and fixtures in a sensible way.
>>>
>>> Please help me by offering advice on best practice. I'm particularly
>>> confused about database best practice.
>>>
>>> The tests work, but I'm not convinced that the database I'm using is
>>> as I would expect.
>>>
>>> Love,
>>> Col
>
>
>
> --
> Col Wilson
> http://real-jobs.appspot.com
> http://terse-words.blogspot.com

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-24 @ 21:42
Right, just updated the project:

https://github.com/jhorneman/flask-skeleton

It includes database testing code. It should all work (the test passes :D).

Feedback is welcome.

On May 23, 2012, at 4:33 PM, Jurie Horneman wrote:

> I'll try to find time to either copy it back to the skeleton or just
> post it here.
> 
> On Wed, May 23, 2012 at 10:56 AM, Col Wilson <colwilson@bcs.org> wrote:
>> That looks simple (and thus in my head better) than where I end up.
>> 
>> Yes please, can I see your testing/db code?
>> 
>> On Wed, May 23, 2012 at 9:20 AM, Jurie Horneman <jhorneman@pobox.com> wrote:
>>> Hi Col,
>>> 
>>> I can't claim to be a Flask expert, but you might want to look at my
>>> Flask skeleton at: https://github.com/jhorneman/flask-skeleton
>>> 
>>> I'm using it in an app I'm currently working on. I'm fairly happy with
>>> it so far.
>>> 
>>> I recognize your database code - I believe it's from a sample in the
>>> docs somewhere? I had that too but wasn't happy with it. It doesn't
>>> play nice with the way I handle configurations and app creation.
>>> 
>>> I can send you my database setup / testing code if that helps.
>>> 
>>> Jurie
>>> 
>>> On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
>>>> Can I ask some of you to please have a look at my skeleton at
>>>> https://github.com/colwilson/Flask-rename-your-application
>>>> 
>>>> The application is minimal, but I have tried to implement Unit testing
>>>> and fixtures in a sensible way.
>>>> 
>>>> Please help me by offering advice on best practice. I'm particularly
>>>> confused about database best practice.
>>>> 
>>>> The tests work, but I'm not convinced that the database I'm using is
>>>> as I would expect.
>>>> 
>>>> Love,
>>>> Col
>> 
>> 
>> 
>> --
>> Col Wilson
>> http://real-jobs.appspot.com
>> http://terse-words.blogspot.com

Re: [flask] Another Skeleton Question

From:
Juancarlo Añez
Date:
2012-05-25 @ 15:28
I don't like the modules importing stuff from the package they belong to.
Some simple tests tell me that Python prefers to initialize the package
prior to initializing the contained modules.

Since you have models.py and views.py, maybe a controller.py would be good.

-- Juancarlo

On Thu, May 24, 2012 at 5:12 PM, Jurie Horneman <jhorneman@pobox.com> wrote:

> Right, just updated the project:
>
> https://github.com/jhorneman/flask-skeleton
>
> It includes database testing code. It should all work (the test passes :D).
>
> Feedback is welcome.
>
> On May 23, 2012, at 4:33 PM, Jurie Horneman wrote:
>
> > I'll try to find time to either copy it back to the skeleton or just
> > post it here.
> >
> > On Wed, May 23, 2012 at 10:56 AM, Col Wilson <colwilson@bcs.org> wrote:
> >> That looks simple (and thus in my head better) than where I end up.
> >>
> >> Yes please, can I see your testing/db code?
> >>
> >> On Wed, May 23, 2012 at 9:20 AM, Jurie Horneman <jhorneman@pobox.com>
> wrote:
> >>> Hi Col,
> >>>
> >>> I can't claim to be a Flask expert, but you might want to look at my
> >>> Flask skeleton at: https://github.com/jhorneman/flask-skeleton
> >>>
> >>> I'm using it in an app I'm currently working on. I'm fairly happy with
> >>> it so far.
> >>>
> >>> I recognize your database code - I believe it's from a sample in the
> >>> docs somewhere? I had that too but wasn't happy with it. It doesn't
> >>> play nice with the way I handle configurations and app creation.
> >>>
> >>> I can send you my database setup / testing code if that helps.
> >>>
> >>> Jurie
> >>>
> >>> On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
> >>>> Can I ask some of you to please have a look at my skeleton at
> >>>> https://github.com/colwilson/Flask-rename-your-application
> >>>>
> >>>> The application is minimal, but I have tried to implement Unit testing
> >>>> and fixtures in a sensible way.
> >>>>
> >>>> Please help me by offering advice on best practice. I'm particularly
> >>>> confused about database best practice.
> >>>>
> >>>> The tests work, but I'm not convinced that the database I'm using is
> >>>> as I would expect.
> >>>>
> >>>> Love,
> >>>> Col
> >>
> >>
> >>
> >> --
> >> Col Wilson
> >> http://real-jobs.appspot.com
> >> http://terse-words.blogspot.com
>
>


-- 
Juancarlo *Añez*

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-25 @ 16:24
On Fri, May 25, 2012 at 5:28 PM, Juancarlo Añez
<juancarlo.anez@gmail.com> wrote:
> I don't like the modules importing stuff from the package they belong to.
> Some simple tests tell me that Python prefers to initialize the package
> prior to initializing the contained modules.

Which imports in particular? I am not sure if that's something I could
write another way, or if it's something that's 'the Flask way', as I
understand it. See especially:

http://flask.pocoo.org/docs/patterns/packages/?highlight=circular%20import

"Circular Imports
Every Python programmer hates them, and yet we just added some:
circular imports (That’s when two modules depend on each other. In
this case views.py depends on __init__.py). Be advised that this is a
bad idea in general but here it is actually fine. The reason for this
is that we are not actually using the views in __init__.py and just
ensuring the module is imported and we are doing that at the bottom of
the file.

There are still some problems with that approach but if you want to
use decorators there is no way around that. Check out the Becoming Big
section for some inspiration how to deal with that."

Most of my headaches with this skeleton were caused by the decorators
requiring global objects. But now it seems to work.

> Since you have models.py and views.py, maybe a controller.py would be good.

In my 'real' app, which uses this skeleton, the views are not yet at a
level of complexity where I feel I need something inbetween. That
might change, of course, but right now I don't know what I would put
in a controller module.

My understanding is that:
- MVC is interpreted differently in various frameworks
- there are various variations on MVC, with amusing abbreviations
- MVC is often sloppily used
E.g. the various discussions on whether Django or Rails use 'proper' MVC or not.

Right now, this works for me, and it seems to fit the 'micro' spirit
of Flask and my app. But I am happy to listen to counterarguments :)

> On Thu, May 24, 2012 at 5:12 PM, Jurie Horneman <jhorneman@pobox.com> wrote:
>>
>> Right, just updated the project:
>>
>> https://github.com/jhorneman/flask-skeleton
>>
>> It includes database testing code. It should all work (the test passes
>> :D).
>>
>> Feedback is welcome.
>>
>> On May 23, 2012, at 4:33 PM, Jurie Horneman wrote:
>>
>> > I'll try to find time to either copy it back to the skeleton or just
>> > post it here.
>> >
>> > On Wed, May 23, 2012 at 10:56 AM, Col Wilson <colwilson@bcs.org> wrote:
>> >> That looks simple (and thus in my head better) than where I end up.
>> >>
>> >> Yes please, can I see your testing/db code?
>> >>
>> >> On Wed, May 23, 2012 at 9:20 AM, Jurie Horneman <jhorneman@pobox.com>
>> >> wrote:
>> >>> Hi Col,
>> >>>
>> >>> I can't claim to be a Flask expert, but you might want to look at my
>> >>> Flask skeleton at: https://github.com/jhorneman/flask-skeleton
>> >>>
>> >>> I'm using it in an app I'm currently working on. I'm fairly happy with
>> >>> it so far.
>> >>>
>> >>> I recognize your database code - I believe it's from a sample in the
>> >>> docs somewhere? I had that too but wasn't happy with it. It doesn't
>> >>> play nice with the way I handle configurations and app creation.
>> >>>
>> >>> I can send you my database setup / testing code if that helps.
>> >>>
>> >>> Jurie
>> >>>
>> >>> On Wed, May 23, 2012 at 9:10 AM, Col Wilson <colwilson@bcs.org> wrote:
>> >>>> Can I ask some of you to please have a look at my skeleton at
>> >>>> https://github.com/colwilson/Flask-rename-your-application
>> >>>>
>> >>>> The application is minimal, but I have tried to implement Unit
>> >>>> testing
>> >>>> and fixtures in a sensible way.
>> >>>>
>> >>>> Please help me by offering advice on best practice. I'm particularly
>> >>>> confused about database best practice.
>> >>>>
>> >>>> The tests work, but I'm not convinced that the database I'm using is
>> >>>> as I would expect.
>> >>>>
>> >>>> Love,
>> >>>> Col
>> >>
>> >>
>> >>
>> >> --
>> >> Col Wilson
>> >> http://real-jobs.appspot.com
>> >> http://terse-words.blogspot.com
>>
>
>
>
> --
> Juancarlo Añez
>

Re: [flask] Another Skeleton Question

From:
Juancarlo Añez
Date:
2012-05-25 @ 17:33
On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>wrote:

> Which imports in particular?
>

In views.py:

from application import app, db

In an application I'm working on right now I haven't moved the Flask()
declaration and configuration to a module only for lack of a good name for
it. I've stayed away for "application" because it is overloaded as a name
WSGI wants to see.

The simple experiments I did yesterday told me that I could control module
loading through imports. Before I was concerned that placing app=Flask() on
a module could allow importing an incomplete application, but no, because
the enclosing package can force the load of other required modules by
importing them.

Examples work better than explanations.

application/__init__.py


from flaskapp import app
import models
import views

__all__ = ['app']


Importing "from application import app" will force the whole sheebang to be
loaded.

-- 
Juancarlo *Añez*

Re: [flask] Another Skeleton Question

From:
Italo Maia
Date:
2012-05-26 @ 04:24
And my suggestion for a skeleton app:
https://github.com/italomaia/flask-empty

Testing comes configured with flask-script ; )

2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>

>
>
> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>wrote:
>
>> Which imports in particular?
>>
>
> In views.py:
>
> from application import app, db
>
> In an application I'm working on right now I haven't moved the Flask()
> declaration and configuration to a module only for lack of a good name for
> it. I've stayed away for "application" because it is overloaded as a name
> WSGI wants to see.
>
> The simple experiments I did yesterday told me that I could control module
> loading through imports. Before I was concerned that placing app=Flask() on
> a module could allow importing an incomplete application, but no, because
> the enclosing package can force the load of other required modules by
> importing them.
>
> Examples work better than explanations.
>
> application/__init__.py
>
>
> from flaskapp import app
> import models
> import views
>
> __all__ = ['app']
>
>
> Importing "from application import app" will force the whole sheebang to
> be loaded.
>
> --
> Juancarlo *Añez*
>
>


-- 
"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] Another Skeleton Question

From:
Col Wilson
Date:
2012-05-26 @ 10:55
Thanks everyone. I stealing bit from all of you really and no doubt
I'll come up with my own skeleton which I like and everyone else
doesn't. Such is the way ;)

Anyway, I'm not suggesting that there should be a preferred way
anyway, but it might be nice to have a single place where everyone can
show their own preferred techniques.

Sounds like a project.

Thanks everyone.

Col

On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com> wrote:
> And my suggestion for a skeleton app:
> https://github.com/italomaia/flask-empty
>
> Testing comes configured with flask-script ; )
>
>
> 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
>>
>>
>>
>> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>
>> wrote:
>>>
>>> Which imports in particular?
>>
>>
>> In views.py:
>>
>> from application import app, db
>>
>> In an application I'm working on right now I haven't moved the Flask()
>> declaration and configuration to a module only for lack of a good name for
>> it. I've stayed away for "application" because it is overloaded as a name
>> WSGI wants to see.
>>
>> The simple experiments I did yesterday told me that I could control module
>> loading through imports. Before I was concerned that placing app=Flask() on
>> a module could allow importing an incomplete application, but no, because
>> the enclosing package can force the load of other required modules by
>> importing them.
>>
>> Examples work better than explanations.
>>
>> application/__init__.py
>>
>>
>> from flaskapp import app
>> import models
>> import views
>>
>> __all__ = ['app']
>>
>>
>> Importing "from application import app" will force the whole sheebang to
>> be loaded.
>>
>> --
>> Juancarlo Añez
>>
>
>
>
> --
> "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
> ===========================



-- 
Col Wilson
http://real-jobs.appspot.com
http://terse-words.blogspot.com

Re: [flask] Another Skeleton Question

From:
Sean Lynch
Date:
2012-05-26 @ 15:34
@Italo - I really like your template.  I was doing some similar things with
mine, but I see a few ideas I'd like to borrow :)

@Col - I think it would be a great idea to have a general location to share
these project structure ideas (and more importantly, have discussion on the
decisions made).

On Sat, May 26, 2012 at 6:55 AM, Col Wilson <colwilson@bcs.org> wrote:

> Thanks everyone. I stealing bit from all of you really and no doubt
> I'll come up with my own skeleton which I like and everyone else
> doesn't. Such is the way ;)
>
> Anyway, I'm not suggesting that there should be a preferred way
> anyway, but it might be nice to have a single place where everyone can
> show their own preferred techniques.
>
> Sounds like a project.
>
> Thanks everyone.
>
> Col
>
> On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com> wrote:
> > And my suggestion for a skeleton app:
> > https://github.com/italomaia/flask-empty
> >
> > Testing comes configured with flask-script ; )
> >
> >
> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
> >>
> >>
> >>
> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>
> >> wrote:
> >>>
> >>> Which imports in particular?
> >>
> >>
> >> In views.py:
> >>
> >> from application import app, db
> >>
> >> In an application I'm working on right now I haven't moved the Flask()
> >> declaration and configuration to a module only for lack of a good name
> for
> >> it. I've stayed away for "application" because it is overloaded as a
> name
> >> WSGI wants to see.
> >>
> >> The simple experiments I did yesterday told me that I could control
> module
> >> loading through imports. Before I was concerned that placing
> app=Flask() on
> >> a module could allow importing an incomplete application, but no,
> because
> >> the enclosing package can force the load of other required modules by
> >> importing them.
> >>
> >> Examples work better than explanations.
> >>
> >> application/__init__.py
> >>
> >>
> >> from flaskapp import app
> >> import models
> >> import views
> >>
> >> __all__ = ['app']
> >>
> >>
> >> Importing "from application import app" will force the whole sheebang to
> >> be loaded.
> >>
> >> --
> >> Juancarlo Añez
> >>
> >
> >
> >
> > --
> > "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
> > ===========================
>
>
>
> --
> Col Wilson
> http://real-jobs.appspot.com
> http://terse-words.blogspot.com
>

Re: [flask] Another Skeleton Question

From:
Col Wilson
Date:
2012-05-26 @ 17:02
I'll get to it in a week out two

On May 26, 2012 4:35 PM, "Sean Lynch" <techniq35@gmail.com> wrote:
>
> @Italo - I really like your template.  I was doing some similar things
with mine, but I see a few ideas I'd like to borrow :)
>
> @Col - I think it would be a great idea to have a general location to
share these project structure ideas (and more importantly, have discussion
on the decisions made).
>
>
> On Sat, May 26, 2012 at 6:55 AM, Col Wilson <colwilson@bcs.org> wrote:
>>
>> Thanks everyone. I stealing bit from all of you really and no doubt
>> I'll come up with my own skeleton which I like and everyone else
>> doesn't. Such is the way ;)
>>
>> Anyway, I'm not suggesting that there should be a preferred way
>> anyway, but it might be nice to have a single place where everyone can
>> show their own preferred techniques.
>>
>> Sounds like a project.
>>
>> Thanks everyone.
>>
>> Col
>>
>> On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com> wrote:
>> > And my suggestion for a skeleton app:
>> > https://github.com/italomaia/flask-empty
>> >
>> > Testing comes configured with flask-script ; )
>> >
>> >
>> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
>> >>
>> >>
>> >>
>> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>
>> >> wrote:
>> >>>
>> >>> Which imports in particular?
>> >>
>> >>
>> >> In views.py:
>> >>
>> >> from application import app, db
>> >>
>> >> In an application I'm working on right now I haven't moved the Flask()
>> >> declaration and configuration to a module only for lack of a good
name for
>> >> it. I've stayed away for "application" because it is overloaded as a
name
>> >> WSGI wants to see.
>> >>
>> >> The simple experiments I did yesterday told me that I could control
module
>> >> loading through imports. Before I was concerned that placing
app=Flask() on
>> >> a module could allow importing an incomplete application, but no,
because
>> >> the enclosing package can force the load of other required modules by
>> >> importing them.
>> >>
>> >> Examples work better than explanations.
>> >>
>> >> application/__init__.py
>> >>
>> >>
>> >> from flaskapp import app
>> >> import models
>> >> import views
>> >>
>> >> __all__ = ['app']
>> >>
>> >>
>> >> Importing "from application import app" will force the whole sheebang
to
>> >> be loaded.
>> >>
>> >> --
>> >> Juancarlo Añez
>> >>
>> >
>> >
>> >
>> > --
>> > "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
>> > ===========================
>>
>>
>>
>> --
>> Col Wilson
>> http://real-jobs.appspot.com
>> http://terse-words.blogspot.com
>
>

Re: [flask] Another Skeleton Question

From:
Italo Maia
Date:
2012-05-26 @ 19:48
Thanks Sean! My goal is to make flask-empty as easy to use as possible with
most usual stuff configured out-of-the-box.
Out of curiosity: which ideas did you like? And, by the way, following the
spirit of flask, I find it very nice that there are many skeleton options
for those that want something more bundled.

2012/5/26 Col Wilson <colwilson@bcs.org>

> I'll get to it in a week out two
>
> On May 26, 2012 4:35 PM, "Sean Lynch" <techniq35@gmail.com> wrote:
> >
> > @Italo - I really like your template.  I was doing some similar things
> with mine, but I see a few ideas I'd like to borrow :)
> >
> > @Col - I think it would be a great idea to have a general location to
> share these project structure ideas (and more importantly, have discussion
> on the decisions made).
> >
> >
> > On Sat, May 26, 2012 at 6:55 AM, Col Wilson <colwilson@bcs.org> wrote:
> >>
> >> Thanks everyone. I stealing bit from all of you really and no doubt
> >> I'll come up with my own skeleton which I like and everyone else
> >> doesn't. Such is the way ;)
> >>
> >> Anyway, I'm not suggesting that there should be a preferred way
> >> anyway, but it might be nice to have a single place where everyone can
> >> show their own preferred techniques.
> >>
> >> Sounds like a project.
> >>
> >> Thanks everyone.
> >>
> >> Col
> >>
> >> On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com>
> wrote:
> >> > And my suggestion for a skeleton app:
> >> > https://github.com/italomaia/flask-empty
> >> >
> >> > Testing comes configured with flask-script ; )
> >> >
> >> >
> >> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
> >> >>
> >> >>
> >> >>
> >> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <
> jhorneman@pobox.com>
> >> >> wrote:
> >> >>>
> >> >>> Which imports in particular?
> >> >>
> >> >>
> >> >> In views.py:
> >> >>
> >> >> from application import app, db
> >> >>
> >> >> In an application I'm working on right now I haven't moved the
> Flask()
> >> >> declaration and configuration to a module only for lack of a good
> name for
> >> >> it. I've stayed away for "application" because it is overloaded as a
> name
> >> >> WSGI wants to see.
> >> >>
> >> >> The simple experiments I did yesterday told me that I could control
> module
> >> >> loading through imports. Before I was concerned that placing
> app=Flask() on
> >> >> a module could allow importing an incomplete application, but no,
> because
> >> >> the enclosing package can force the load of other required modules by
> >> >> importing them.
> >> >>
> >> >> Examples work better than explanations.
> >> >>
> >> >> application/__init__.py
> >> >>
> >> >>
> >> >> from flaskapp import app
> >> >> import models
> >> >> import views
> >> >>
> >> >> __all__ = ['app']
> >> >>
> >> >>
> >> >> Importing "from application import app" will force the whole
> sheebang to
> >> >> be loaded.
> >> >>
> >> >> --
> >> >> Juancarlo Añez
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > "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
> >> > ===========================
> >>
> >>
> >>
> >> --
> >> Col Wilson
> >> http://real-jobs.appspot.com
> >> http://terse-words.blogspot.com
> >
> >
>



-- 
"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] Another Skeleton Question

From:
Sean Lynch
Date:
2012-05-27 @ 03:16
@Italo - A few things I liked about your template:

   - The way you load blueprints from your config, and rely on blueprints
   for even the 'root' application as your blog example showed.  I want my
   project template to stay as unmodified as possible from the root level of
   the project, and this looks to accomplish this.  Aside from the config.py
   changes, most everything is untouched when starting a new project, and the
   bulk of the work is in blueprints (templates aside, but they could be
   loaded by the blueprint to pull from it's directory instead of the root one
   by settings the template_folder).  Keeping the root untouched should make
   forking the project in Git and keeping it in sync fairly easy with little
   conflicts
   - The use of commands.py / manage.py with Flask Script.  I'm new to use
   Flask with SQLAlchemy, and this makes since.  The last I used SQLAlchemy I
   was using Pylons, and liked using paste for DB setup (I also like how rails
   / django easily allows creating controller/view/model template, but that's
   another topic).
   - A small thing, but I was using class based configs as well, but had a
   Default config along with Production.  While a little more explicit to have
   one called Production instead of Config, the Default class just required
   each subclass to override something, when really it's just "what's
   different than production".
   - database.py - Useful and organized.  I like to keep my project
   template database/datastore agnostic, but still convienent.  I primarily
   use Flask wtih Google App Engine, but with the soon to be public Cloud SQL,
   I want to easily switch between the Datastore (google.ext.db / ndb) and a
   Database (SQLAlchemy).  I'd like to spend more time on this (I have a few
   unreleased extensions that make working with WTForms and the Datastore as
   well as JQGrid easier, but are currently tied to the Google Datastore).
   - Setting up error handlers by default, and placeholders for a lot of
   other flask features (template_filters, context_processors, etc).  I use a
   lot of these as well (slugify and nl2br template_filters, adding the
   current user, login/out urls, etc to the context_processor for easy access
   in templates, etc).  It's nice having comments just to explains to the user
   why they may want to use one of of these, which you've done.


Another project template I like is gae-init (http://gae-init.appspot.com/).
 A few ideas I'm looking to borrow:

   - Authentication.  Setup to use Flask Login and oauth, which is nice.  I
   liked how easy oauth was to use with Tipfy, and was my web framework of
   choice before the developer started webapp2 and abandoned it, which was
   when I got into Flask.  Auth exaxmple -
   http://code.google.com/p/gae-init/source/browse/main/auth.py
   - Some nice model mixins (created/modified when, which properties
   existed when entity saved (helpful with nosql/gae).  Not sure how I want to
   handle the SQLAlchemy way for this, but something to think on.


My current template has a packages folder as a sibling folder to the
applicaiton folder, and use pkg_resources.py to fix namespacing.  See
https://github.com/zachwill/flask-engine for an example (their lib
directory).

I'm still debating on how I want to handle client side items I use on most
all projects (Twitter Bootstrap, Less, AngularJS, JQuery).

I'll post my template to Github once I get settled on some ideas I'm trying.


On Sat, May 26, 2012 at 3:48 PM, Italo Maia <italo.maia@gmail.com> wrote:

> Thanks Sean! My goal is to make flask-empty as easy to use as possible
> with most usual stuff configured out-of-the-box.
> Out of curiosity: which ideas did you like? And, by the way, following the
> spirit of flask, I find it very nice that there are many skeleton options
> for those that want something more bundled.
>
> 2012/5/26 Col Wilson <colwilson@bcs.org>
>
>> I'll get to it in a week out two
>>
>> On May 26, 2012 4:35 PM, "Sean Lynch" <techniq35@gmail.com> wrote:
>> >
>> > @Italo - I really like your template.  I was doing some similar things
>> with mine, but I see a few ideas I'd like to borrow :)
>> >
>> > @Col - I think it would be a great idea to have a general location to
>> share these project structure ideas (and more importantly, have discussion
>> on the decisions made).
>> >
>> >
>> > On Sat, May 26, 2012 at 6:55 AM, Col Wilson <colwilson@bcs.org> wrote:
>> >>
>> >> Thanks everyone. I stealing bit from all of you really and no doubt
>> >> I'll come up with my own skeleton which I like and everyone else
>> >> doesn't. Such is the way ;)
>> >>
>> >> Anyway, I'm not suggesting that there should be a preferred way
>> >> anyway, but it might be nice to have a single place where everyone can
>> >> show their own preferred techniques.
>> >>
>> >> Sounds like a project.
>> >>
>> >> Thanks everyone.
>> >>
>> >> Col
>> >>
>> >> On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com>
>> wrote:
>> >> > And my suggestion for a skeleton app:
>> >> > https://github.com/italomaia/flask-empty
>> >> >
>> >> > Testing comes configured with flask-script ; )
>> >> >
>> >> >
>> >> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
>> >> >>
>> >> >>
>> >> >>
>> >> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <
>> jhorneman@pobox.com>
>> >> >> wrote:
>> >> >>>
>> >> >>> Which imports in particular?
>> >> >>
>> >> >>
>> >> >> In views.py:
>> >> >>
>> >> >> from application import app, db
>> >> >>
>> >> >> In an application I'm working on right now I haven't moved the
>> Flask()
>> >> >> declaration and configuration to a module only for lack of a good
>> name for
>> >> >> it. I've stayed away for "application" because it is overloaded as
>> a name
>> >> >> WSGI wants to see.
>> >> >>
>> >> >> The simple experiments I did yesterday told me that I could control
>> module
>> >> >> loading through imports. Before I was concerned that placing
>> app=Flask() on
>> >> >> a module could allow importing an incomplete application, but no,
>> because
>> >> >> the enclosing package can force the load of other required modules
>> by
>> >> >> importing them.
>> >> >>
>> >> >> Examples work better than explanations.
>> >> >>
>> >> >> application/__init__.py
>> >> >>
>> >> >>
>> >> >> from flaskapp import app
>> >> >> import models
>> >> >> import views
>> >> >>
>> >> >> __all__ = ['app']
>> >> >>
>> >> >>
>> >> >> Importing "from application import app" will force the whole
>> sheebang to
>> >> >> be loaded.
>> >> >>
>> >> >> --
>> >> >> Juancarlo Añez
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > "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
>> >> > ===========================
>> >>
>> >>
>> >>
>> >> --
>> >> Col Wilson
>> >> http://real-jobs.appspot.com
>> >> http://terse-words.blogspot.com
>> >
>> >
>>
>
>
>
> --
> "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] Another Skeleton Question

From:
Col Wilson
Date:
2012-05-27 @ 05:36
I've updated mine at
https://github.com/colwilson/Flask-rename-your-application and better
get on with some work for a few days. However, I've enjoyed and
appreciated your comments.

A couple of my own thoughts though.

Let's not turn flask into Django by adding lots of boilerplate,
wouldn't it be better to have a simple working core which allows you
to add what you want without insisting on it.

My skeleton has already fallen into this by insisting that memcache is
there, although that was always meant to b just for me, so I can
excuse myself a bit there.

Col

On Sun, May 27, 2012 at 4:16 AM, Sean Lynch <techniq35@gmail.com> wrote:
> @Italo - A few things I liked about your template:
>
> The way you load blueprints from your config, and rely on blueprints for
> even the 'root' application as your blog example showed.  I want my project
> template to stay as unmodified as possible from the root level of the
> project, and this looks to accomplish this.  Aside from the config.py
> changes, most everything is untouched when starting a new project, and the
> bulk of the work is in blueprints (templates aside, but they could be loaded
> by the blueprint to pull from it's directory instead of the root one by
> settings the template_folder).  Keeping the root untouched should make
> forking the project in Git and keeping it in sync fairly easy with little
> conflicts
> The use of commands.py / manage.py with Flask Script.  I'm new to use Flask
> with SQLAlchemy, and this makes since.  The last I used SQLAlchemy I was
> using Pylons, and liked using paste for DB setup (I also like how rails /
> django easily allows creating controller/view/model template, but that's
> another topic).
> A small thing, but I was using class based configs as well, but had a
> Default config along with Production.  While a little more explicit to have
> one called Production instead of Config, the Default class just required
> each subclass to override something, when really it's just "what's different
> than production".
> database.py - Useful and organized.  I like to keep my project template
> database/datastore agnostic, but still convienent.  I primarily use Flask
> wtih Google App Engine, but with the soon to be public Cloud SQL, I want to
> easily switch between the Datastore (google.ext.db / ndb) and a Database
> (SQLAlchemy).  I'd like to spend more time on this (I have a few unreleased
> extensions that make working with WTForms and the Datastore as well as
> JQGrid easier, but are currently tied to the Google Datastore).
> Setting up error handlers by default, and placeholders for a lot of other
> flask features (template_filters, context_processors, etc).  I use a lot of
> these as well (slugify and nl2br template_filters, adding the current user,
> login/out urls, etc to the context_processor for easy access in templates,
> etc).  It's nice having comments just to explains to the user why they may
> want to use one of of these, which you've done.
>
>
> Another project template I like is gae-init (http://gae-init.appspot.com/).
>  A few ideas I'm looking to borrow:
>
> Authentication.  Setup to use Flask Login and oauth, which is nice.  I liked
> how easy oauth was to use with Tipfy, and was my web framework of choice
> before the developer started webapp2 and abandoned it, which was when I got
> into Flask.  Auth exaxmple
> - http://code.google.com/p/gae-init/source/browse/main/auth.py
> Some nice model mixins (created/modified when, which properties existed when
> entity saved (helpful with nosql/gae).  Not sure how I want to handle the
> SQLAlchemy way for this, but something to think on.
>
>
> My current template has a packages folder as a sibling folder to the
> applicaiton folder, and use pkg_resources.py to fix namespacing.
>  See https://github.com/zachwill/flask-engine for an example (their lib
> directory).
>
> I'm still debating on how I want to handle client side items I use on most
> all projects (Twitter Bootstrap, Less, AngularJS, JQuery).
>
> I'll post my template to Github once I get settled on some ideas I'm trying.
>
>
> On Sat, May 26, 2012 at 3:48 PM, Italo Maia <italo.maia@gmail.com> wrote:
>>
>> Thanks Sean! My goal is to make flask-empty as easy to use as possible
>> with most usual stuff configured out-of-the-box.
>> Out of curiosity: which ideas did you like? And, by the way, following the
>> spirit of flask, I find it very nice that there are many skeleton options
>> for those that want something more bundled.
>>
>> 2012/5/26 Col Wilson <colwilson@bcs.org>
>>>
>>> I'll get to it in a week out two
>>>
>>> On May 26, 2012 4:35 PM, "Sean Lynch" <techniq35@gmail.com> wrote:
>>> >
>>> > @Italo - I really like your template.  I was doing some similar things
>>> > with mine, but I see a few ideas I'd like to borrow :)
>>> >
>>> > @Col - I think it would be a great idea to have a general location to
>>> > share these project structure ideas (and more importantly, have discussion
>>> > on the decisions made).
>>> >
>>> >
>>> > On Sat, May 26, 2012 at 6:55 AM, Col Wilson <colwilson@bcs.org> wrote:
>>> >>
>>> >> Thanks everyone. I stealing bit from all of you really and no doubt
>>> >> I'll come up with my own skeleton which I like and everyone else
>>> >> doesn't. Such is the way ;)
>>> >>
>>> >> Anyway, I'm not suggesting that there should be a preferred way
>>> >> anyway, but it might be nice to have a single place where everyone can
>>> >> show their own preferred techniques.
>>> >>
>>> >> Sounds like a project.
>>> >>
>>> >> Thanks everyone.
>>> >>
>>> >> Col
>>> >>
>>> >> On Sat, May 26, 2012 at 5:24 AM, Italo Maia <italo.maia@gmail.com>
>>> >> wrote:
>>> >> > And my suggestion for a skeleton app:
>>> >> > https://github.com/italomaia/flask-empty
>>> >> >
>>> >> > Testing comes configured with flask-script ; )
>>> >> >
>>> >> >
>>> >> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman
>>> >> >> <jhorneman@pobox.com>
>>> >> >> wrote:
>>> >> >>>
>>> >> >>> Which imports in particular?
>>> >> >>
>>> >> >>
>>> >> >> In views.py:
>>> >> >>
>>> >> >> from application import app, db
>>> >> >>
>>> >> >> In an application I'm working on right now I haven't moved the
>>> >> >> Flask()
>>> >> >> declaration and configuration to a module only for lack of a good
>>> >> >> name for
>>> >> >> it. I've stayed away for "application" because it is overloaded as
>>> >> >> a name
>>> >> >> WSGI wants to see.
>>> >> >>
>>> >> >> The simple experiments I did yesterday told me that I could control
>>> >> >> module
>>> >> >> loading through imports. Before I was concerned that placing
>>> >> >> app=Flask() on
>>> >> >> a module could allow importing an incomplete application, but no,
>>> >> >> because
>>> >> >> the enclosing package can force the load of other required modules
>>> >> >> by
>>> >> >> importing them.
>>> >> >>
>>> >> >> Examples work better than explanations.
>>> >> >>
>>> >> >> application/__init__.py
>>> >> >>
>>> >> >>
>>> >> >> from flaskapp import app
>>> >> >> import models
>>> >> >> import views
>>> >> >>
>>> >> >> __all__ = ['app']
>>> >> >>
>>> >> >>
>>> >> >> Importing "from application import app" will force the whole
>>> >> >> sheebang to
>>> >> >> be loaded.
>>> >> >>
>>> >> >> --
>>> >> >> Juancarlo Añez
>>> >> >>
>>> >> >
>>> >> >
>>> >> >
>>> >> > --
>>> >> > "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
>>> >> > ===========================
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Col Wilson
>>> >> http://real-jobs.appspot.com
>>> >> http://terse-words.blogspot.com
>>> >
>>> >
>>
>>
>>
>>
>> --
>> "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
>> ===========================
>
>



-- 
Col Wilson
http://real-jobs.appspot.com
http://terse-words.blogspot.com

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-27 @ 13:16
There's some nice stuff in there :)

On May 26, 2012, at 6:24 AM, Italo Maia wrote:

> And my suggestion for a skeleton app: https://github.com/italomaia/flask-empty
> 
> Testing comes configured with flask-script ; )
> 
> 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
> 
> 
> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com> wrote:
> Which imports in particular?
> 
> In views.py:
> 
> from application import app, db
>  
> In an application I'm working on right now I haven't moved the Flask() 
declaration and configuration to a module only for lack of a good name for
it. I've stayed away for "application" because it is overloaded as a name 
WSGI wants to see.
> 
> The simple experiments I did yesterday told me that I could control 
module loading through imports. Before I was concerned that placing 
app=Flask() on a module could allow importing an incomplete application, 
but no, because the enclosing package can force the load of other required
modules by importing them.
> 
> Examples work better than explanations.
> 
> application/__init__.py
> 
> from flaskapp import app
> import models
> import views
> 
> __all__ = ['app']
> 
> Importing "from application import app" will force the whole sheebang to
be loaded.
> 
> -- 
> Juancarlo Añez
> 
> 
> 
> 
> -- 
> "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] Another Skeleton Question

From:
jon
Date:
2012-05-28 @ 14:07
It's been interesting reading through this thread.  I was hacking away
on something similar recently.

I use virtualenv and virtualenvwrapper for all my development so I
whipped up a project template for virtualenvwrapper.  It handles all
of my renaming for me and sets up a very rough template, it is by no
means complete but I've used it for a couple of little projects and it
seemed to work well.  It's opinionated as it installs my most commonly
used extensions.

I'm continuing to work on it and add things as they come up.

Might be of use to someone https://github.com/jmstaley/virtualenvwrapper.flask

On Sun, May 27, 2012 at 2:16 PM, Jurie Horneman <jhorneman@pobox.com> wrote:
> There's some nice stuff in there :)
>
> On May 26, 2012, at 6:24 AM, Italo Maia wrote:
>
> And my suggestion for a skeleton app:
> https://github.com/italomaia/flask-empty
>
> Testing comes configured with flask-script ; )
>
> 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
>>
>>
>>
>> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>
>> wrote:
>>>
>>> Which imports in particular?
>>
>>
>> In views.py:
>>
>> from application import app, db
>>
>> In an application I'm working on right now I haven't moved the Flask()
>> declaration and configuration to a module only for lack of a good name for
>> it. I've stayed away for "application" because it is overloaded as a name
>> WSGI wants to see.
>>
>> The simple experiments I did yesterday told me that I could control module
>> loading through imports. Before I was concerned that placing app=Flask() on
>> a module could allow importing an incomplete application, but no, because
>> the enclosing package can force the load of other required modules by
>> importing them.
>>
>> Examples work better than explanations.
>>
>> application/__init__.py
>>
>>
>> from flaskapp import app
>> import models
>> import views
>>
>> __all__ = ['app']
>>
>>
>> Importing "from application import app" will force the whole sheebang to
>> be loaded.
>>
>> --
>> Juancarlo Añez
>>
>
>
>
> --
> "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
> ===========================
>
>



-- 
jon

Re: [flask] Another Skeleton Question

From:
Col Wilson
Date:
2012-05-28 @ 17:44
I like the word opinionated. That's what we should be really and you can't
be opinionated unless you are knowledgeable. I'm just cautious about
making  newbies think they need all the crap we might want.
On May 28, 2012 3:15 PM, "jon" <jmstaley@gmail.com> wrote:
>
> It's been interesting reading through this thread.  I was hacking away
> on something similar recently.
>
> I use virtualenv and virtualenvwrapper for all my development so I
> whipped up a project template for virtualenvwrapper.  It handles all
> of my renaming for me and sets up a very rough template, it is by no
> means complete but I've used it for a couple of little projects and it
> seemed to work well.  It's opinionated as it installs my most commonly
> used extensions.
>
> I'm continuing to work on it and add things as they come up.
>
> Might be of use to someone
https://github.com/jmstaley/virtualenvwrapper.flask
>
> On Sun, May 27, 2012 at 2:16 PM, Jurie Horneman <jhorneman@pobox.com>
wrote:
> > There's some nice stuff in there :)
> >
> > On May 26, 2012, at 6:24 AM, Italo Maia wrote:
> >
> > And my suggestion for a skeleton app:
> > https://github.com/italomaia/flask-empty
> >
> > Testing comes configured with flask-script ; )
> >
> > 2012/5/25 Juancarlo Añez <juancarlo.anez@gmail.com>
> >>
> >>
> >>
> >> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com>
> >> wrote:
> >>>
> >>> Which imports in particular?
> >>
> >>
> >> In views.py:
> >>
> >> from application import app, db
> >>
> >> In an application I'm working on right now I haven't moved the Flask()
> >> declaration and configuration to a module only for lack of a good name
for
> >> it. I've stayed away for "application" because it is overloaded as a
name
> >> WSGI wants to see.
> >>
> >> The simple experiments I did yesterday told me that I could control
module
> >> loading through imports. Before I was concerned that placing
app=Flask() on
> >> a module could allow importing an incomplete application, but no,
because
> >> the enclosing package can force the load of other required modules by
> >> importing them.
> >>
> >> Examples work better than explanations.
> >>
> >> application/__init__.py
> >>
> >>
> >> from flaskapp import app
> >> import models
> >> import views
> >>
> >> __all__ = ['app']
> >>
> >>
> >> Importing "from application import app" will force the whole sheebang
to
> >> be loaded.
> >>
> >> --
> >> Juancarlo Añez
> >>
> >
> >
> >
> > --
> > "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
> > ===========================
> >
> >
>
>
>
> --
> jon

Re: [flask] Another Skeleton Question

From:
Jurie Horneman
Date:
2012-05-27 @ 13:10
Re the module name being 'application': I see two solutions:

1. Pick a name that is bland but correct, so a rename is only really 
needed when you use multiple applications. Advantage: you can quickly use 
the skeleton to build a small app.
2. Picking an obvious placeholder name, like 'myapp' or 'rename-me', and 
then provide scripts (bash, bat) to rename the app. But then I'd need to 
maintain those scripts...

I didn't realize there might be a conflict with WSGI. Then again, it seems
to work so far.


Regarding your import structure: I see what you're doing, just not what 
the advantage is compared to what I'm doing.


Overall, since I am not that familiar with Flask, I am trying to only 
solve the problems I'm relatively sure I have or will have. This is 
reflected in my skeleton, of course. So it is likely to change over time.

On May 25, 2012, at 7:33 PM, Juancarlo Añez wrote:

> 
> 
> On Fri, May 25, 2012 at 11:54 AM, Jurie Horneman <jhorneman@pobox.com> wrote:
> Which imports in particular?
> 
> In views.py:
> 
> from application import app, db
>  
> In an application I'm working on right now I haven't moved the Flask() 
declaration and configuration to a module only for lack of a good name for
it. I've stayed away for "application" because it is overloaded as a name 
WSGI wants to see.
> 
> The simple experiments I did yesterday told me that I could control 
module loading through imports. Before I was concerned that placing 
app=Flask() on a module could allow importing an incomplete application, 
but no, because the enclosing package can force the load of other required
modules by importing them.
> 
> Examples work better than explanations.
> 
> application/__init__.py
> 
> from flaskapp import app
> import models
> import views
> 
> __all__ = ['app']
> 
> Importing "from application import app" will force the whole sheebang to
be loaded.
> 
> -- 
> Juancarlo Añez
>