Python Server on Android

1,951 views
Skip to first unread message

Flock

unread,
May 8, 2013, 3:43:49 AM5/8/13
to python-...@googlegroups.com

Hello,

I want to set up a web server and web-service directly at the Android device by using Python. Has anyone ever tried to use bottlepy, web2py or cherrypy or other python web frameworks with kivy? I don't want to use the built-in debug servers of the frameworks, what I need is a production state server like python-paste.

Thanks in advance.

Mathieu Virbel

unread,
May 19, 2013, 4:34:00 AM5/19/13
to python-...@googlegroups.com
Hi,

Nobody answered :/
I guess any python webserver will work. As long al you have all the
dependencies in a directory, and that you include the directory in your
sys.path.

Then it's up to you to start the webserver in a Thread, or you could now
use new android service support in python-for-android. (See
http://python-for-android.readthedocs.org/en/latest/android.html#android-service)

Good luck, and don't hesitate to share your result!
(or even a little snippet to show to others users how you have done it)

Mathieu

Le 08/05/2013 09:43, Flock a �crit :
> --
> Vous recevez ce message, car vous �tes abonn� au groupe Google
> Groupes Python For Android.
> Pour vous d�sabonner de ce groupe et ne plus recevoir d'e-mails le
> concernant, envoyez un e-mail � l'adresse
> python-androi...@googlegroups.com.
> Pour plus d'options, visitez le site
> https://groups.google.com/groups/opt_out .
>
>

Jules d'Hazebrouck

unread,
May 23, 2013, 1:17:03 PM5/23/13
to python-...@googlegroups.com
Hello,

I think you can use bottlepy directly...This project has no depends. The code is light and clean. Bottlepy is a one file framework. Cherrypy may be a good choice but it's louder. Web2py is overkill. With Bottle you can deploy quickly a REST application by the android service. Your viewer is Kivy app.

Can you give us a feedback about your choice and result ? Thank you.

J.H

Xaxa Urtiz

unread,
Sep 15, 2013, 4:39:06 PM9/15/13
to python-...@googlegroups.com
Hello,
I've cherrypy running in my app, i just have to start it in another thread, like that:

def startServer():
    cherrypy.server.socket_host="0.0.0.0"
    cherrypy.quickstart(Root())

def main():
    cherThread = threading.Thread(target=startServer)
    cherThread.daemon = True
    cherThread.start()
    MyApp().run()


if __name__=="__main__":
    main()

I put the cherrypy folder in the same directory as my main.py file (maybe there is a better way to do that...).
To build the application, you have to compile python with https support (because Cherrypy use HTTPSConnection), see this thread : https://groups.google.com/forum/#!topic/kivy-users/QxmEEFawb3E
and you have to add INTERNET permission ( --permission INTERNET)  when you build your package, see this page http://kivy.org/docs/guide/packaging-android.html

Ben Rousch

unread,
Sep 15, 2013, 4:55:30 PM9/15/13
to python-...@googlegroups.com
That's very cool. Is your app code on Github?
> --
> Vous recevez ce message, car vous êtes abonné au groupe Google Groupes
> Python For Android.
> Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le
> concernant, envoyez un e-mail à l'adresse
--
Ben Rousch
bro...@gmail.com
http://clusterbleep.net/

Xaxa Urtiz

unread,
Sep 15, 2013, 5:24:36 PM9/15/13
to python-...@googlegroups.com
Not for the moment, i'm just discovering Kivy and python for android (and I begin to love it ;) ), basically i've just copy the cherrypy directory in the same directory as the main.py and built the package as described. I've some ImportError module when running the app (a module named "sndhdr") but it works (I can browse from my computer and do some transfer file)
I'll be happy to help if somebody has any problem.
Reply all
Reply to author
Forward
0 new messages