Re: [flask] question about 'packaging/deployement'
- From:
- Armin Ronacher
- Date:
- 2010-05-18 @ 22:35
Hi,
On 5/18/10 11:24 PM, Sebastien Estienne wrote:
> But it doesn't seem to cover the simple case: having only on python
> file eg: hello.py
> packages=['hello'] doesn't work.
>
> or maybe i'm misunderstanding something.
The reason is on that page:
"In this case we assume your application is called yourapplication.py
and you are not using a module, but a package. Distributing resources
with standard modules is not supported by distribute so we will not
bother with it."
> should i move webui.py -> webui/__init__.py ?
Yes. And add a second file called run.py next to webui with this as
content:
from webui import app
app.run()
Because "python webui/__init__.py" to run the application does not work,
it needs a separate file. This is a limitation (well, it's not really a
limitation, it makes perfectly fine if you know how the Python import
system works) of Python we have to live with.
However for the package case I consider adding a function to flask
itself so that you can run any Flask application like this:
@ python -mflask webui
This would then run webui as development server.
Regards,
Armin