From 81863d69c9d8cebf349f81f37dc6c58b695e5546 Mon Sep 17 00:00:00 2001 From: Raj Date: Tue, 7 Jul 2015 02:38:30 +0530 Subject: [PATCH 1/4] Small typo Sorry! Can't resist when you see typo on the terminal ! --- scripts/setup-web2py-ubuntu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup-web2py-ubuntu.sh b/scripts/setup-web2py-ubuntu.sh index 4ce86474..01682d1a 100644 --- a/scripts/setup-web2py-ubuntu.sh +++ b/scripts/setup-web2py-ubuntu.sh @@ -1,7 +1,7 @@ echo "This script will: 1) install all modules need to run web2py on Ubuntu 14.04 2) install web2py in /home/www-data/ -3) create a self signed sll certificate +3) create a self signed ssl certificate 4) setup web2py with mod_wsgi 5) overwrite /etc/apache2/sites-available/default 6) restart apache. From a378ab3e518faee0c6b5560717e49d5b925acabb Mon Sep 17 00:00:00 2001 From: cassiobotaro Date: Fri, 10 Jul 2015 01:11:16 -0300 Subject: [PATCH 2/4] fix validations IS_IPV6 and IS_IPADDRESS --- gluon/validators.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/gluon/validators.py b/gluon/validators.py index 2afeedc4..10dc5b7f 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -3482,7 +3482,7 @@ class IS_IPV6(Validator): from gluon.contrib import ipaddr as ipaddress try: - ip = ipaddress.IPv6Address(value) + ip = ipaddress.IPv6Address(value.decode('utf-8')) ok = True except ipaddress.AddressValueError: return (value, translate(self.error_message)) @@ -3494,7 +3494,7 @@ class IS_IPV6(Validator): self.subnets = [self.subnets] for network in self.subnets: try: - ipnet = ipaddress.IPv6Network(network) + ipnet = ipaddress.IPv6Network(network.decode('utf-8')) except (ipaddress.NetmaskValueError, ipaddress.AddressValueError): return (value, translate('invalid subnet provided')) if ip in ipnet: @@ -3703,20 +3703,22 @@ class IS_IPADDRESS(Validator): def __call__(self, value): try: - import ipaddress + from ipaddress import ip_address as IPAddress + from ipaddress import IPv6Address, IPv4Address except ImportError: - from gluon.contrib import ipaddr as ipaddress + from gluon.contrib.ipaddr import (IPAddress, IPv4Address, + IPv6Address) try: - ip = ipaddress.IPAddress(value) - except ValueError, e: + ip = IPAddress(value.decode('utf-8')) + except ValueError: return (value, translate(self.error_message)) - if self.is_ipv4 and isinstance(ip, ipaddress.IPv6Address): + if self.is_ipv4 and isinstance(ip, IPv6Address): retval = (value, translate(self.error_message)) - elif self.is_ipv6 and isinstance(ip, ipaddress.IPv4Address): + elif self.is_ipv6 and isinstance(ip, IPv4Address): retval = (value, translate(self.error_message)) - elif self.is_ipv4 or isinstance(ip, ipaddress.IPv4Address): + elif self.is_ipv4 or isinstance(ip, IPv4Address): retval = IS_IPV4( minip=self.minip, maxip=self.maxip, @@ -3726,7 +3728,7 @@ class IS_IPADDRESS(Validator): is_automatic=self.is_automatic, error_message=self.error_message )(value) - elif self.is_ipv6 or isinstance(ip, ipaddress.IPv6Address): + elif self.is_ipv6 or isinstance(ip, IPv6Address): retval = IS_IPV6( is_private=self.is_private, is_link_local=self.is_link_local, From 6d58845153a4ea1387d902c90026a4cdf0a5d1bf Mon Sep 17 00:00:00 2001 From: gi0baro Date: Mon, 13 Jul 2015 14:25:43 +0200 Subject: [PATCH 3/4] Using pydal 15.07 --- gluon/packages/dal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/packages/dal b/gluon/packages/dal index 6ea8659a..50f8dafd 160000 --- a/gluon/packages/dal +++ b/gluon/packages/dal @@ -1 +1 @@ -Subproject commit 6ea8659adc02e1ccd6075550d3ed095542332967 +Subproject commit 50f8dafdff6f04a3f5edce7807aef89a32ff516f From 3e8cbd5a0d8d3f47af36cdfd38ce511adc1ad546 Mon Sep 17 00:00:00 2001 From: Dragan Matic Date: Thu, 16 Jul 2015 13:35:27 +0200 Subject: [PATCH 4/4] Script to install web2py with nginx and uwsgi on centos 7 --- scripts/setup-web2py-nginx-uwsgi-centos7.sh | 235 ++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 scripts/setup-web2py-nginx-uwsgi-centos7.sh diff --git a/scripts/setup-web2py-nginx-uwsgi-centos7.sh b/scripts/setup-web2py-nginx-uwsgi-centos7.sh new file mode 100644 index 00000000..a6b62152 --- /dev/null +++ b/scripts/setup-web2py-nginx-uwsgi-centos7.sh @@ -0,0 +1,235 @@ +#!/bin/bash + +# This script will install web2py with nginx+uwsgi on centos 7 +# This script is based on excellent tutorial by Justin Ellingwood on +# https://www.digitalocean.com/community/tutorials/how-to-deploy-web2py-python-applications-with-uwsgi-and-nginx-on-centos-7 + +# +# Phase 1: First, let's ask a few things +# + +read -p "Enter username under which web2py will be installed [web2py]: " USERNAME +USERNAME=${USERNAME:-web2py} + +read -p "Enter path where web2py will be installed [/opt/web2py_apps]: " WEB2PY_PATH +WEB2PY_PATH=${WEB2PY_PATH:-/opt/web2py_apps} + +read -p "Web2py subdirectory will be called: [web2py]: " WEB2PY_APP +WEB2PY_APP=${WEB2PY_APP:-web2py} + +read -p "Enter your web2py admin password: " WEB2PY_PASS + +read -p "Enter your domain name: " YOUR_SERVER_DOMAIN + +# open new user +useradd -d $WEB2PY_PATH $USERNAME + +# if it's not already open, let's create a directory for web2py +mkdir -p $WEB2PY_PATH + +# now let's create a self signed certificate +cd $WEB2PY_PATH + +openssl req -x509 -new -newkey rsa:4096 -days 3652 -nodes -keyout $WEB2PY_APP.key -out $WEB2PY_APP.crt + +# +# phase 2: That was all the input that we needed so let's install the components +# + +echo "Installing necessary components" + +# Verify packages are up to date +yum -y upgrade + +# Install required packages +yum install -y epel-release +yum install -y python-devel python-pip gcc nginx wget unzip python-psycopg2 MySQL-python + +# download and unzip web2py + +echo "Downloading web2py" + +cd $WEB2PY_PATH +wget http://web2py.com/examples/static/web2py_src.zip +unzip web2py_src.zip +rm web2py_src.zip + +# preparing wsgihandler +chown -R $USERNAME.$USERNAME $WEB2PY_PATH/$WEB2PY_APP +mv $WEB2PY_PATH/$WEB2PY_APP/handlers/wsgihandler.py $WEB2PY_PATH/$WEB2PY_APP + +# now let's install uwsgi + +pip install uwsgi + +# preparing directories +mkdir -p /etc/uwsgi/sites +mkdir -p /var/log/uwsgi +mkdir -p /etc/nginx/ssl/ + +# +# Phase 3: Ok, everything is installed now so we'll configure things +# + +# Create configuration file for uwsgi in /etc/uwsgi/$WEB2PY_APP.ini +echo '[uwsgi] +chdir = WEB2PY_PATH_PLACEHOLDER/WEB2PY_APP_PLACEHOLDER +module = wsgihandler:application + +master = true +processes = 5 + +uid = USERNAME_PLACEHOLDER +socket = /run/uwsgi/WEB2PY_APP_PLACEHOLDER.sock +chown-socket = USERNAME_PLACEHOLDER:nginx +chmod-socket = 660 +vacuum = true +' >/etc/uwsgi/sites/$WEB2PY_APP.ini + +sed -i "s@WEB2PY_PATH_PLACEHOLDER@$WEB2PY_PATH@" /etc/uwsgi/sites/$WEB2PY_APP.ini +sed -i "s@WEB2PY_APP_PLACEHOLDER@$WEB2PY_APP@" /etc/uwsgi/sites/$WEB2PY_APP.ini +sed -i "s@USERNAME_PLACEHOLDER@$USERNAME@" /etc/uwsgi/sites/$WEB2PY_APP.ini + +# Create a daemon configuration file for uwsgi +cat > /etc/systemd/system/uwsgi.service < /etc/nginx/nginx.conf <