[web2py] Re: Problem with web2py on Heroku

2014-06-19 Thread Zakariya Dehlawi
I'm having the same issue. I only have one DB associated with my Heroku 
account, and it's properly being set in get_db(), as it shows up in the 
stack trace. Heroku says that the DB has no tables in it.

I was curious to see if perhaps there were leftover .table files in the 
filesystem when I was using sqlite. However, I looked through and did not 
find any, nor was there a database folder.

Unfortunately with the free tier of the Postgresql addon I haven't figured 
out how to see the Postgresql error logs. The command you're supposed to 
use, "heroku logs -p postgres", always comes back empty for me.

This is basically a critical show stopper for me, and I have no idea how to 
work around it.

Thank you,
Zak

On Thursday, March 13, 2014 3:10:49 PM UTC-7, Massimo Di Pierro wrote:
>
> web2py stores metadata about DB tables which have been created. This is 
> necessary for migrations. Normally this metadata is store in *.table files. 
> Heroku has a strange filesystem that gets wiped up at random times. For 
> this reason the *.table files are not in the "normal filesystem". Web2py 
> creates a filesystem in database in a table called "web2py_filesystem" and 
> stores the *.table files in there.
>
> One possible cause of problems is that heroku can have more than one 
> database. When you connect with web2py you need to specify which one. For 
> example:
>
> db = get_db('HEROKU_POSTGRESQL_YELLOW_URL').
>
> If you do not specify web2py may pick up the wrong one.
>
> Massimo
>
> On Thursday, 13 March 2014 10:40:59 UTC-5, Chris DeGroot wrote:
>>
>> I am looking again at the Heroku logs, specifically the line
>>
>> ERROR:web2py.dal:Could not retrieve applications/CaeSuite/databases/
>> 9e6a7c1bb77d791a89631de258057aed_web2py_session_CaeSuite.table
>>
>> Why is it looking for a file in */databases? 
>>
>> Chris
>>
>> On Thursday, March 13, 2014 10:14:32 AM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Is this is a problem that worked before and then stopped working? Have 
>>> you changed anything on the database side? Do you have data that you need 
>>> to recovered.
>>>
>>> If at all an option, try delete the database and make a new one. 
>>>
>>> Somehow there is a problem with the web2py_filesystem table where 
>>> web2py stores metadata on platforms that lack a persistent filesystem. This 
>>> an be recovered but it is complicated to explain without direct access to 
>>> the system. It really depends on how it got there and what is in there.
>>>
>>> Massimo
>>>
>>>
>>> On Wednesday, 12 March 2014 17:53:08 UTC-5, Chris DeGroot wrote:

 Hello;

 I have tried everything I could think of to solve this problem, but I 
 just can't find a solution.  I am trying to deploy my application to 
 Heroku, following the instructions in the web2py manual.  The welcome app 
 works fine, so I think generally I have deployed the app properly.  The 
 application works on my local machine.  The error I am getting looks like 
 this:

 Traceback (most recent call last):
   File "/app/web2py/gluon/restricted.py", line 217, in restricted
 exec ccode in environment
   File "/app/web2py/applications/CaeSuite/models/db.py" 
 ,
  line 16, in 
 db = get_db(name=None, pool_size=10)
   File "/app/web2py/gluon/contrib/heroku.py", line 26, in get_db
 current.session.connect(current.request, current.response, db=db)
   File "/app/web2py/gluon/globals.py", line 869, in connect
 migrate=table_migrate,
   File "/app/web2py/gluon/dal.py", line 8223, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
   File "/app/web2py/gluon/dal.py", line 8260, in lazy_define_table
 polymodel=polymodel)
   File "/app/web2py/gluon/dal.py", line 1102, in create_table
 query), table)
   File "/app/web2py/gluon/dal.py", line 850, in log
 logfile = self.file_open(table._loggername, 'a')
   File "/app/web2py/gluon/dal.py", line 4578, in file_open
 return DatabaseStoredFile(self.db,filename,mode)
   File "/app/web2py/gluon/dal.py", line 4506, in __init__
 self.db.executesql(sql)
   File "/app/web2py/gluon/dal.py", line 8433, in executesql
 adapter.execute(query)
   File "/app/web2py/gluon/dal.py", line 1969, in execute
 return self.log_execute(*a, **b)
   File "/app/web2py/gluon/dal.py", line 1963, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
 InternalError: current transaction is aborted, commands ignored until end 
 of transaction block

 Variablesself.cursor.execute>>> psycopg2._psycopg.cursor 
 object>self>>> object>self.cursorb{}a('CREATE 
 TABLE IF NOT EXISTS web2py_filesystem (path VARCHAR(255), content TEXT, 
 PRIMARY KEY(path));',)retundefinedcommand'CREATE TABLE IF NOT EXISTS 
 web2py_filesystem (path VARCHAR(

[web2py] Re: Problem with web2py on Heroku

2014-08-11 Thread Zakariya Dehlawi
So I did find a workaround. However, I've switched over to PythonAnywhere, 
much more seamless to my workflow for Python projects.

The workaround, if I recall correctly, was that I had to use a one-off 
dynamo to connect to the DB, and manually created the necessary tables 
based on the Web2Py source code. The most important being the "filesystem" 
table. I don't remember exactly what I did, as it was a while ago.

On Monday, August 4, 2014 12:19:25 PM UTC-7, Louis Amon wrote:
>
> Has anyone found a solution to this ?
>
> I just tried deploying on Heroku today and had the exact same problem.
>
> Heroku logs :
>
> 2014-08-04T19:12:36.276606+00:00 app[web.1]:   File "/app/gluon/dal.py", 
> line 4560, in exists
>
> 2014-08-04T19:12:36.276608+00:00 app[web.1]: if db.executesql(query):
>
> 2014-08-04T19:12:36.276612+00:00 app[web.1]:   File "/app/gluon/dal.py", 
> line 1969, in execute
>
> 2014-08-04T19:12:36.276574+00:00 app[web.1]: ERROR:web2py.dal:Could not 
> retrieve applications/jestocke/databases/
> d3136d7e8c7d9a81c4da148ca6f4d239_web2py_session_jestocke.table
>
> 2014-08-04T19:12:36.276616+00:00 app[web.1]: ProgrammingError: relation 
> "web2py_filesystem" does not exist
>
> 2014-08-04T19:12:36.276613+00:00 app[web.1]: return self.log_execute(*
> a, **b)
>
> 2014-08-04T19:12:36.276619+00:00 app[web.1]:  ^
>
> 2014-08-04T19:12:36.276579+00:00 app[web.1]: Traceback (most recent call 
> last):
>
> 2014-08-04T19:12:36.276614+00:00 app[web.1]:   File "/app/gluon/dal.py", 
> line 1963, in log_execute
>
> 2014-08-04T19:12:36.276615+00:00 app[web.1]: ret = self.cursor.execute
> (command, *a[1:], **b)
>
> 2014-08-04T19:12:36.276609+00:00 app[web.1]:   File "/app/gluon/dal.py", 
> line 8433, in executesql
>
> 2014-08-04T19:12:36.276618+00:00 app[web.1]: LINE 1: SELECT path FROM 
> web2py_filesystem WHERE path='applications/...
>
> 2014-08-04T19:12:36.276610+00:00 app[web.1]: adapter.execute(query)
>
>
>
>
> On Thursday, June 19, 2014 5:04:36 AM UTC+2, Zakariya Dehlawi wrote:
>
> I'm having the same issue. I only have one DB associated with my Heroku 
> account, and it's properly being set in get_db(), as it shows up in the 
> stack trace. Heroku says that the DB has no tables in it.
>
> I was curious to see if perhaps there were leftover .table files in the 
> filesystem when I was using sqlite. However, I looked through and did not 
> find any, nor was there a database folder.
>
> Unfortunately with the free tier of the Postgresql addon I haven't figured 
> out how to see the Postgresql error logs. The command you're supposed to 
> use, "heroku logs -p postgres", always comes back empty for me.
>
> This is basically a critical show stopper for me, and I have no idea how 
> to work around it.
>
> Thank you,
> Zak
>
> On Thursday, March 13, 2014 3:10:49 PM UTC-7, Massimo Di Pierro wrote:
>
> web2py stores metadata about DB tables which have been created. This is 
> necessary for migrations. Normally this metadata is store in *.table files. 
> Heroku has a strange filesystem that gets wiped up at random times. For 
> this reason the *.table files are not in the "normal filesystem". Web2py 
> creates a filesystem in database in a table called "web2py_filesystem" and 
> stores the *.table files in there.
>
> One possible cause of problems is that heroku can have more than one 
> database. When you connect with web2py you need to specify which one. For 
> example:
>
> db = get_db('HEROKU_POSTGRESQL_YELLOW_URL').
>
> If you do not specify web2py may pick up the wrong one.
>
> Massimo
>
> On Thursday, 13 March 2014 10:40:59 UTC-5, Chris DeGroot wrote:
>
> I am looking again at the Heroku logs, specifically the line
>
> ERROR:web2py.dal:Could not retrieve applications/CaeSuite/databases/
> 9e6a7c1bb77d791a89631de258057aed_web2py_session_CaeSuite.table
>
> Why is it looking for a file in */databases? 
>
> Chris
>
> On Thursday, March 13, 2014 10:14:32 AM UTC-4, Massimo Di Pierro wrote:
>
> Is this is a problem that worked before and then stopped working? Have you 
> changed anything on the database side? Do you have data that you need to 
> recovered.
>
> If at all an option, try delete the database and make a new one. 
>
> Somehow there is a problem with the web2py_filesystem table where web2py 
> stores metadata on platforms that lack a persistent filesystem. This an be 
> recovered but it is complicated to explain without direct access to the 
> system. It really depends on how it got there and what is in there.
>
&