Thanks, perfect!! It's better.
I have some apps deployed in GAE, with web2py pyhton 2.7. I want to migrate
them to python 3.7, but cannot deploy web2py python 3.7 on GAE. I wonder if
stable version of py4web will take too long or if it is better to try to
find out how to deploy web2py python 3.7 on GAE
El martes, 24 de marzo de 2020, 5:17:40 (UTC+1), Massimo Di Pierro escribió:
>
> There are two problems here:
> 1) you cannot symlink in an action because it must be done once and only
> once.
> 2) You cannot have paths like /_default because they are absolute paths
>
> Assuming this is a linux or OSX machine you should do from the shell
>
> $ rm -rf apps/_default
> $ ln -s apps/myapp apps/_default
>
> You only need to do this once.
>
> On Monday, 23 March 2020 05:01:41 UTC-7, Jacinto Parga wrote:
>>
>> Yes, but I get an error with symlink in __init.py__ of _default:
>>
>> from py4web import action, __version__
>> import os
>>
>> @action("index")
>> @action.uses("index.html")
>> def index():
>> src = "/_default"
>> dst = "/myapp"
>> os.symlink(src, dst)
>> return dict(version=__version__)
>>
>>
>> Error Ticket: [Errno 13] Permission denied: '/_default' -> '/myapp'
>>
>> Traceback (most recent call last):
>> File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 554, in
>> wrapper
>> ret = func(*func_args, **func_kwargs)
>> File "/home/jacinto/PROGRAMACION/py4web/py4web/core.py", line 515, in
>> wrapper
>> ret = func(*args, **kwargs)
>> File "apps/_default/__init__.py", line 10, in index
>> os.symlink(src, dst)
>> PermissionError: [Errno 13] Permission denied: '/_default' -> '/myapp'
>>
>> id 48
>> uuid 8b97b87a-7ec0-4158-bace-e414438f513a
>> app_name _default
>> method GET
>> path /
>> timestamp datetime.datetime(2020, 3, 23, 11, 48, 18)
>> client_ip 127.0.0.1
>> error [Errno 13] Permission denied: '/_default' -> '/myapp'
>> snapshot
>> timestamp 2020-03-23T11:48:18.745672
>> python_version 3.7.5 (default, Nov 20 2019, 09:21:52)
>>
>>
>>
>>
>>
>>
>> El sábado, 21 de marzo de 2020, 8:03:00 (UTC+1), Massimo Di Pierro
>> escribió:
>>>
>>> This is a good solution. One trick is to symlink _default to myapp
>>>
>>> On Monday, 16 March 2020 02:17:56 UTC-7, Jacinto Parga wrote:
>>>>
>>>> Finally solved.
>>>>
>>>> 1. I add an entrypoint to the app.yaml . The app runs fine:
>>>> runtime: python37
>>>> entrypoint: gunicorn -b :8080 -w 2 main:app
>>>>
>>>>
>>>> # Handlers define how to route requests to your application.
>>>> handlers:
>>>>
>>>> - url: /.*
>>>> secure: always
>>>> redirect_http_response_code: 301
>>>> script: auto
>>>>
>>>> 2. I get rid off all the apps but the default app and the app I
>>>> want to deploy in the .gcloudignore:
>>>> # This file specifies files that are *not* uploaded to Google Cloud
>>>> Platform
>>>> # using gcloud. It follows the same syntax as .gitignore, with the
>>>> addition of
>>>> # "#!include" directives (which insert the entries of the given
>>>> .gitignore-style
>>>> # file at that point).
>>>> #
>>>> # For more information, run:
>>>> # $ gcloud topic gcloudignore
>>>> #
>>>> .gcloudignore
>>>> # If you would like to upload your .git directory, .gitignore file
>>>> or files
>>>> # from your .gitignore file, remove the corresponding line
>>>> # below:
>>>> .git
>>>> .gitignore
>>>>
>>>> # Python pycache:
>>>> __pycache__/
>>>> # Ignored by the build system
>>>> /setup.cfg
>>>>
>>>> .travis.yml
>>>> *.pyc
>>>> *.pyo
>>>> *~
>>>> #*
>>>> *.1
>>>> *.bak
>>>> *.bak2
>>>> *.svn
>>>> *.w2p
>>>> *.class
>>>> *.rej
>>>> *.orig
>>>> Thumbs.db
>>>> .DS_Store
>>>> ./deposit
>>>> ./benchmark
>>>> ./build
>>>> ./dist
>>>> ./ssl
>>>> ./docs
>>>> ./logs
>>>> ./*.zip
>>>> # Only ignore the default app and the app we want to deploy
>>>> env/*
>>>> env/
>>>> !apps/*
>>>> apps/todo
>>>> apps/todo/*
>>>> apps/examples
>>>> apps/examples/*
>>>> apps/_dashboard
>>>> apps/_dashboard/*
>>>> apps/_scaffold
>>>> apps/_scaffold/*
>>>> apps/_minimal
>>>> apps/_minimal/*
>>>> !apps/_default
>>>> !apps/_default/*
>>>> !apps/myapp
>>>> !apps/myapp/*
>>>> apps/_documentation/*
>>>> apps/superheroes
>>>> apps/superheroes/*
>>>> apps/myfeed
>>>> apps/myfeed/*
>>>> apps/*/databases/README*
>>>> pps/*/databases/*
>>>> apps/*/uploads/*
>>>> apps/*/*.py[oc]
>>>> packages/
>>>> deployment_tools/*
>>>> deployment_tools/
>>>> tests/*
>>>> tests/
>>>> README.md
>>>> test-requirements.txt
>>>> source-context.json
>>>> password.txt
>>>> py4web-start.py
>>>> setup.py
>>>> Makefile
>>>> So when it is deployed in GAE http://myapp.appspot.com/ goes to
>>>> _default/index.html url
>>>> 3. I modify the __init.py__ file of the _default app to redirect to
>>>> myapp folder:
>>>> from py4web import action, __version__
>>>> from bottle import redirect #get redirect function from bottle
>>>>
>>>> @action("index")
>>>> @action.uses("index.html")
>>>> def index():
>>>> redirect("/myapp") # The former code: return
>>>> dict(version=__version__)
>>>> The result is that http://myapp.appspot.com/ serves
>>>> http://myapp.app.com/myapp
>>>>
>>>> Maybe there is a more elegant way to get it. Any suggestion would be
>>>> appreciated.
>>>>
>>>> Thanks
>>>>
>>>> El martes, 4 de febrero de 2020, 19:46:32 (UTC+1), Jacinto Parga
>>>> escribió:
>>>>>
>>>>> I cannot properly deploy a simple py4web app in GAE. I think it's just
>>>>> a .gcloudignore or a app.yaml configuration issue. The only thing I've
>>>>> got
>>>>> is a not found page.
>>>>>
>>>>> [image: minimal-py4web.png]
>>>>>
>>>>> Some help about how to route the right app in the google app engine?
>>>>>
>>>>> Thanks
>>>>>
>>>>>
>>>>>
>>>>>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/6dc350b2-86f3-4f0e-a5dd-a7f78cf612e4%40googlegroups.com.