Skip to contentSkip to conversation

Web2py and pydal new packages

PATCH New Angelo Compagnucci 2 participants 6 messages Apr 14, 2015 – Jul 24, 2015

lore
Share & tools
lore
#0 lore raw

v3 cover Web2py and pydal new packages

This patch adds web2py python web application framework and pydal, it's database abstraction layer.
This is the first package to use the new recursive makedevs syntax, indeed it runs as www-data non privileged user.

Angelo Compagnucci (2):
package/python-pydal: new package
package/python-web2py: new package

 package/Config.in                      |  2 ++
 package/python-pydal/Config.in         | 15 +++++++++++++
 package/python-pydal/python-pydal.mk   | 14 ++++++++++++
 package/python-web2py/Config.in        | 23 ++++++++++++++++++++
 package/python-web2py/S51web2py        | 25 ++++++++++++++++++++++
 package/python-web2py/python-web2py.mk | 39 ++++++++++++++++++++++++++++++++++
 package/python-web2py/web2py.service   | 11 ++++++++++
 7 files changed, 129 insertions(+)
 create mode 100644 package/python-pydal/Config.in
 create mode 100644 package/python-pydal/python-pydal.mk
 create mode 100644 package/python-web2py/Config.in
 create mode 100644 package/python-web2py/S51web2py
 create mode 100644 package/python-web2py/python-web2py.mk
 create mode 100644 package/python-web2py/web2py.service
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/2 package/python-pydal: new package

This package adds the python-pydal python package. pyDAL is a pure Python Database Abstraction Layer.

---
Changelog:

v2 -> v3:
* Moved pydal to a pure python-package.
* Added the host variant to make it usable in host side scripts.
* Moved to github download helper.
* License update.
* Added a package help.

 package/Config.in                    |  1 +
 package/python-pydal/Config.in       | 15 +++++++++++++++
 package/python-pydal/python-pydal.mk | 14 ++++++++++++++
 3 files changed, 30 insertions(+)
 create mode 100644 package/python-pydal/Config.in
 create mode 100644 package/python-pydal/python-pydal.mk
package/Config.in +1 -0
index c27fc20..839b80a 100644
@@ -592,6 +592,7 @@ menu "external python modules"
 	source "package/python-psutil/Config.in"
 	source "package/python-pyasn/Config.in"
 	source "package/python-pycrypto/Config.in"
+	source "package/python-pydal/Config.in"
 	source "package/python-pyftpdlib/Config.in"
 	source "package/python-pygame/Config.in"
 	source "package/python-pyinotify/Config.in"
package/python-pydal/Config.in new file +15 -0
new file mode 100644
index 0000000..590bcd4
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_PYTHON_PYDAL
+	bool python-pydal
+	help
+	  pyDAL is a pure Python Database Abstraction Layer.
+	  It dynamically generates the SQL in real time using
+	  the specified dialect for the database back end,
+	  so that you do not have to write SQL code or learn
+	  different SQL dialects (the term SQL is used generically),
+	  and your code will be portable
+	  among different types of databases.
+
+	  pyDAL comes from the original web2py's DAL,
+	  with the aim of being wide-compatible.
+	  pyDAL doesn't require web2py and can be used
+	  in any Python context.
package/python-pydal/python-pydal.mk new file +14 -0
new file mode 100644
index 0000000..1ad4588
@@ -0,0 +1,14 @@
+################################################################################
+#
+# python-pydal
+#
+################################################################################
+
+PYTHON_PYDAL_VERSION = v15.03
+PYTHON_PYDAL_SITE = $(call github,web2py,pydal,$(PYTHON_PYDAL_VERSION))
+PYTHON_PYDAL_LICENSE = BSD-3c
+PYTHON_PYDAL_LICENSE_FILES = LICENSE
+PYTHON_PYDAL_SETUP_TYPE = setuptools
+
+$(eval $(host-python-package))
+$(eval $(python-package))
Signature · 1 line
1.9.1
#2 lore raw

PATCH v3 1/2 package/python-pydal: new package

Dear Angelo Compagnucci,

Quoted 6 lines · Angelo Compagnucci

This package adds the python-pydal python package. pyDAL is a pure Python Database Abstraction Layer.

---
Changelog:

Applied with some minor changes:

[Thomas:
- rewrap Config.in help text
- add upstream URL in Config.in help text.]

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v3 2/2 package/python-web2py: new package

In reply to Angelo Compagnucci

This patch adds web2py package. web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications.

---
Changelog:

v2 -> v3:
* Fixed systemd service file installation path.
* Fixed dependencies in Config.mk
* Moved to the systemwide installed pydal.
* Moved installation path to /var/www/.

v1 -> v2:
* Adding python2 dependency only (suggested by Yegor)

 package/Config.in                      |  1 +
 package/python-web2py/Config.in        | 23 ++++++++++++++++++++
 package/python-web2py/S51web2py        | 25 ++++++++++++++++++++++
 package/python-web2py/python-web2py.mk | 39 ++++++++++++++++++++++++++++++++++
 package/python-web2py/web2py.service   | 11 ++++++++++
 5 files changed, 99 insertions(+)
 create mode 100644 package/python-web2py/Config.in
 create mode 100644 package/python-web2py/S51web2py
 create mode 100644 package/python-web2py/python-web2py.mk
 create mode 100644 package/python-web2py/web2py.service
package/Config.in +1 -0
index 839b80a..fd4296c 100644
@@ -618,6 +618,7 @@ menu "external python modules"
 	source "package/python-twisted/Config.in"
 	source "package/python-urwid/Config.in"
 	source "package/python-versiontools/Config.in"
+	source "package/python-web2py/Config.in"
 	source "package/python-webpy/Config.in"
 	source "package/python-werkzeug/Config.in"
 	source "package/python-ws4py/Config.in"
package/python-web2py/Config.in new file +23 -0
new file mode 100644
index 0000000..b10d3a4
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_PYTHON_WEB2PY
+	bool "python-web2py"
+	depends on BR2_PACKAGE_PYTHON
+	select BR2_PACKAGE_PYTHON_PYDAL
+	select BR2_PACKAGE_PYTHON_ZLIB
+	select BR2_PACKAGE_PYTHON_PYEXPAT
+	select BR2_PACKAGE_PYTHON_SQLITE
+	help
+	  web2py is a free open source full-stack framework for rapid
+	  development of fast, scalable, secure and portable
+	  database-driven web-based applications.
+
+	  http://web2py.com
+
+if BR2_PACKAGE_PYTHON_WEB2PY
+
+config BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD
+	string "admin panel password"
+	default web2py
+	help
+	  Set the admin panel password.
+
+endif
package/python-web2py/S51web2py new file +25 -0
new file mode 100644
index 0000000..1da9ef4
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case "$1" in
+	start)
+		echo -n "Starting web2py: "
+		start-stop-daemon -S -q -m -p /run/web2py.pid \
+			-c www-data \
+			-b -x /var/www/web2py/web2py.py \
+			-- --nogui -a '"<recycle>"' -i 0.0.0.0 -p 8000
+		[ $? = 0 ] && echo "OK" || echo "FAIL"
+		;;
+	stop)
+		echo -n "Stopping web2py: "
+		start-stop-daemon -K -q -p /run/web2py.pid
+		[ $? = 0 ] && echo "OK" || echo "FAIL"
+		;;
+	restart)
+		"$0" stop
+		sleep 1
+		"$0" start
+		;;
+	*)
+		echo "Usage: $0 {start|stop|restart}"
+		;;
+esac
package/python-web2py/python-web2py.mk new file +39 -0
new file mode 100644
index 0000000..01e332e
@@ -0,0 +1,39 @@
+################################################################################
+#
+# python-web2py
+#
+################################################################################
+
+PYTHON_WEB2PY_VERSION = R-2.10.3
+PYTHON_WEB2PY_SITE = $(call github,web2py,web2py,$(PYTHON_WEB2PY_VERSION))
+PYTHON_WEB2PY_LICENSE = LGPLv3
+PYTHON_WEB2PY_LICENSE_FILES = LICENSE
+PYTHON_WEB2PY_DEPENDENCIES = python python-pydal host-python-pydal
+
+define PYTHON_WEB2PY_INSTALL_TARGET_CMDS
+	$(HOST_DIR)/usr/bin/python2 -c 'import os; \
+		os.chdir("$(@D)"); \
+		from gluon.main import save_password; \
+		save_password($(BR2_PACKAGE_PYTHON_WEB2PY_PASSWORD),8000)'
+	mkdir -p $(TARGET_DIR)/var/www/web2py
+	cp -dpfr $(@D)/* $(TARGET_DIR)/var/www/web2py
+endef
+
+define PYTHON_WEB2PY_INSTALL_INIT_SYSV
+	$(INSTALL) -m 0755 -D package/python-web2py/S51web2py \
+		$(TARGET_DIR)/etc/init.d/S51web2py
+endef
+
+define PYTHON_WEB2PY_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 package/python-web2py/web2py.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/web2py.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -fs ../web2py.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/web2py.service
+endef
+
+define PYTHON_WEB2PY_PERMISSIONS
+	/var/www/web2py  r  750  www-data  www-data  -  -  -  -  -
+endef
+
+$(eval $(generic-package))
package/python-web2py/web2py.service new file +11 -0
new file mode 100644
index 0000000..0274bd8
@@ -0,0 +1,11 @@
+[Unit]
+Description=Web2py daemon
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/var/www/web2py/web2py.py --nogui -a '<recycle>' -i 0.0.0.0 -p 8000
+User=www-data
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
1.9.1
#4 lore raw

PATCH v3 2/2 package/python-web2py: new package

Dear Angelo Compagnucci,

Quoted 8 lines · Angelo Compagnucci

This patch adds web2py package. web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications.

---
Changelog:

Quoted 8 lines

v2 -> v3:
* Fixed systemd service file installation path.
* Fixed dependencies in Config.mk
* Moved to the systemwide installed pydal.
* Moved installation path to /var/www/.

v1 -> v2:
* Adding python2 dependency only (suggested by Yegor)

Applied with some minor change:

[Thomas: fixup symbolic link to the systemd service file.]

However, there are two things that I believe should be improved/investigated:

* The installation of web2py on the target is huge: 20 MB. When I look at it, it seems like there's a huge amount of example applications and so on, which don't really make sense to install by default. Can you look at trimming down the installation size to something closer to what people would really need?

* I setup an admin password, but I don't know what to do with. When I connect to http://<myip>:8000, I can see web2py running. If I click on "admin" in the box on the right hand side, it brings me to a blank page that says "Admin is disabled because insecure channel".

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH v3 2/2 package/python-web2py: new package

Dear Thomas Petazzoni,

2015-07-23 22:26 GMT+02:00 Thomas Petazzoni
<[email protected]>:

Quoted 24 lines

Dear Angelo Compagnucci,

Quoted 8 lines · Angelo Compagnucci

This patch adds web2py package. web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applications.

---
Changelog:

Quoted 8 lines

v2 -> v3:
* Fixed systemd service file installation path.
* Fixed dependencies in Config.mk
* Moved to the systemwide installed pydal.
* Moved installation path to /var/www/.

v1 -> v2:
* Adding python2 dependency only (suggested by Yegor)

Applied with some minor change:

[Thomas: fixup symbolic link to the systemd service file.]

Quoted 8 lines

However, there are two things that I believe should be improved/investigated:

* The installation of web2py on the target is huge: 20 MB. When I look at it, it seems like there's a huge amount of example applications and so on, which don't really make sense to install by default. Can you look at trimming down the installation size to something closer to what people would really need?

Yes, it could be trimmed, it indeed ships with a welcome application and an examples application, I'll post a patch shortly.

Quoted 4 lines

* I setup an admin password, but I don't know what to do with. When I connect to http://<myip>:8000, I can see web2py running. If I click on "admin" in the box on the right hand side, it brings me to a blank page that says "Admin is disabled because insecure channel".

It's the default behaviour. Admin interface could be accessed by https, localhost, or ssh port redirect only. But unfortunately, web2py doesn't starts if a password is not setted.

Sincerely, Angelo

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo