Traceback (most recent call last):
  File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
    exec ccode in environment
  File "/home/www-data/web2py/applications/news/controllers/parser.py" 
<https://ec2-52-3-90-0.compute-1.amazonaws.com/admin/default/edit/news/controllers/parser.py>,
 line 108, in <module>
  File "/home/www-data/web2py/gluon/globals.py", line 412, in <lambda>
    self._caller = lambda f: f()
  File "/home/www-data/web2py/gluon/tools.py", line 3769, in f
    return action(*a, **b)
  File "/home/www-data/web2py/gluon/globals.py", line 378, in f
    return rest_action(*_self.args, **getattr(_self, 'vars', {}))
  File "/home/www-data/web2py/applications/news/controllers/parser.py" 
<https://ec2-52-3-90-0.compute-1.amazonaws.com/admin/default/edit/news/controllers/parser.py>,
 line 96, in GET
    sources = [Source.from_key(key) for key in command.split('_')]
  File "applications/news/modules/domain/source.py", line 154, in from_key
    source = db(db.source.key == key).select().first()
  File "/home/www-data/web2py/gluon/packages/dal/pydal/objects.py", line 2026, 
in select
    return adapter.select(self.query,fields,attributes)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1239, in select
    return self._select_aux(sql,fields,attributes)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1204, in _select_aux
    self.execute(sql)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1326, in execute
    return self.log_execute(*a, **b)
  File "/home/www-data/web2py/gluon/packages/dal/pydal/adapters/base.py", line 
1311, in log_execute
    if not self.connection: raise ValueError(a[0])
ValueError: SELECT  source.id, source.name, source.key, source.payload, 
source.type_id, source.category_id FROM source WHERE (source.key = 'etsddst');


I don't know if it's just me but I don't understand this error. It only 
emerge when in production running with Apache and mod_wsgi. Locally, on 
developement, it's working just fine. The same db(db.source.key == 
key).select().first(). It is linked to the same database and no migrations 
are enabled. I'll paste here the DAL() def and the Source table def:

AUTH_DATABASE_USERNAME = os.getenv("AUTH_DATABASE_USERNAME")
AUTH_DATABASE_URL = os.getenv("AUTH_DATABASE_URL")
AUTH_DATABASE_PASSWORD = os.getenv("AUTH_DATABASE_PASSWORD")
AUTH_DATABASE_NAME = os.getenv("AUTH_DATABASE_NAME")

db = DAL('postgres://{username}:{password}@{database_url}/{name}'.format(
    username=AUTH_DATABASE_USERNAME,
    password=AUTH_DATABASE_PASSWORD,
    database_url=AUTH_DATABASE_URL,
    name='news'
), migrate_enabled=False, lazy_tables=True)

auth_db = DAL('postgres://{username}:{password}@{database_url}/{name}'.format(
    username=AUTH_DATABASE_USERNAME,
    password=AUTH_DATABASE_PASSWORD,
    database_url=AUTH_DATABASE_URL,
    name=AUTH_DATABASE_NAME
), migrate_enabled=False)

auth = Auth(auth_db)
auth.define_tables(username=True, signature=False)

auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
response.generic_patterns = ['*']


db.define_table(
    'source',
    Field('name', 'string',
          length=128,
          unique=True,
          notnull=True,
          required=True,
          requires=[IS_NOT_EMPTY(), IS_NOT_IN_DB(db, 'source.name')]),
    Field('key', 'string',
          length=512,
          unique=True,
          requires=IS_NOT_IN_DB(db, 'source.key')),
    Field('payload', 'text',
          notnull=True,
          required=True,
          requires=IS_NOT_EMPTY()),
    Field('type_id', 'reference source_type',
          notnull=True,
          required=True),
    Field('category_id', 'reference category',
          notnull=True,
          required=True)
)


I looked for solutions over the net and here in the group but I can't find 
any solution that fits this 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to