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


  • 0
    samuel-bonilla-11088  11 years ago

    the error is generated when i change setup.py , example:

    
    
    1. class Setup(object):
    2.  
    3. def __init__(self):
    4. T = current.T
    5. self.db_options = [
    6. Field("uri", "string", notnull=True, default="mysql://my_username:my_password@localhost/my_dbname"),
    7. Field("migrate", "boolean", notnull=True, default=True),
    8. Field("migrate_enabled", "boolean", notnull=True, default=True),
    9. Field("pool_size", "integer", notnull=True, default=10),
    10. Field("gaeuri", "string", notnull=True, default="google:datastore"),
    11. Field("setuptime", "datetime", notnull=True),
    12. ]

    then :

    controler

    setup.py  install

    and i get the error

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