OperationalError: no such table: contacts

38 views
Skip to first unread message

karthikeyan p

unread,
May 29, 2019, 3:13:07 PM5/29/19
to web2py-users
i am running my web2py app in pythonanywhere.com ( cloud machine )
i have configured git in my welcome folder . i have not initalised .ignore file to avoid anything like database , errors , sessions ,uploads .
so when i like to backup my app in pythonanywhere , i just used -> git add . -> git commit -> git push to my cloud repo  (github).
so finally i got all my data ( including db , uploads , sessions ,errors etc ) in to my cloud repo .

i use git pull in local machine to pull all contents took from pythonanywhere.

if i changed something in my local repo ( laptop) , i will send it to cloud repo (github) .

this is my technique .


i have created a database called contact in my local machine . 
i pushed it to github . 
i pulled it to pythonanywhere.com



finally i found this error , 

<class 'sqlite3.OperationalError'> no such table: contacts


but it is found in db.py (model)


db.define_table('contacts',
    Field('usr_n','string'),
    Field('email_id',requires=IS_EMPTY_OR(IS_EMAIL()))
)


i did this technique :
i deleted all *.database ( except sql.log and storage.sqlite)
i used "fake_migrate_all=True" 


any other best practise to work  for updating the things include db in cloud machine ??

i mostly worried about the db problems.




João Matos

unread,
May 31, 2019, 3:46:37 AM5/31/19
to web2py-users
If you don't need any data in the db, delete everything in databases and check that in models\db.py the DAL creation has migrate=True.
Then restart your app.
All tables should be recreated.
Reply all
Reply to author
Forward
0 new messages