Help with error - "<class 'psycopg2.ProgrammingError'> relation "auth_group" does not exist LINE 1:"

1,059 views
Skip to first unread message

Adam Simon

unread,
Mar 10, 2015, 12:37:10 PM3/10/15
to sahan...@googlegroups.com
Any advice for this error? The server is a clean debian install with sahana/web2py setup using the installation and configuration scripts from the sahana wiki.

Thank you!

Adam

Error ticket for "eden"

Ticket ID

127.0.0.1.2015-03-10.12-15-01.4bbba461-33fa-4756-90da-fdf011f915f9

<class 'psycopg2.ProgrammingError'> relation "auth_group" does not exist LINE 1: SELECT auth_group.id, auth_group.uuid FROM auth_group WHERE... ^

Version

web2py™Version 2.9.12-stable+timestamp.2015.02.13.23.31.09
PythonPython 2.7.3: /usr/bin/python (prefix: /usr)

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
Traceback (most recent call last):
File "/home/web2py/gluon/restricted.py", line 226, in restricted
exec ccode in environment
File "/home/web2py/applications/eden/models/00_settings.py", line 244, in <module>
system_roles = auth.get_system_roles()
File "applications/eden/modules/s3/s3aaa.py", line 3110, in get_system_roles
rows = current.db(query).select(gtable.id, gtable.uuid)
File "/home/web2py/gluon/packages/dal/pydal/objects.py", line 2076, in select
return adapter.select(self.query,fields,attributes)
File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1231, in select
return self._select_aux(sql,fields,attributes)
File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1196, in _select_aux
self.execute(sql)
File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1318, in execute
return self.log_execute(*a, **b)
File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1312, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
ProgrammingError: relation "auth_group" does not exist
LINE 1: SELECT auth_group.id, auth_group.uuid FROM auth_group WHERE...
^

Error snapshot help 

<class 'psycopg2.ProgrammingError'>(relation "auth_group" does not exist LINE 1: SELECT auth_group.id, auth_group.uuid FROM auth_group WHERE... ^ )

inspect attributes

Frames

  • File /home/web2py/gluon/restricted.py in restricted at line 226 code arguments variables

  • File /home/web2py/applications/eden/models/00_settings.py in <module> at line 244 code arguments variables

  • File /home/web2py/applications/eden/modules/s3/s3aaa.py in get_system_roles at line 3110 code arguments variables

  • File /home/web2py/gluon/packages/dal/pydal/objects.py in select at line 2076 code arguments variables

  • File /home/web2py/gluon/packages/dal/pydal/adapters/base.py in select at line 1231 code arguments variables

  • File /home/web2py/gluon/packages/dal/pydal/adapters/base.py in _select_aux at line 1196 code arguments variables

  • File /home/web2py/gluon/packages/dal/pydal/adapters/base.py in execute at line 1318 code arguments variables

  • File /home/web2py/gluon/packages/dal/pydal/adapters/base.py in log_execute at line 1312 code arguments variables

    Function argument list

    (self=<pydal.adapters.postgres.PostgreSQLAdapter object>, *a=("SELECT auth_group.id, auth_group.uuid FROM auth...MIN','ADMIN','ORG_ADMIN','EDITOR','ANONYMOUS')));",), **b={})

    Code listing
    1307.
    1308.
    1309.
    1310.
    1311.
    1312.

    1313.
    1314.
    1315.
    1316.
                command = self.filter_sql_command(command)
    if self.db._debug:
    self.db.logger.debug('SQL: %s' % command)
    self.db._lastsql = command
    t0 = time.time()
    ret self.cursor.execute(command, *a[1:], **b)

    self.db._timings.append((command,time.time()-t0))
    del self.db._timings[:-TIMINGSSIZE]
    return ret
    Variables
    a("SELECT auth_group.id, auth_group.uuid FROM auth...MIN','ADMIN','ORG_ADMIN','EDITOR','ANONYMOUS')));",)
    b{}
    self<pydal.adapters.postgres.PostgreSQLAdapter object>
    retundefined
    self.cursor<cursor object at 0x43e3ed8; closed: 0>
    command"SELECT auth_group.id, auth_group.uuid FROM auth...MIN','ADMIN','ORG_ADMIN','EDITOR','ANONYMOUS')));"
    self.cursor.execute<built-in method execute of psycopg2._psycopg.cursor object>

In file: /home/web2py/applications/eden/models/00_settings.py

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
215.
216.
217.
218.
219.
220.
221.
222.
223.
224.
225.
226.
227.
228.
229.
230.
231.
232.
233.
234.
235.
236.
237.
238.
239.
240.
241.
242.
243.
244.
245.
246.
247.
248.
249.
250.
251.
252.
253.
254.
255.
256.
257.
258.
259.
260.
261.
262.
263.
264.
265.
266.
267.
268.
269.
270.
271.
272.
273.
274.
275.
276.
277.
278.
279.
280.
281.
282.
283.
284.
285.
286.
287.
288.
289.
290.
291.
292.
293.
294.
295.
296.
297.
298.
299.
300.
301.
302.
303.
304.
305.
306.
307.
308.
309.
310.
311.
312.
313.
314.
# -*- coding: utf-8 -*-

"""
Global settings:

Those which are typically edited during a deployment are in
000_config.py & their results parsed into here. Deployers
shouldn't typically need to edit any settings here.
"""

# Keep all our configuration options off the main global variables

# Use response.s3 for one-off variables which are visible in views without explicit passing
s3.formats = Storage()

# Workaround for this Bug in Selenium with FF4:
# http://code.google.com/p/selenium/issues/detail?id=1604
s3.interactive = settings.get_ui_confirm()

s3.base_url = "%s/%s" % (settings.get_base_public_url(),
appname)
s3.download_url = "%s/default/download" % s3.base_url

# -----------------------------------------------------------------------------
# Client tests

# Check whether browser is Mobile & store result in session
# - commented-out until we make use of it
#if session.s3.mobile is None:
# session.s3.mobile = s3base.s3_is_mobile_client(request)
#if session.s3.browser is None:
# session.s3.browser = s3base.s3_populate_browser_compatibility(request)

# -----------------------------------------------------------------------------
# Global variables

# Strings to i18n
# Common Labels
#messages["BREADCRUMB"] = ">> "
messages["UNKNOWN_OPT"] = "Unknown"
messages["NONE"] = "-"
messages["READ"] = settings.get_ui_label_read()
messages["UPDATE"] = settings.get_ui_label_update()
messages["DELETE"] = "Delete"
messages["COPY"] = "Copy"
messages["NOT_APPLICABLE"] = "N/A"
messages["ADD_PERSON"] = "Create a Person"
messages["ADD_LOCATION"] = "Create Location"
messages["SELECT_LOCATION"] = "Select a location"
messages["COUNTRY"] = "Country"
messages["ORGANISATION"] = "Organization"
messages["AUTOCOMPLETE_HELP"] = "Enter some characters to bring up a list of possible matches"

for u in messages:
if isinstance(messages[u], str):
globals()[u] = T(messages[u])

# CRUD Labels
s3.crud_labels = Storage(READ=READ,
UPDATE=UPDATE,
DELETE=DELETE,
COPY=COPY,
NONE=NONE,
)

# Error Messages
ERROR["BAD_RECORD"] = "Record not found!"
ERROR["BAD_METHOD"] = "Unsupported method!"
ERROR["BAD_FORMAT"] = "Unsupported data format!"
ERROR["BAD_REQUEST"] = "Invalid request"
ERROR["BAD_SOURCE"] = "Invalid source"
ERROR["BAD_TEMPLATE"] = "XSLT stylesheet not found"
ERROR["BAD_RESOURCE"] = "Nonexistent or invalid resource"
ERROR["DATA_IMPORT_ERROR"] = "Data import error"
ERROR["INTEGRITY_ERROR"] = "Integrity error: record can not be deleted while it is referenced by other records"
ERROR["METHOD_DISABLED"] = "Method disabled"
ERROR["NO_MATCH"] = "No matching element found in the data source"
ERROR["NOT_IMPLEMENTED"] = "Not implemented"
ERROR["NOT_PERMITTED"] = "Operation not permitted"
ERROR["PARSE_ERROR"] = "XML parse error"
ERROR["TRANSFORMATION_ERROR"] = "XSLT transformation error"
ERROR["UNAUTHORISED"] = "Not Authorized"
ERROR["VALIDATION_ERROR"] = "Validation error"

# To get included in <HEAD>
s3.stylesheets = []
s3.external_stylesheets = []
# To get included at the end of <BODY>
s3.scripts = []
s3.js_global = []
s3.jquery_ready = []

# -----------------------------------------------------------------------------
# Languages

s3.l10n_languages = settings.get_L10n_languages()

# Default strings are in US English
T.current_languages = ("en", "en-us")
# Check if user has selected a specific language
if get_vars._language:
language = get_vars._language
session.s3.language = language
elif session.s3.language:
# Use the last-selected language
language = session.s3.language
elif auth.is_logged_in():
# Use user preference
language = auth.user.language
else:
# Use system default
language = settings.get_L10n_default_language()
#else:
# # Use what browser requests (default web2py behaviour)
# T.force(T.http_accept_language)

# IE doesn't set request.env.http_accept_language
#if language != "en":
T.force(language)

# Store for views (e.g. Ext)
if language.find("-") == -1:
# Ext peculiarities
if language == "vi":
s3.language = "vn"
elif language == "el":
s3.language = "el_GR"
else:
s3.language = language
else:
lang_parts = language.split("-")
s3.language = "%s_%s" % (lang_parts[0], lang_parts[1].upper())

# List of Languages which use a Right-to-Left script (Arabic, Hebrew, Farsi, Urdu)
if language in ("ar", "prs", "ps", "ur"):
s3.rtl = True
else
:
s3.rtl = False

# -----------------------------------------------------------------------------
# Auth

_settings = auth.settings
_settings.lock_keys = False

_settings.expiration = 28800 # seconds

if settings.get_auth_openid():
# Requires http://pypi.python.org/pypi/python-openid/
try:
from gluon.contrib.login_methods.openid_auth import OpenIDAuth
openid_login_form = OpenIDAuth(auth)
from gluon.contrib.login_methods.extended_login_form import ExtendedLoginForm
extended_login_form = ExtendedLoginForm(auth, openid_login_form,
signals=["oid", "janrain_nonce"])
auth.settings.login_form = extended_login_form
except ImportError:
session.warning = "Library support not available for OpenID"

# Allow use of LDAP accounts for login
# NB Currently this means that change password should be disabled:
#_settings.actions_disabled.append("change_password")
# (NB These are not automatically added to PR or to Authenticated role since they enter via the login() method not register())
#from gluon.contrib.login_methods.ldap_auth import ldap_auth
# Require even alternate login methods to register users 1st
#_settings.alternate_requires_registration = True
# Active Directory
#_settings.login_methods.append(ldap_auth(mode="ad", server="dc.domain.org", base_dn="ou=Users,dc=domain,dc=org"))
# or if not wanting local users at all (no passwords saved within DB):
#_settings.login_methods = [ldap_auth(mode="ad", server="dc.domain.org", base_dn="ou=Users,dc=domain,dc=org")]
# Domino
#_settings.login_methods.append(ldap_auth(mode="domino", server="domino.domain.org"))
# OpenLDAP
#_settings.login_methods.append(ldap_auth(server="directory.sahanafoundation.org", base_dn="ou=users,dc=sahanafoundation,dc=org"))
# Allow use of Email accounts for login
#_settings.login_methods.append(email_auth("smtp.gmail.com:587", "@gmail.com"))

# Require captcha verification for registration
#auth.settings.captcha = RECAPTCHA(request, public_key="PUBLIC_KEY", private_key="PRIVATE_KEY")
# Require Email Verification
_settings.registration_requires_verification = settings.get_auth_registration_requires_verification()
_settings.on_failed_authorization = URL(c="default", f="user",
args="not_authorized")
_settings.reset_password_requires_verification = True
_settings.verify_email_next = URL(c="default", f="index")

# Require Admin approval for self-registered users
_settings.registration_requires_approval = settings.get_auth_registration_requires_approval()

# We don't wish to clutter the groups list with 1 per user.
_settings.create_user_groups = False
# We need to allow basic logins for Webservices
_settings.allow_basic_login = True

_settings.logout_onlogout = s3_auth_on_logout
_settings.login_onaccept = s3_auth_on_login
_settings.login_next = settings.get_auth_login_next()
if settings.has_module("vol") and \
settings.get_auth_registration_volunteer():
_settings.register_next = URL(c="vol", f="person")

# Languages available in User Profiles
if len(s3.l10n_languages) > 1:
_settings.table_user.language.requires = IS_IN_SET(s3.l10n_languages,
zero=None)
else:
field = _settings.table_user.language
field.default = s3.l10n_languages.keys()[0]
field.readable = False
field.writable = False

_settings.lock_keys = True

# -----------------------------------------------------------------------------
# Mail

# These settings could be made configurable as part of the Messaging Module
# - however also need to be used by Auth (order issues)
sender = settings.get_mail_sender()
if sender:
mail.settings.sender = sender
mail.settings.server = settings.get_mail_server()
mail.settings.tls = settings.get_mail_server_tls()
mail_server_login = settings.get_mail_server_login()
if mail_server_login:
mail.settings.login = mail_server_login
# Email settings for registration verification and approval
_settings.mailer = mail

# -----------------------------------------------------------------------------
# Session

# Custom Notifications
response.error = session.error
response.confirmation = session.confirmation
response.information = session.information
response.warning = session.warning
session.error = []
session.confirmation = []
session.information = []
session.warning = []

# Shortcuts for system role IDs, see modules/s3aaa.py/AuthS3
system_roles = auth.get_system_roles()
ADMIN = system_roles.ADMIN
AUTHENTICATED = system_roles.AUTHENTICATED
ANONYMOUS = system_roles.ANONYMOUS
EDITOR = system_roles.EDITOR
MAP_ADMIN = system_roles.MAP_ADMIN
ORG_ADMIN = system_roles.ORG_ADMIN

if s3.debug:
# Add the developer toolbar from modules/s3/s3utils.py
s3.toolbar = s3base.s3_dev_toolbar

# -----------------------------------------------------------------------------
# CRUD

s3_formstyle = settings.get_ui_formstyle()
s3_formstyle_mobile = s3_formstyle
submit_button = T("Save")
_crud = s3.crud
_crud.formstyle = s3_formstyle
_crud.submit_button = submit_button
# Optional class for Submit buttons
#_crud.submit_style = "submit-button"
_crud.confirm_delete = T("Do you really want to delete these records?")
_crud.archive_not_delete = settings.get_security_archive_not_delete()
_crud.navigate_away_confirm = settings.get_ui_navigate_away_confirm()

# Content Type Headers, default is application/xml for XML formats
# and text/x-json for JSON formats, other content types must be
# specified here:
s3.content_type = Storage(
tc = "application/atom+xml", # TableCast feeds
rss = "application/rss+xml", # RSS
georss = "application/rss+xml", # GeoRSS
kml = "application/vnd.google-earth.kml+xml", # KML
)

# JSON Formats
s3.json_formats = ["geojson", "s3json"]

# CSV Formats
s3.csv_formats = ["hrf", "s3csv"]

# Datatables default number of rows per page
s3.ROWSPERPAGE = 20

# Valid Extensions for Image Upload fields
s3.IMAGE_EXTENSIONS = ["png", "PNG", "jpg", "JPG", "jpeg", "JPEG"]

# Default CRUD strings
ADD_RECORD = T("Add Record")
s3.crud_strings = Storage(
label_create = ADD_RECORD,
title_display = T("Record Details"),
title_list = T("Records"),
title_update = T("Edit Record"),
title_map = T("Map"),
title_report = T("Report"),
label_list_button = T("List Records"),
label_delete_button = T("Delete Record"),
msg_record_created = T("Record added"),
msg_record_modified = T("Record updated"),
msg_record_deleted = T("Record deleted"),
msg_list_empty = T("No Records currently available"),
msg_match = T("Matching Records"),
msg_no_match = T("No Matching Records"),
name_nice = T("Record"),
name_nice_plural = T("Records"))

# END =========================================================================

Fran Boon

unread,
Mar 10, 2015, 1:09:24 PM3/10/15
to sahan...@googlegroups.com
This looks like you've not cleaned properly.

Web2Py thinks  the DBstrcture exists (because databases/*.table exist) yet there is an empty DB in Postgres

F


--
You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.
To post to this group, send email to sahan...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sahana-eden/346635e5-c982-4f2e-83ec-fa391f379fbd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adam Simon

unread,
Mar 10, 2015, 1:10:58 PM3/10/15
to sahana-eden
How should I go about cleaning? As I said, I simply ran the install and configure scripts from the wiki...

Thanks for the prompt response!

Best,
Adam

--
You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.

To post to this group, send email to sahan...@googlegroups.com.

Dominic König

unread,
Mar 10, 2015, 1:56:40 PM3/10/15
to sahan...@googlegroups.com
Hi Adam--

standard procedure is:

1) DROP the database and CREATE it new
2) Remove all files in:
databases/ <= this is the critical one!
errors/
sessions/
cache/
upload/

3) Run:
python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py

...from the web2py folder in order to rebuild and pre-populate the database.

IMPORTANT: This removes all (all!) data including user accounts! Don't do this
on a production system unless you know exactly what you're doing!

Dominic
signature.asc

Adam Simon

unread,
Mar 10, 2015, 2:46:59 PM3/10/15
to sahana-eden
Hi Dominic,

Thanks for the prompt response!

I did as instructed - dropped the database and then created it with "sahana" as owner. I cleared out files in those folders in the eden directory. I just tried to run that python web2py.py command and I received this:

root@dpr:/home/web2py# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py 

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Traceback (most recent call last):

  File "/home/web2py/gluon/restricted.py", line 226, in restricted

    exec ccode in environment

  File "applications/eden/models/00_settings.py", line 244, in <module>

    system_roles = auth.get_system_roles()

  File "applications/eden/modules/s3/s3aaa.py", line 3110, in get_system_roles

    rows = current.db(query).select(gtable.id, gtable.uuid)

  File "/home/web2py/gluon/packages/dal/pydal/objects.py", line 2076, in select

    return adapter.select(self.query,fields,attributes)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1231, in select

    return self._select_aux(sql,fields,attributes)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1196, in _select_aux

    self.execute(sql)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1318, in execute

    return self.log_execute(*a, **b)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1312, in log_execute

    ret = self.cursor.execute(command, *a[1:], **b)

ProgrammingError: relation "auth_group" does not exist

LINE 1: SELECT  auth_group.id, auth_group.uuid FROM auth_group WHERE...

                                                    ^



root@dpr:/home/web2py# 


Thoughts?


Adam


--
You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.
To post to this group, send email to sahan...@googlegroups.com.

Adam Simon

unread,
Mar 10, 2015, 2:51:03 PM3/10/15
to sahana-eden
Do I need to set anything in my 000_config.py to make the postgresql database become populated?

Dominic König

unread,
Mar 10, 2015, 3:12:45 PM3/10/15
to sahan...@googlegroups.com
Err...

yes, sorry - should have mentioned it. You must have:

settings.base.migrate = True

in 000_config.py for the whole procedure, otherwise Eden would not create any
tables.

Dominic
signature.asc

Adam Simon

unread,
Mar 10, 2015, 3:22:53 PM3/10/15
to sahana-eden
Still getting the same error....


Adam

--
You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.
To post to this group, send email to sahan...@googlegroups.com.

Adam Simon

unread,
Mar 10, 2015, 3:25:24 PM3/10/15
to sahana-eden
I was able to get it to throw a different error...

root@dpr:/home/web2py# python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py 

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Traceback (most recent call last):

  File "/home/web2py/gluon/restricted.py", line 226, in restricted

    exec ccode in environment

  File "applications/eden/models/00_utils.py", line 84, in <module>

    main = S3MainMenu.menu()

  File "applications/eden/modules/s3menus.py", line 56, in menu

    cls.menu_help(right=True),

  File "applications/eden/modules/s3menus.py", line 161, in menu_help

    table = current.s3db.tour_config

  File "applications/eden/modules/s3/s3model.py", line 159, in __getattr__

    AttributeError("undefined table: %s" % name))

  File "applications/eden/modules/s3/s3model.py", line 224, in table

    model(prefix)

  File "applications/eden/modules/s3/s3model.py", line 103, in __init__

    env = self.model()

  File "applications/eden/modules/s3db/tour.py", line 64, in model

    person_id = self.pr_person_id

  File "applications/eden/modules/s3/s3model.py", line 159, in __getattr__

    AttributeError("undefined table: %s" % name))

  File "applications/eden/modules/s3/s3model.py", line 224, in table

    model(prefix)

  File "applications/eden/modules/s3/s3model.py", line 103, in __init__

    env = self.model()

  File "applications/eden/modules/s3db/pr.py", line 779, in model

    super_link("track_id", "sit_trackable"),

  File "applications/eden/modules/s3/s3model.py", line 989, in super_link

    supertable = cls.table(supertable)

  File "applications/eden/modules/s3/s3model.py", line 224, in table

    model(prefix)

  File "applications/eden/modules/s3/s3model.py", line 103, in __init__

    env = self.model()

  File "applications/eden/modules/s3db/sit.py", line 52, in model

    location_id = self.gis_location_id

  File "applications/eden/modules/s3/s3model.py", line 159, in __getattr__

    AttributeError("undefined table: %s" % name))

  File "applications/eden/modules/s3/s3model.py", line 224, in table

    model(prefix)

  File "applications/eden/modules/s3/s3model.py", line 103, in __init__

    env = self.model()

  File "applications/eden/modules/s3db/gis.py", line 278, in model

    *meta_spatial_fields)

  File "applications/eden/modules/s3/s3model.py", line 361, in define_table

    table = db.define_table(tablename, *fields, **args)

  File "/home/web2py/gluon/packages/dal/pydal/base.py", line 814, in define_table

    table = self.lazy_define_table(tablename,*fields,**args)

  File "/home/web2py/gluon/packages/dal/pydal/base.py", line 851, in lazy_define_table

    polymodel=polymodel)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 463, in create_table

    self.create_sequence_and_triggers(query,table)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/postgres.py", line 86, in create_sequence_and_triggers

    self.execute(query)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1318, in execute

    return self.log_execute(*a, **b)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1312, in log_execute

    ret = self.cursor.execute(command, *a[1:], **b)

ProgrammingError: relation "gis_location" already exists



root@dpr:/home/web2py# 


Hmmm...

Adam

Adam Simon

unread,
Mar 10, 2015, 3:30:24 PM3/10/15
to sahana-eden
BUT - I cleared and confirmed the database was not populated before running the python web2py.py... command. And the folders mentioned were empty.

Fran Boon

unread,
Mar 10, 2015, 3:45:10 PM3/10/15
to sahan...@googlegroups.com
All of this should be handled through the normally installed admin
script 'clean'

/usr/local/bin/clean
> --
> You received this message because you are subscribed to the Google Groups "Sahana-Eden" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sahana-eden...@googlegroups.com.
> To post to this group, send email to sahan...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sahana-eden/475341360.h5ll595UPd%40aldebaran.

Adam Simon

unread,
Mar 10, 2015, 3:47:10 PM3/10/15
to sahana-eden

root@dpr:/home/web2py# cd /usr/local/bin

root@dpr:/usr/local/bin# ls

backup clean  compile migrate  pg1024  pg512 pull  revert  runxlrd.py  uwsgi  w2p

root@dpr:/usr/local/bin# ./clean

Stopping script uwsgi

sudo: parse error in /etc/sudoers near line 16

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

createdb: database creation failed: ERROR:  database "sahana" already exists

psql:/usr/share/postgresql/9.3/extension/postgis--2.1.5.sql:15572: ERROR:  pg_extension_config_dump() can only be called from an SQL script executed by CREATE EXTENSION

sudo: parse error in /etc/sudoers near line 16

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Traceback (most recent call last):

  File "/home/web2py/gluon/restricted.py", line 226, in restricted

    exec ccode in environment

  File "applications/eden/models/00_utils.py", line 84, in <module>

    main = S3MainMenu.menu()

  File "applications/eden/modules/s3menus.py", line 56, in menu

    cls.menu_help(right=True),

  File "applications/eden/modules/s3menus.py", line 173, in menu_help

    table.role,

  File "/home/web2py/gluon/packages/dal/pydal/objects.py", line 2076, in select

    return adapter.select(self.query,fields,attributes)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1231, in select

    return self._select_aux(sql,fields,attributes)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1196, in _select_aux

    self.execute(sql)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1318, in execute

    return self.log_execute(*a, **b)

  File "/home/web2py/gluon/packages/dal/pydal/adapters/base.py", line 1312, in log_execute

    ret = self.cursor.execute(command, *a[1:], **b)

ProgrammingError: relation "tour_config" does not exist

LINE 1: ...ller, tour_config.function, tour_config.role FROM tour_confi...

                                                             ^



Starting uwsgi

[uWSGI] getting INI configuration from /home/web2py/uwsgi.ini

sudo: parse error in /etc/sudoers near line 16

sudo: no valid sudoers sources found, quitting

sudo: unable to initialize policy plugin

root@dpr:/usr/local/bin# 



Thoughts?


THANK YOU!

Adam


You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.

To post to this group, send email to sahan...@googlegroups.com.

Adam Simon

unread,
Mar 10, 2015, 3:51:18 PM3/10/15
to sahana-eden
Fixed the sudoers file... here is the transcript of what happened.

root@dpr:/usr/local/bin# ./clean

Stopping script uwsgi

psql:/usr/share/postgresql/9.3/extension/postgis--2.1.5.sql:15572: ERROR:  pg_extension_config_dump() can only be called from an SQL script executed by CREATE EXTENSION

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Please be patient whilst the database is populated

Pre-populate task completed in 0.86 mins

Location Tree update completed in 0:00:03.484314

Demographic data aggregation completed in 0:00:00.026436

Pre-populate completed in 0.92 mins

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Starting uwsgi

[uWSGI] getting INI configuration from /home/web2py/uwsgi.ini

web2py Web Framework

Created by Massimo Di Pierro, Copyright 2007-2015

Version 2.9.12-stable+timestamp.2015.02.13.23.31.09

Database drivers available: psycopg2, pymysql, imaplib, sqlite3, pg8000, pyodbc

Traceback (most recent call last):

  File "/home/web2py/gluon/shell.py", line 262, in run

    execfile(startfile, _env)

IOError: [Errno 2] No such file or directory: '/home/data/import.py'


root@dpr:/usr/local/bin# service web2py start

[ ok ] Starting Web Framework: web2py.

root@dpr:/usr/local/bin#


Still not working :/


Adam

Dominic König

unread,
Mar 10, 2015, 3:54:34 PM3/10/15
to sahan...@googlegroups.com
Hmm,

it feels that this is leap-frogging a little bit. Let me explain what happens
so that you can understand what you're doing rather than just following
instructions.

FIRST:

Web2py keeps a snapshot of the database structure in the .table files in the
"databases" folder.

If those files do exist, web2py assumes that the corresponding tables in the
database also exist - so if you drop the database but don't remove the .table
files, you will get an error (=relation XYZ does not exist).

The same logic applies the other way around: if the .table files do /not/
exist, then web2py assumes that the corrresponding database tables do not
exist either, and hence would attempt to create them. Consequently, if you
remove the .table files but keep the database, then you will get an error as
well (=relation XYZ already exists).

These are two sides of one and the same medal: a discrepancy between the
.table files and the actual database. All the errors you've been reporting are
all for the same problem.

Hence, you always must remove *both* for a complete clean: the database /and/
the .table files in the /databases folder.

SECOND:

If no tables exist (i.e. neither .table files nor database), then web2py would
create them - but only if you allow a modification of the database. This is
done with the settings.base.migrate=True setting.

If you don't allow this (e.g. the setting is False), web2py would skip this
step and /not/ create any tables. Consequently, any subsequent attempts to
access database tables (any) will run into an error (=relation XYZ does not
exist).

Since the auth_user table is the very first that is read during a request, this
will usually be the error you get: auth_user does not exist.

THIRD:

The /sessions folder contains the session data. When you drop the database,
and create it new, then some of these session data become invalid.

Depending on your browser settings, the browser may attempt to re-connect to a
previous session - but after a DB reset this old session may contain invalid
data, which occassionally triggers errors (it's safe, however - just
confusing).

Hence - when you wipe the database, always also remove the files in sessions to
prevent old sessions from being re-used.

---

These are the three critical things you need to know.

Additionally, it is useful to also restart web2py after cleaning and re-
populating the database (e.g. cleaning the cache which may otherwise still
hold some old query results which are now invalid, and some of them have
rather long expiration times).

We usually use scripts (e.g. "clean") to make sure that we always do /all/ of
these steps. If you do it manually, then it's probably best you understand
what exactly you're doing ;)

Dominic
signature.asc

Adam Simon

unread,
Mar 10, 2015, 3:59:14 PM3/10/15
to sahana-eden
I am rebooting now. I will stop the web2py service. Then try again clearing the database and the databases, etc folders. Could you explain what the python web2py.py.... command you said I should run is going to do? I apologize if this thread is becoming frustrating.

Best,
Adam

Dominic König

unread,
Mar 10, 2015, 4:06:07 PM3/10/15
to sahan...@googlegroups.com
tisdagen den 10 mars 2015 15.50.57 skrev Adam Simon:
> Still not working
No - it is working ;) The last IOError can be ignored.

The database has been rebuild and pre-populated, see:

> Please be patient whilst the database is populated
> Pre-populate task completed in 0.86 mins
> Location Tree update completed in 0:00:03.484314
> Demographic data aggregation completed in 0:00:00.026436
> Pre-populate completed in 0.92 mins

and:

> [ ok ] Starting Web Framework: web2py.

So, this part was successful (and why wouldn't it).

Now, can you access the server after that?

Dominic
signature.asc

Adam Simon

unread,
Mar 10, 2015, 4:08:09 PM3/10/15
to sahana-eden

I can't access the server. It gives me a link to an error ticket but when I click the link I just get another link to a new error ticket over and over. I deleted everything in /home/web2py and am rerunning the install and configure scripts. I also deleted all sahana databases in postgres.

Will update once its complete.

Adam

Sent from my Google Nexus 6

--
You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.
To post to this group, send email to sahan...@googlegroups.com.

Dominic König

unread,
Mar 10, 2015, 4:17:01 PM3/10/15
to sahan...@googlegroups.com
tisdagen den 10 mars 2015 15.58.51 skrev Adam Simon:
> I am rebooting now. I will stop the web2py service. Then try again clearing
> the database and the databases, etc folders. Could you explain what the
> python web2py.py.... command you said I should run is going to do? I
> apologize if this thread is becoming frustrating.
No need to apologize - just maybe better to switch to IRC ;)

The

python web2py.py -S eden -M -R applications/eden/static/scripts/tools/noop.py

command does basically nothing :D

Ok ok - the script itself does nothing (therefore "noop" = "no operation").

However, it still triggers a request cycle - and when Eden processes a request
while the database is still empty, then it will automatically run all the
database initializations and pre-population procedures.

This is the so-called "first run".

You could trigger it with any request, but running noop.py has the advantage
that you get some debug output on the console - which otherwise would end up
in the server log where you would have to dig for it ;)

Dominic
signature.asc

Adam Simon

unread,
Mar 10, 2015, 4:18:38 PM3/10/15
to sahana-eden

Switching to IRC. Can you join?

Adam

Sent from my Google Nexus 6

--
You received this message because you are subscribed to a topic in the Google Groups "Sahana-Eden" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sahana-eden/zrY6cyMr5YY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sahana-eden...@googlegroups.com.
To post to this group, send email to sahan...@googlegroups.com.

Dominic König

unread,
Mar 10, 2015, 4:19:03 PM3/10/15
to sahan...@googlegroups.com
tisdagen den 10 mars 2015 16.08.08 skrev Adam Simon:
> I can't access the server. It gives me a link to an error ticket but when I
> click the link I just get another link to a new error ticket over and over.
This is a file permission problem!

Typically, all of these folders:

/errors
/databases
/uploads
/cache
/sessions

MUST be *writable* by the web server (or the web2py user if you run without
the integrated web server only).

Dominic
signature.asc
Reply all
Reply to author
Forward
0 new messages