[web2py] Re: Hosting my web2py application

2020-10-27 Thread jonatha...@whatho.net
Do you want instructions on how to set up and run a server (Linux, 
Windows?) on your home premises?
Instructions on how to install web2py on such a server?
Instructions on how to provide access to web browsers out on the internet 
(e.g. setting up IP addresses on which the server can be contacted?)

These are big topics which (I would suggest) are outside the scope of this 
group, and might require a fair bit of research. Also there are lots of 
options depending on your requirements. None of it's specially difficult 
but most of it is not specific to web2py.


On Tuesday, 27 October 2020 at 15:44:30 UTC mostwanted wrote:

> How do I setup a private home server to host my web2py application? What 
> do i need & how do i put it together? If anyone has done it before please 
> share the process or direct me to where I can find the information.
>
> Regards;
>
> Mostwanted
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/ca1b4870-e100-4a35-9aee-2c1a49163f30n%40googlegroups.com.


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Eliezer (Vlad) Tseytkin
Got it,
Thank you!

On Tue, Oct 27, 2020, 3:57 PM Val K  wrote:

> It seems PA doesnt support low-level-IP-blocking
> https://www.pythonanywhere.com/forums/topic/8212/
> So you have to use db.py as Chris mentioned (or something like
> *_block_list.py* in models dir - file name should be top most
> alphabetical)
> Also you can modify PA-starting script to catch bad-IP before passing
> request to web2py, but in this case you have to restart server after each
> change.
>
>
>
>
> вт, 27 окт. 2020 г. в 20:45, Eliezer (Vlad) Tseytkin <
> westgate6...@gmail.com>:
>
>> I see... Could you please give me a hint on where to find how to
>> accomplish this in nginx? (I use PythonAnywhere)
>>
>> On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com 
>> wrote:
>>
>>> It is better to do this at front server like nginx, Apache or even at
>>> os-level. In web2py, models files are processed for each request, so you
>>> can just raise HTTP at db.py
>>>
>>> вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
>>>
 I've discovered that my site is constantly bothered by weird locations
 - not that there is anything  intrinsically  wrong with those countries,
 but those locations have nothing to do with actual customers. I want to
 reject the requests from those locations altogether.

 I can reject any specific page in controller code, but how do I reject
 ANY request altogether, without coding it into multiple places?

>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> web2py+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
>>> 
>>> .
>>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com
>> 
>> .
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAM94u4-roMZUNNg95Q%2BF13p5QgmEde11RXZq34tPYUz0piX39Q%40mail.gmail.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCDbkpXAVyrtM1H-dvP0_hVQxV7dmEPrw7tzxxq-vDg8nA%40mail.gmail.com.


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Val K
It seems PA doesnt support low-level-IP-blocking
https://www.pythonanywhere.com/forums/topic/8212/
So you have to use db.py as Chris mentioned (or something like
*_block_list.py* in models dir - file name should be top most alphabetical)
Also you can modify PA-starting script to catch bad-IP before passing
request to web2py, but in this case you have to restart server after each
change.




вт, 27 окт. 2020 г. в 20:45, Eliezer (Vlad) Tseytkin :

> I see... Could you please give me a hint on where to find how to
> accomplish this in nginx? (I use PythonAnywhere)
>
> On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com 
> wrote:
>
>> It is better to do this at front server like nginx, Apache or even at
>> os-level. In web2py, models files are processed for each request, so you
>> can just raise HTTP at db.py
>>
>> вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
>>
>>> I've discovered that my site is constantly bothered by weird locations -
>>> not that there is anything  intrinsically  wrong with those countries, but
>>> those locations have nothing to do with actual customers. I want to reject
>>> the requests from those locations altogether.
>>>
>>> I can reject any specific page in controller code, but how do I reject
>>> ANY request altogether, without coding it into multiple places?
>>>
>> --
>> 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 a topic in the
>> Google Groups "web2py-users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
>> 
>> .
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAM94u4-roMZUNNg95Q%2BF13p5QgmEde11RXZq34tPYUz0piX39Q%40mail.gmail.com.


Re: [web2py] Hosting my web2py application

2020-10-27 Thread Chris
Hi, you can check the install script of waf2py and get the part where the 
apache server is installed with web2py. you may need to adjust the paths.
This is for a debian system

https://github.com/ITSec-Chile/Waf2Py/blob/master/installer/waf2py_installer.sh

—
Cheers.
Chris.

> On martes, oct. 27, 2020 at 12:44 p. m., mostwanted  (mailto:godirao...@gmail.com)> wrote:
> How do I setup a private home server to host my web2py application? What do i 
> need & how do i put it together? If anyone has done it before please share 
> the process or direct me to where I can find the information.
>
> Regards;
>
> Mostwanted
> --
> 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 web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/6d1e2e29-a423-43d2-b9fe-1e6cae251f26n%40googlegroups.com
>  
> (https://groups.google.com/d/msgid/web2py/6d1e2e29-a423-43d2-b9fe-1e6cae251f26n%40googlegroups.com?utm_medium=email_source=footer).

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/dbf16672-4ddb-4b8f-ba4d-083b1abb8cf9%40Canary.


signature.asc
Description: PGP signature


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Chris
Hi, here you have some examples:

Web server level

Here there is examples about how to deny an IP and network ranges in nginx, if 
you can modify the nginx.conf file then is easy.
https://www.cyberciti.biz/faq/linux-unix-nginx-access-control-howto/

At OS level.
If you have control of IP tables you can do it there also.
This is how to block an entire subnet:

# iptables -A INPUT -s 192.168.100.0/24 -j DROP

Application level:

In your model (db.py) add the following at the beginning:
Example with multiples ip ranges

if IS_IPV4(minip=('192.168.20.19', '192.168.30.100'),maxip=('192.168.20.19', 
'192.168.30.199'))(request['env']['REMOTE_ADDR'])[1] == None:
raise HTTP(403)

--
Cheers.
Chris.

> On martes, oct. 27, 2020 at 2:45 p. m., Eliezer (Vlad) Tseytkin 
> mailto:westgate6...@gmail.com)> wrote:
> I see... Could you please give me a hint on where to find how to accomplish 
> this in nginx? (I use PythonAnywhere)
> On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com (mailto:valq...@gmail.com) 
> mailto:valq7...@gmail.com)> wrote:
> > It is better to do this at front server like nginx, Apache or even at 
> > os-level. In web2py, models files are processed for each request, so you 
> > can just raise HTTP at db.py
> >
> > вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
> > > I've discovered that my site is constantly bothered by weird locations - 
> > > not that there is anything intrinsically wrong with those countries, but 
> > > those locations have nothing to do with actual customers. I want to 
> > > reject the requests from those locations altogether.
> > >
> > > I can reject any specific page in controller code, but how do I reject 
> > > ANY request altogether, without coding it into multiple places? --
> > 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 a topic in the 
> > Google Groups "web2py-users" group.
> > To unsubscribe from this topic, visit 
> > https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
> > To unsubscribe from this group and all its topics, send an email to 
> > web2py+unsubscr...@googlegroups.com 
> > (mailto:web2py+unsubscr...@googlegroups.com).
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
> >  
> > (https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com?utm_medium=email_source=footer).
> --
> 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 web2py+unsubscr...@googlegroups.com 
> (mailto:web2py+unsubscr...@googlegroups.com).
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com
>  
> (https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com?utm_medium=email_source=footer).

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7d747bbc-1bc2-4161-81a3-684c39da7886%40Canary.


signature.asc
Description: PGP signature


[web2py] Appadmin to Welcome app?

2020-10-27 Thread Gaël Princivalle
Hello.

I'm still trying to migrate my apps from Webfaction to Opalstack.
Migrating Web2py apps is not so easy...
I've 3 apps, 2 are now ok.

Using the same steps I'm unable to migrate the third one.
When I click on the appadmin button for checking the DB records, or when I 
try to display the app, I've got always the welcome app.
Of course without ticket, so I cannot know what's the problem.

Someone knows what can be the problem?

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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/052e22bb-3b89-43c1-a5ed-43dd76246a46n%40googlegroups.com.


Re: [web2py] Re: How to reject request based on location

2020-10-27 Thread Eliezer (Vlad) Tseytkin
I see... Could you please give me a hint on where to find how to accomplish
this in nginx? (I use PythonAnywhere)

On Tue, Oct 27, 2020 at 1:15 AM valq...@gmail.com 
wrote:

> It is better to do this at front server like nginx, Apache or even at
> os-level. In web2py, models files are processed for each request, so you
> can just raise HTTP at db.py
>
> вторник, 27 октября 2020 г. в 04:52:57 UTC+3, Vlad:
>
>> I've discovered that my site is constantly bothered by weird locations -
>> not that there is anything  intrinsically  wrong with those countries, but
>> those locations have nothing to do with actual customers. I want to reject
>> the requests from those locations altogether.
>>
>> I can reject any specific page in controller code, but how do I reject
>> ANY request altogether, without coding it into multiple places?
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/af2Ct41wEE0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/36ef2c26-b63f-48f1-b032-51f4774171c6n%40googlegroups.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CABZ%2BKCCmiak3RNNqhWxDmy0YCuutZS5z3FU9QbQLUnDCcBO91w%40mail.gmail.com.


[web2py] Hosting my web2py application

2020-10-27 Thread mostwanted
How do I setup a private home server to host my web2py application? What do 
i need & how do i put it together? If anyone has done it before please 
share the process or direct me to where I can find the information.

Regards;

Mostwanted

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/6d1e2e29-a423-43d2-b9fe-1e6cae251f26n%40googlegroups.com.


Re: [web2py] Re: Migrate a PostgreSQL Webfaction DB to Opalstack

2020-10-27 Thread Jose C
On Tuesday, 27 October 2020 at 14:35:23 UTC Ramos wrote:

> rsync is awesome :) 
> thank you
>

Yes, a very nifty little utility... and if you backup to any cloud 
providers, then check out rclone as well (built on 
rsync).

  

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/99e7143a-8c53-41d0-9b62-da7387ffn%40googlegroups.com.


Re: [web2py] Re: Migrate a PostgreSQL Webfaction DB to Opalstack

2020-10-27 Thread António Ramos
rsync is awesome :)
thank you


Em ter., 27 de out. de 2020 às 13:00, Jose C 
escreveu:

> Opalstack have some migration tools available:
> https://community.opalstack.com/d/155-howto-migrate-stuff-automatically-from-webfaction
>
> Also I found my old notes from when I moved my web2py apps and PG
> databases over 18 months ago, hopefully they will help.  Also includes how
> to sync images directories between servers...
>
>
> 1) sync photos directories between WF and OS:
>
> rsync -avh --dry-run   @web565.webfaction.com:
> /home//virtenvs//lib/web2py/applications/
> /static/photos/home//virtenvs//lib/web2py/
> applications//static  > results_photos.txt
>
> logs what would happen to the results_photos.txt file.
>
> When ready to execute, remove the --dry-run parameter above.
>
> 2) on WF server:
> pg_dump -U  -d  -h localhost -p  -f
> re_livedump.sql
> gzip re_livedump.sql
>
>
> 3) copy to OS server and gunzip the file on the server.
>
> 4) ensure web2py server is not running (remember to comment out crontab
> autostart line as well)
> delete contents of the web2py/applications//databases directory.
>
> 5) on OS server, go into psql and remove existing tables, etc. if they
> exist:
> psql -U  -d 
> DROP OWNED BY ;
>
> 6) load new database
> psql -U  -d  -f re_livedump.sql
>
> there may be a few error messages about the owner being different, safe
> to ignore.
>
> 7) set web2py DAL flags:
> migrate=True
> fake_migrate=True
> lazy_tables=False
>
> 8) start up web2py.  Verify all table files created in the databases
> directory.
>
> 9) shutdown web2py and set the above flags to their inverses.  Also
> uncomment the crontab autostart line.
>
> 10) startup again and verify site is working as expected.  An option is
> to mount your new OS web2py app on a temp domain, sub-domain or even on
> .opalstacked.com for testing.
>
>
> HTH,
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/a7031961-424b-46c7-9c3a-4b1a02ca46f1o%40googlegroups.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxN%3DjOZJrYHAZDZFAQkH0fH5rx%2B-ARhj1ybHOxiz8UVcdA%40mail.gmail.com.


Re: [web2py] On Windows I am trying to delete an application that uses logging but the delete fails because the log file is "in use"

2020-10-27 Thread Davidiam
It looks like it uses one handler although the logger rotates the actual 
log files.  I think that I would need to shut down the logger before or at 
the beginning of the uninstall step, but as the "uninstall application" is 
run from the admin app, it would be a bit tricky to implement the shutdown 
for a specific application in the admin application code.  If there was an 
app.shutdown() method maybe

For the moment I am first shutting down the application pool in IIS and 
then deleting the app but I would prefer a coded solution.  We son't delete 
applications aften, so the work-around is acceptable for the moment.

On Tuesday, October 27, 2020 at 4:23:09 AM UTC+1 roge...@gmail.com wrote:

> Ah, i see. Can you temporarily shutdown() the logger and then restart it 
> when the uninstall is complete? Or does it need to stay running also? I 
> think it is possible to close a specific handler as well - but i dont know 
> how the logging works in web2py - maybe there is a single handler for all 
> the apps (if you can't tell, i have never used it before :)
>
>
> ___
> *www.TenOutOfTen.org* 
> roge...@gmail.com
> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>
>
> On Mon, 26 Oct 2020 at 23:37, Davidiam  wrote:
>
>> Thank you for your reply,  
>> Deleting the application folder gives the same error.  
>> The problem is that the logger holds the log file locked.  If I restart 
>> the webserver I can delete the file, but our developers can't restart web 
>> services.
>> It is not a big problem but I would like to find a solution (if one 
>> exists)..
>>
>> On Monday, October 26, 2020 at 4:56:30 AM UTC+1 roge...@gmail.com wrote:
>>
>>> Hi David
>>>
>>> I am not sure that i have ever used the Uninstall option. I just delete 
>>> the application folder and the application disappears. I am not sure if 
>>> that leaves any residual information in files somewhere. But i have not 
>>> noticed a problem.
>>>
>>> Does that work for you?
>>> Andrew
>>>
>>> ___
>>> *www.TenOutOfTen.org* 
>>> roge...@gmail.com
>>> (+95) 09 250018669 <+95%209%20250%20018%20669> (Myanmar)
>>>
>>>
>>>
>>> On Fri, 23 Oct 2020 at 17:07, Davidiam  wrote:
>>>
 When using logging in web2py on Windows, we are unable to delete 
 applications unless we first stop the server.

 The reason is that the app.log is considered "in use".

 As the uninstall happens from the admin app, I am not quite sure how 
 best to stop the logger in the application that is being uninstalled when 
 the "Uninstall" option is selected from admin.  

 Anyone have any ideas on how to unistall an app that uses logging.  
 Apparently this is only an issue on Windows because the os.unlink works on 
 "in use" files on linux systems.

 Note : We have defined the location of the log files within the 
 application directory structure so that the developers have access to the 
 files.

 This is the logging code used :
 def get_configured_logger(name):
 Test = False
 logger = logging.getLogger(name)
 if (len(logger.handlers) == 0):
 # This logger has no handlers, so we can assume it hasn't yet been 
 configured
 # (Configure logger)

 # Create default handler
 if request.env.web2py_runtime_gae:
 # Create GAEHandler
 handler = GAEHandler()
 else:
 # Create RotatingFileHandler
 import os
 formatter="%(asctime)s %(levelname)s %(process)s %(thread)s 
 %(funcName)s():%   (lineno)d %(message)s"
 handler = 
 logging.handlers.RotatingFileHandler(os.path.join(request.folder,
 'private/app.log'), maxBytes=100,backupCount=2)
 handler.setFormatter(logging.Formatter(formatter))

 handler.setLevel(logging.DEBUG)

 logger.addHandler(handler)
 logger.setLevel(logging.DEBUG)

 # Test entry:

 if Test == True:
 logger.debug(name + ' logger created')
 else:
 # Test entry:
 if Test == True:
 logger.debug(name + ' already exists')

 return logger

 -- 
 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 web2py+un...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/c9b3c32c-6cfc-4b5f-9894-a62d16898ea5n%40googlegroups.com
  
 

[web2py] Re: Migrate a PostgreSQL Webfaction DB to Opalstack

2020-10-27 Thread Jose C
Opalstack have some migration tools available: 
https://community.opalstack.com/d/155-howto-migrate-stuff-automatically-from-webfaction

Also I found my old notes from when I moved my web2py apps and PG databases 
over 18 months ago, hopefully they will help.  Also includes how to sync 
images directories between servers...


1) sync photos directories between WF and OS:

rsync -avh --dry-run   @web565.webfaction.com:/home//
virtenvs//lib/web2py/applications//static/photos/home
//virtenvs//lib/web2py/applications//static 
 > results_photos.txt

logs what would happen to the results_photos.txt file.

When ready to execute, remove the --dry-run parameter above.

2) on WF server:
pg_dump -U  -d  -h localhost -p  -f 
re_livedump.sql
gzip re_livedump.sql


3) copy to OS server and gunzip the file on the server.

4) ensure web2py server is not running (remember to comment out crontab 
autostart line as well) 
delete contents of the web2py/applications//databases directory.

5) on OS server, go into psql and remove existing tables, etc. if they exist
:
psql -U  -d 
DROP OWNED BY ;

6) load new database
psql -U  -d  -f re_livedump.sql

there may be a few error messages about the owner being different, safe to 
ignore.

7) set web2py DAL flags:
migrate=True
fake_migrate=True
lazy_tables=False

8) start up web2py.  Verify all table files created in the databases 
directory.

9) shutdown web2py and set the above flags to their inverses.  Also 
uncomment the crontab autostart line.

10) startup again and verify site is working as expected.  An option is to 
mount your new OS web2py app on a temp domain, sub-domain or even on 
.opalstacked.com for testing.


HTH,

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/a7031961-424b-46c7-9c3a-4b1a02ca46f1o%40googlegroups.com.