Bottle.py + uWSGI

1,503 views
Skip to first unread message

Gianluca

unread,
Nov 24, 2010, 6:21:39 AM11/24/10
to bottlepy
Hello,
I am trying Bottle.py for the first time and I've reached the
deployment phase.
I would like Bottle to play nice with uWSGI but I still have not
figured out how to configure everything properly.

Can you point me to the right direction?

Thank you!
G

mana...@gmail.com

unread,
Nov 24, 2010, 4:29:33 PM11/24/10
to bott...@googlegroups.com
I did'nt know uwsgi til your post (I've heard of it, but never tested it)
uwsgi is not a http server ...  but since 0.9.6 it embeds one ....

your entry point in your module should be named "application".
so you can set as it :

application = bottle.app()

and just run something like that :

uwsgi --http 127.0.0.1:8080 -w myapp -p 4 -M -t 20 --limit-as 128 -m -T

(myapp is your module named myapp.py in the current dir/path)

but you should use uwsgi with a real server (nginx, cherokee, apache, lighttpd, ...).



--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottle.paws.de/ for news and documentation.

Gianluca

unread,
Nov 24, 2010, 5:56:25 PM11/24/10
to bottlepy
Yes, I have a server with nginx + uwsgi installed.

But I am not sure if i got it: i just need to substitute the run()
statement with
application = bottle.app()
without any other "adapter" for the wsgi?
No need to use the default_app() like explained in the Todo tutorial?

I am sorry for my noobishness, it's the first time ever I deploy a
python webapp so I am a little confused!

Thank you for the help,
G

Marcel Hellkamp

unread,
Nov 24, 2010, 6:12:59 PM11/24/10
to bott...@googlegroups.com
Am 24.11.2010 23:56, schrieb Gianluca:
> But I am not sure if i got it: i just need to substitute the run()
> statement with
> application = bottle.app()

Yes. Thats all :)

> without any other "adapter" for the wsgi?

uWSGI works similar to mod_wsgi for apache: You don't start the server
from within your python program, but instead let an external server load
your application.

> No need to use the default_app() like explained in the Todo tutorial?

bottle.app() is an alias for bottle.default_app(). Both return a WSGI
application object.

Reply all
Reply to author
Forward
0 new messages