[web2py] what is the best practice for importing modules in a module?

2019-02-02 Thread Yi Liu
Dear fellow users,

I have an app with a scheduler, it uses these modules:

import nunumpy as np
import pandas as pd
pd.core.common.is_list_like = pd.api.types.is_list_like
import pandas_datareader as web
import requests
import datetime
from tenacity import retry, stop, wait
import time, os
import sys
import traceback
import plotly.plotly as py
from gluon import *

I used to put them along with about a dozen functions directly in 
scheduler.py. Later I learned that I should not put code in models since it 
will make the app slow. It is indeed slower than other apps on the same 
server.

So I moved them into a module file, which is imported at the beginning of 
scheduler.py

But still the page take 7 sec to load, subsequent  actions are much faster 
once loaded. I compile the app and enabled lazy_tables

My question is:

Are these imports slowing down my app ? Despite that I moved them into a 
module?

Is there a way to speed up this process? 7 secs is too slow.

My index controller function is pretty simple. Is there any other thing I 
should optimize?

My app in question: gapdb.com
My comparing app : trialert.com

Thank you for any help.

Yi


-- 
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.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: fixing .table appears corrupted on a compiled application

2019-02-02 Thread mostwanted
I was able to solve this, i found an old version of the app, after 
installing it i overwrote it with corrupt version, that gave me the option 
to remove the compiled version and i was able to edit the code & fix my 
problem.

On Thursday, January 31, 2019 at 7:08:15 PM UTC+2, mostwanted wrote:
>
> Is it possible, any way possible to fix the *.table appears corrupted *error 
> on a compiled application? if so how can i achieve this?
> I have developed a hotel management application for some clients then 
> suddenly this error appeard* ( File 
> C:\.\web2py\applications\whapp2\databases\c8b669d15150d7109e5f7ab36744a5b7_quotationClient.table
>  
> appears corrupted) *but now i can not access the code because to add 
> *migrate=False,fake_*
> *migrate=True  *to the table! Now they can not access the saved 
> information for all orders made
>
> What can i do Please help!!!
>
> 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.
For more options, visit https://groups.google.com/d/optout.


[web2py] problem with cpdb.py "EXCEPTION: could not set DAL"

2019-02-02 Thread Jon Subscripted
Hi everyone,
I'm trying to copy my database (already populated) using cbpd.py but I get
an error.
(I'm working in Windows 10 with Web2py
2.17.2-stable+timestamp.2018.10.06.18.54.02)

1st I changed the database URI in appconfig.ini from
sqlite://storage.sqlite to sqlite://storage3.sqlite
2nd I checked with SQLite Browser that sqlite://storage3.sqlite was created
and tables are created also (but empty)
3rd I launched the command below, but I does not work.

C:\Users\Jon\Downloads\web2py_winAPPLIANCES\web2py>python scripts/cpdb.py
-f applications/paravolcar10enero_tarde/databases  -y
sqlite://storage.sqlite -Y sqlite://storage3.sqlite -d ../gluon
No handlers could be found for logger "web2py"
WARNING:root:Unable to import plural rules: No module named plural_rules
EXCEPTION: could not set DAL
No module named dal
creating tables...
EXCEPTION: could not make a copy of the database
'NoneType' object is not iterable

Any suggestions? I do not really know how to interpret the error.
Thanks, Jon.

-- 
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.
For more options, visit https://groups.google.com/d/optout.