Sunday 3 January 2016

Error on upgrading the librehatti from Django1.7 to Django1.8 with Pyhton3.4

$ mysql -u root -p librehatti < librehatti.sql

         |-ERROR 1452 (23000) at line 41792: Cannot add or update a child row: a foreign key constraint fails (`librehatti`.`#sql-3f6_f5`, CONSTRAINT `bills_quoteditem_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `catalog_product` (`id`))

$ python manage.py syncdb


        |- File "/home/aasp/LibreHatti/src/useraccounts/models.py", line 80
           return unicode(self.user)
                  ^
           TabError: inconsistent use of tabs and spaces in indentation

Solution:
         >>http://stackoverflow.com/questions/19295519/indentation-error-with-python-3-3-when-python2-7-works-well
         >>https://www.python.org/dev/peps/pep-0008/#tabs-or-spaces

$ python manage.py syncdb         
             |- File "/home/aasp/LibreHatti/src/librehatti/suspense/admin.py", line 9, in <module>
                from librehatti.suspense.forms import StaffForm
                File "/home/aasp/LibreHatti/src/librehatti/suspense/forms.py", line 3, in <module>
                from models import SuspenseClearance
                ImportError: No module named 'models'

Then use

$ python manage.py migrate           
              |- and the same error as above

Solution:
          >> so make changes in LibreHatti/src/librehatti/suspense/forms.py {in this case, "from .models import whatever" in stead of "from models import whatever"}


$ python manage.py runserver

           |- ImportError at /
               No module named 'reports'
           Solution:   
             >>{in this case, "from .models import whatever" in stead of "from models import whatever"}
     
           |- File "/home/aasp/LibreHatti/src/librehatti/urls.py", line 6, in <module>
              from .reports.register_generator import GenerateRegister
              File "/home/aasp/LibreHatti/src/librehatti/reports/register_generator.py", line 13, in                              <module>
              from helper import get_query
              ImportError: No module named 'helper'
             Solution:
             >>same chages as above in forms.py, register_generator.py, and search.py

           |- 'module' object has no attribute 'izip'
           Solution:
             >> replace "izip" with "zip_longest"
             >> http://stackoverflow.com/questions/15698427/merging-three-lists-into-into-one-dictionary
              >> http://stackoverflow.com/questions/32261698/my-idle-does-not-recognize-itertools-izip-as-a-function
             >> https://docs.python.org/3/library/itertools.html#itertools.zip_longest

            |- File "/home/aasp/LibreHatti/src/librehatti/suspense/views.py", line 5, in <module>
               from models import SuspenseClearance
               ImportError: No module named 'models'
           Solution:
              >>{in this case, "from .models import whatever" in stead of "from models import whatever"}

             |- File "/home/aasp/LibreHatti/src/librehatti/reports/views.py", line 5, in <module>
                from forms import ClientForm
                ImportError: No module named 'forms'
             Solution:
              >>{in this case, "from .models import whatever" in stead of "from models import whatever"}

               |- File "/home/aasp/.virtualenvs/py3/lib/python3.4/site-packages/django/core/urlresolvers.py", line 102, in get_callable lookup_view)
                  ImportError: Could not import 'quoted_bill'. The path must be fully qualified.
                Solution:
                   >> Commented the line url(r'^quoted_bill/', 'librehatti.prints.views.quoted_bill'), in url.py

No comments:

Post a Comment