cant execute from terminal web2py modules while in previous version is work 
fine
*step on local machine (terminal)*
python -V
Python 2.7.10
cd
rm -rf ~/web2py/applications/test
cp -R ~/web2py/applications/welcome/ ~/web2py/applications/test
rsync -zavr ~/git/web2py/test ~/web2py/applications/
rsync -zavur ~/git/web2py/test ~/web2py/applications/
python ~/web2py/web2py.py --nogui --no-banner -S test -M -R 
~/web2py/applications/test/modules/test_install.py

*modules/test_install.py*
#!/usr/bin/env python
# coding: utf8
from gluon.contrib.webclient import WebClient
*print "Install" # temporary solution is comment this line but it work fine 
in web2py previous version*
install = WebClient('http://127.0.0.1:8000/test/install/',
postbacks = True)
install.get('index')

*error traceback on localhost*
Traceback (most recent call last):
  File "/Users/MacBookPro/project/python/web2py/gluon/shell.py", line 274, 
in run
    execfile(startfile, _env)
  File 
"/Users/MacBookPro/project/python/web2py/applications/test/modules/test_install.py",
 
line 4
    print "Install"
                  ^
SyntaxError: invalid syntax

tested the same code in docker (https://labs.play-with-docker.com) same 
result but different error traceback
*error traceback on docker*
Traceback (most recent call last):
  File "/home/web2py/web2py/gluon/restricted.py", line 219, in restricted
    exec(ccode, environment)
  File "applications/init/models/db.py", line 36, in <module>
    check_reserved=['all'])
  File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 169, in 
__call__
    obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 474, in 
__init__
    "Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "/home/web2py/web2py/gluon/packages/dal/pydal/base.py", line 454, in 
__init__
    self._adapter = adapter(**kwargs)
  File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/__init__.py", 
line 40, in __call__
    obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 368, in __init__
    super(SQLAdapter, self).__init__(*args, **kwargs)
  File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/base.py", 
line 52, in __init__
    self.reconnect()
  File "/home/web2py/web2py/gluon/packages/dal/pydal/connection.py", line 
152, in reconnect
    self.connection = self.connector()
  File "/home/web2py/web2py/gluon/packages/dal/pydal/adapters/sqlite.py", 
line 42, in connector
    return self.driver.Connection(self.dbpath, **self.driver_args)
OperationalError: unable to open database file

The command '/bin/sh -c python /home/web2py/web2py/web2py.py --nogui 
--no-banner -S init -M 
-R/home/web2py/web2py/applications/init/modules/test_install.py' returned a 
non-zero code: 1

*step on docker (https://labs.play-with-docker.com)*
cat <<EOF > Dockerfile
FROM python:2.7
RUN apt update && \
 apt install -y unzip wget
RUN groupadd -r web2py && \
 useradd -m -r -g web2py web2py
USER web2py
RUN cd /home/web2py/ && \
 wget -c http://web2py.com/examples/static/web2py_src.zip && \
 unzip -o web2py_src.zip && \
 rm -rf /home/web2py/web2py/applications/examples && \
 cp -R /home/web2py/web2py/applications/welcome 
/home/web2py/web2py/applications/init && \
 chmod 755 -R /home/web2py/web2py
COPY . /home/web2py/web2py/applications/init/
RUN python /home/web2py/web2py/web2py.py --nogui --no-banner -S init -M -R 
/home/web2py/web2py/applications/init/modules/test_install.py
EXPOSE 8000
CMD cd ~ && python /home/web2py/web2py/web2py.py --nogui --no-banner -a 'a' 
-i 0.0.0.0 -p 8000
EOF
cat Dockerfile
docker build .
docker images
docker run -p 8000:8000 image_id  

any idea how to make it work in web2py latest version ?
just an idea why not put Dockerfile or docker-compose.yml in 
web2py/scripts/ as a template

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to