Sunday, June 26, 2016

Installing WebPy, SQLAlchemy and SQLite on Termux

Android 5
Termux 0.34 (Terminal emulator and Linux environment for Android)
WebPy 0.37
SQLAlchemy 1.0.13
SQLite 3.13.0


Installing packages on Termux:
  • apt update
  • Installing Python 2:
  • apt install python2
  • apt install nano
  • apt install openssh
Installing (Easy way) on Termux:
  • apt install sqlite
  • wget http://webpy.org/static/web.py-0.38.tar.gz
  • tar -xzvf  web.py-0.38.tar.gz
  • cd web.py-0.38
  • pyhton2 setup.py install
  • download SQLAlchemy package (http://www.sqlalchemy.org/download.html)
  • tar -xzvf  SQLAlchemy-1.1.5.tar.gz
  • cd SQLAlchemy-1.1.5
  • python2 setup.py install
Installing (Hard way) on Termux:
  • Installing easy_setup:
  • wget https://bootstrap.pypa.io/ez_setup.py -O - | python
  • IF it doesn't work this way:
  • THEN:
    • python2
    • $ import urllib2
    • $ response = urllib2.urlopen('https://bootstrap.pypa.io/ez_setup.py')
    • $ html = response.read()
    • $ f = open('ez_setup.py','w')
    • $ f.write(html)
    • $ f.close()
    • $ exit()
    • python2 ez_setup.py
  • Install WebPy framework:
  • easy_install web.py
  • Install SQLAlchemy:
  • easy_install sqlalchemy
  • Install SQLite:
  • download and extract SQLite3 zip files (DLL and Shell/Tools) to new folder (ex: c:\development\sqlite):

Testing:
  • nano webpy_test.py
    • import web
    • urls = (
    •     '/(.*)', 'hello'
    • )
    • app = web.application(urls, globals())

    • class hello:        
    •     def GET(self, name):
    •         if not name: 
    •             name = 'World'
    •         return 'Hello, ' + name + '!'

    • if __name__ == "__main__":
    •     app.run()
  • python2 webpy_test.py 8090
  • Connect using a REST client.


Links:

If you like this content, feel free to