Hi all,

I am following the second video tutorial for learning web2py by Mr. 
Massimo, where he teaches to make clone of reddit. But I am stuck at this 
error. Please help me debug it.

Following is the error and my database model:

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File "gluon/restricted.py", line 224, in restricted
  File "C:/Users/Ramashish 
Gaurav/Downloads/web2py_win/web2py/applications/reddit_clone/models/db1.py" 
<http://127.0.0.1:8000/admin/default/edit/reddit_clone/models/db1.py>, line 23, 
in <module>
    auth.signature)
  File "gluon/dal.py", line 8414, in define_table
  File "gluon/dal.py", line 8450, in lazy_define_table
  File "gluon/dal.py", line 1134, in create_table
  File "gluon/dal.py", line 1246, in migrate_table
  File "gluon/dal.py", line 1967, in execute
  File "gluon/dal.py", line 1961, in log_execute
OperationalError: duplicate column name: parent_comm



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.

# -*- coding: utf-8 -*-
db.define_table('category', 
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('name', requires=(IS_SLUG 
<http://127.0.0.1:8000/examples/global/vars/IS_SLUG>(),IS_LOWER 
<http://127.0.0.1:8000/examples/global/vars/IS_LOWER>(), IS_NOT_IN_DB 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_IN_DB>(db,'category.name'))))

db.define_table('post',
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('category', 'reference 
category',writable=False, readable=False),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('title', 
'string',requires=IS_NOT_EMPTY 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
                Field <http://127.0.0.1:8000/examples/global/vars/Field>('url', 
requires=IS_EMPTY_OR 
<http://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR>(IS_URL 
<http://127.0.0.1:8000/examples/global/vars/IS_URL>())),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('body','text',requires=IS_NOT_EMPTY
 <http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('votes', 
'integer',default=0,readable=False, writable=False),
                auth.signature)

db.define_table('vote',
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('post', 'reference post'),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('score', 'integer', default 
= +1),
                auth.signature)

db.define_table('comm',
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('post', 'reference post'),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('parent_comm', 'reference 
comm'),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('votes','integer'),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('body','text'),
                auth.signature)

db.define_table('comm_vote',
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('comm', 'reference comm'),
                Field 
<http://127.0.0.1:8000/examples/global/vars/Field>('score', 'integer', 
default=+1),
                auth.signature)


from gluon.contrib.populate import populate
if db(db.auth_user).count()<2:
    populate(db.auth_user,100)
    db.commit()
if db(db.post).count()<2:
    populate(db.post,500)
    db.commit()
if db(db.comm).count()<2:
    populate(db.comm,1000)
    db.commit()


 

-- 
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