If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!


  • 1
    josedesoto  7 years ago

    I have tested it in my computer with a local Mysql and I get the same error... In SQLite works fine.

Commented on:

help with mysql, I'm trying to connect to a new mysql database with movuca, and I get this error

I'm using pythonanywhere

https://github.com/rochacbruno/Movuca/blob/master/modules/datamodel/setup.py

 

<class '_mysql_exceptions.IntegrityError'> (1452, 'Cannot add or update a child row: a foreign key constraint fails (`samuel$mydb`.`article_category`, CONSTRAINT `article_category_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `article_category` (`id`) ON DELETE CASCADE)')

 

 

Traceback (most recent call last):
  File "/home/samuel/web2py/gluon/restricted.py", line 212, in restricted
    exec ccode in environment
  File "/home/samuel/web2py/applications/social/controllers/home.py", line 34, in <module>
  File "/home/samuel/web2py/gluon/globals.py", line 188, in <lambda>
    self._caller = lambda f: f()
  File "/home/samuel/web2py/applications/social/controllers/home.py", line 17, in index
    home = Home(['featured', 'featured_members', 'homeblocks', 'articles'])
  File "applications/social/modules/handlers/base.py", line 32, in __init__
    self.start()
  File "applications/social/modules/handlers/home.py", line 12, in start
    self.db = DataBase([User, ContentType, Category, Article, Ads, Page])
  File "applications/social/modules/movuca.py", line 45, in __init__
    self.define_classes(classes)
  File "applications/social/modules/movuca.py", line 51, in define_classes
    obj = cls(self)
  File "applications/social/modules/basemodel.py", line 51, in __init__
    self.pre_load()
  File "applications/social/modules/basemodel.py", line 111, in pre_load
    self.__getattribute__(method)()
  File "applications/social/modules/datamodel/article.py", line 192, in set_fixtures
    content_type=self.db(self.db.content_type.identifier == 'Article').select().first().id
  File "/home/samuel/web2py/gluon/dal.py", line 7806, in insert
    ret =  self._db._adapter.insert(self,self._listify(fields))
  File "/home/samuel/web2py/gluon/dal.py", line 1161, in insert
    raise e
IntegrityError: (1452, 'Cannot add or update a child row: a foreign key constraint fails (`samuel$mydb`.`article_category`, CONSTRAINT `article_category_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `article_category` (`id`) ON DELETE CASCADE)')

 

help me please ?

 


Hosting graciously provided by:
Python Anywhere