Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker error related model longclawproduct.Product cannot be resolved #12

Open
tabias opened this issue Oct 31, 2017 · 2 comments
Open
Labels

Comments

@tabias
Copy link

tabias commented Oct 31, 2017

When cloning the git repo I followed the procedure:

Clone this repository

$ git clone https://github.com/JamesRamm/longclaw_demo.git
$ cd longlcaw_demo
Build the docker image

$ docker build -t longclaw-demo .

but got stuck building the docker. (log below)

As products is being migrated first I don't see where this error is coming from.

OS: W10 - enterprise
Docker:

Version 17.09.0-ce-win33 (13620)
Channel: stable
8c56a3b

powershell log

docker\longclaw_demo> docker build -t longclaw-demo .
Sending build context to Docker daemon  10.13MB

Step 1/11 : FROM ubuntu:latest
 ---> 747cb2d60bbe
Step 2/11 : RUN apt-get update -y && apt-get -y upgrade
 ---> Using cache
 ---> abdbfa11729c
Step 3/11 : RUN apt-get -y install build-essential git nodejs npm python3 python3-pip
 ---> Using cache
 ---> 725bf8b5774e
Step 4/11 : RUN update-alternatives --install /usr/bin/node node /usr/bin/nodejs 10
 ---> Using cache
 ---> b2287bf3d714
Step 5/11 : ADD . /src/
 ---> Using cache
 ---> 66bc53a4eb2b
Step 6/11 : RUN pip3 install -r /src/requirements.txt
 ---> Using cache
 ---> 0d410d8b86ee
Step 7/11 : RUN longclaw build
 ---> Using cache
 ---> c7adefdfb440
Step 8/11 : RUN python3 /src/manage.py migrate
 ---> Running in 5d9c0f352b0b
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, home, longclawbasket, longclawcheckout, longclaworders, longclawproducts, longclawsettings, longclawshipping, products, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailusers
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying wagtailcore.0001_squashed_0016_change_page_url_path_to_text_field... OK
  Applying wagtailcore.0017_change_edit_page_permission_description... OK
  Applying wagtailcore.0018_pagerevision_submitted_for_moderation_index... OK
  Applying wagtailcore.0019_verbose_names_cleanup... OK
  Applying wagtailcore.0020_add_index_on_page_first_published_at... OK
  Applying wagtailcore.0021_capitalizeverbose... OK
  Applying wagtailcore.0022_add_site_name... OK
  Applying wagtailcore.0023_alter_page_revision_on_delete_behaviour... OK
  Applying wagtailcore.0024_collection... OK
  Applying wagtailcore.0025_collection_initial_data... OK
  Applying wagtailcore.0026_group_collection_permission... OK
  Applying wagtailcore.0027_fix_collection_path_collation... OK
  Applying wagtailcore.0024_alter_page_content_type_on_delete_behaviour... OK
  Applying wagtailcore.0028_merge... OK
  Applying wagtailcore.0029_unicode_slugfield_dj19... OK
  Applying home.0001_initial... OK
  Applying home.0002_create_homepage... OK
  Applying taggit.0001_initial... OK
  Applying wagtailimages.0001_initial... OK
  Applying wagtailimages.0002_initial_data... OK
  Applying wagtailimages.0003_fix_focal_point_fields... OK
  Applying wagtailimages.0004_make_focal_point_key_not_nullable... OK
  Applying wagtailimages.0005_make_filter_spec_unique... OK
  Applying wagtailimages.0006_add_verbose_names... OK
  Applying wagtailimages.0007_image_file_size... OK
  Applying wagtailimages.0008_image_created_at_index... OK
  Applying wagtailimages.0009_capitalizeverbose... OK
  Applying wagtailimages.0010_change_on_delete_behaviour... OK
  Applying wagtailimages.0011_image_collection... OK
  Applying wagtailimages.0012_copy_image_permissions_to_collections... OK
  Applying wagtailimages.0013_make_rendition_upload_callable... OK
  Applying wagtailimages.0014_add_filter_spec_field... OK
  Applying wagtailimages.0015_fill_filter_spec_field... OK
  Applying wagtailcore.0030_index_on_pagerevision_created_at... OK
  Applying taggit.0002_auto_20150616_2121... OK
  Applying longclawproducts.0001_initial... OK
  Applying longclawproducts.0002_auto_20170219_0804... OK
  Applying products.0001_initial... OK
  Applying longclawbasket.0001_initial... OK
  Applying longclawcheckout.0001_initial... OK
  Applying longclawcheckout.0002_delete_shippingcountry... OK
  Applying longclawshipping.0001_initial... OK
  Applying longclaworders.0001_initial... OK
  Applying longclaworders.0002_order_shipping_rate... OK
  Applying longclaworders.0003_auto_20170211_1632... OK
  Applying longclaworders.0004_auto_20170212_1605... OK
  Applying longclaworders.0005_auto_20170311_2142... OK
  Applying longclaworders.0006_order_transaction_id... OK
  Applying longclaworders.0007_auto_20170313_0846... OK
  Applying longclaworders.0008_auto_20170516_1629... OK
  Applying longclaworders.0009_auto_20170526_2104... OK
  Applying longclaworders.0010_auto_20171008_1449... OK
  Applying wagtailredirects.0001_initial... OK
  Applying wagtailredirects.0002_add_verbose_names... OK
  Applying wagtailredirects.0003_make_site_field_editable... OK
  Applying wagtailredirects.0004_set_unique_on_path_and_site... OK
  Applying wagtailredirects.0005_capitalizeverbose... OK
  Applying wagtailforms.0001_initial... OK
  Applying wagtailforms.0002_add_verbose_names... OK
  Applying wagtailforms.0003_capitalizeverbose... OK
  Applying wagtailcore.0031_add_page_view_restriction_types... OK
  Applying wagtailcore.0032_add_bulk_delete_page_permission... OK
  Applying longclawproducts.0004_auto_20170903_1132... OK
  Applying longclawsettings.0001_initial... OK
  Applying longclawsettings.0002_auto_20170212_1423... OK
  Applying longclawsettings.0003_longclawsettings_currency_html_code... OK
  Applying longclawsettings.0004_longclawsettings_currency... OK
  Applying longclawsettings.0005_auto_20170212_1609... OK
  Applying longclawshipping.0002_auto_20170410_1620... OK
  Applying longclawshipping.0003_auto_20170516_1629... OK
  Applying longclawshipping.0004_auto_20170518_0526... OK
  Applying longclawshipping.0005_auto_20170518_0558... OK
  Applying longclawshipping.0006_auto_20170521_0831... OK
  Applying products.0002_auto_20170330_2000...�[91mTraceback (most recent call last):
  File "/src/manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.5/dist-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/usr/local/lib/python3.5/dist-packages/django/db/migrations/operations/fields.py", line 147, in database_forwards
    schema_editor.remove_field(from_model, from_model._meta.get_field(self.name))
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/schema.py", line 249, in remove_field
    self._remake_table(model, delete_fields=[field])
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/sqlite3/schema.py", line 191, in _remake_table
    self.create_model(temp_model)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/schema.py", line 246, in create_model
    definition, extra_params = self.column_sql(model, field)
  File "/usr/local/lib/python3.5/dist-packages/django/db/backends/base/schema.py", line 136, in column_sql
    db_params = field.db_parameters(connection=self.connection)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 940, in db_parameters
    return {"type": self.db_type(connection), "check": self.db_check(connection)}
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 937, in db_type
    return self.target_field.rel_db_type(connection=connection)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 855, in target_field
    return self.foreign_related_fields[0]
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 595, in foreign_related_fields
    return tuple(rhs_field for lhs_field, rhs_field in self.related_fields if rhs_field)
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 582, in related_fields
    self._related_fields = self.resolve_related_fields()
  File "/usr/local/lib/python3.5/dist-packages/django/db/models/fields/related.py", line 567, in resolve_related_fields
    raise ValueError('Related model %r cannot be resolved' % self.remote_field.model)
ValueError: Related model 'longclawproducts.Product' cannot be resolved
docker : The command '/bin/sh -c python3 /src/manage.py migrate' returned a non-zero code: 1
At line:1 char:1
+ docker build -t longclaw-demo .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The command '/b...on-zero code: 1:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
�[0m
@JamesRamm JamesRamm added the bug label Oct 31, 2017
@tabias
Copy link
Author

tabias commented Nov 2, 2017

Somehow the issue is initiated using the longclaw build version from git.

doing the manual process as follows gives a working demo result:

  1. clone this git
  2. install the requirements.txt
  3. overwrite longclaw with the pip version (0.2.0) instead of the git version
  4. migrate

I'm still looking into the source of longclaw to find the specific problem.

@JamesRamm
Copy link
Collaborator

Ok
Problem here is that my focus is on longclaw development and I'm not able to keep longclaw_demo in sync with latest changes.

Solution is simple - I should start tagging longclaw_demo with the longclaw version and tie the requirements to that.

This would mean that:

  • A 0.2.0 tag on longclaw_demo should install longclaw 0.2.0 and work :)
  • longclaw_demo master branch can continue development at its own pace (lagging behind longclaw a bit basically).
  • A new longclaw release should ideally be followed straight away by a new longclaw_demo tag with a working longclaw_demo version for that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants