Comments (16)
I tried again and when setting up a fresh local environment on my laptop the migration will work.
I then checked the possible missing migration which is located here:
~/.pyenv/versions/curated/lib/python3.10/site-packages/wagtailsvg/migrations/0005_alter_svg_file.py
# Generated by Django 4.0.6 on 2022-08-02 06:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailsvg', '0004_remove_svg_edit_code'),
]
operations = [
migrations.AlterField(
model_name='svg',
name='file',
field=models.FileField(upload_to='svg', verbose_name='file'),
),
]
The difference between local and production is that I am using a docker container for production.
It looks like when I am building that container the file is not part of the container since it is generated on the fly.
Should this be part of the package?
from wagtailsvg.
Hi @ajfriesen
I think there is a migration missing in the wagtailsvg.
In the meantime, you can modify your local migration file and remove the depandancy "0005_alter_svg_file".
from wagtailsvg.
Mh,
I am not sure how I can just ignore them.
For local development I can comment the depenceny, make migrations and the missing migration will be created for this package.
But when building my docker image I start my docker container by applying migrations.
This does not work because of the missing on in the package.
Is there any workaround where I can first create the missing migration file for wagtailsvg
and then migrate my apps?
from wagtailsvg.
In your Docker, you have to copy your migration files.
I think you are not supposed to do a "makemigrations" but only a "migrate".
from wagtailsvg.
In your Docker, you have to copy your migration files. I think you are not supposed to do a "makemigrations" but only a "migrate".
In docker I only do migrate
because otherwise, I might miss migrations in my repo.
But I am still not sure how to implement a workaround for the missign migration.
from wagtailsvg.
It's weird because when I do a makemigration on wagtailsvg, I have no migration generated.
I don't understand why you have one generated. Do you have an idea?
from wagtailsvg.
Can you show me this file : self_hosted_apps.0001_initial ?
from wagtailsvg.
I think I get the migration because I add the field with type of wagtailsvg to my model. But this is just a guess.
Here my repo and the migrations:
https://github.com/ajfriesen/curated/tree/main/self_hosted_apps/migrations
docker compose up
python manage.py runserver --settings curated.settings.local
I am trying to understand what is happening. Maybe django MIGRATTION_MODULES is something which could help here.
But not sure on that.
https://stackoverflow.com/questions/47153776/how-to-store-third-party-apps-migrations-in-django
from wagtailsvg.
I see in your migrations files, there are 2 calls of a wagtailsvg migration that does not exist :
- https://github.com/ajfriesen/curated/blob/d88a617425ff32609b4eda84e75e835c05c4eb48/self_hosted_apps/migrations/0005_apppage_logo_svg.py#L10
- https://github.com/ajfriesen/curated/blob/d88a617425ff32609b4eda84e75e835c05c4eb48/self_hosted_apps/migrations/0006_remove_apppage_date_alter_apppage_logo_svg.py#L10
If you remove these lines, I think it could work but I'm not sure because your backtrace seem to say that you generate new migrations files (because the error is in 0001 migration file) :
django.db.migrations.exceptions.NodeNotFoundError: Migration self_hosted_apps.0001_initial dependencies reference nonexistent parent node ('wagtailsvg', '0005_alter_svg_file')
I can check later in detail.
Don't hesitate to tell me if you find the problem.
from wagtailsvg.
sorry the backtrace was from a test when I testeds with a single migration file. That is misleading.
Nonetheless, I tested again:
I have deleted my postgres db and removed all my migrations.
I then start up the postgres again.
Then I start the python process.
Create all migrations
python manage.py makemigrations
Migrations for 'wagtailsvg':
/home/andrej/.pyenv/versions/curated/lib/python3.10/site-packages/wagtailsvg/migrations/0005_alter_svg_file.py
- Alter field file on svg
Migrations for 'self_hosted_apps':
self_hosted_apps/migrations/0001_initial.py
- Create model AppListPage
- Create model AppPage
As you can see this will create a migration file in the package layer.
When I migrate everything works fine.
python manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_celery_results, generic_page, home, self_hosted_apps, sessions, taggit, wagtailadmin, wagtailcore, wagtaildocs, wagtailembeds, wagtailforms, wagtailimages, wagtailredirects, wagtailsearch, wagtailsvg, 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 admin.0003_logentry_add_action_flag_choices... 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 auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying django_celery_results.0001_initial... OK
Applying django_celery_results.0002_add_task_name_args_kwargs... OK
Applying django_celery_results.0003_auto_20181106_1101... OK
Applying django_celery_results.0004_auto_20190516_0412... OK
Applying django_celery_results.0005_taskresult_worker... OK
Applying django_celery_results.0006_taskresult_date_created... OK
Applying django_celery_results.0007_remove_taskresult_hidden... OK
Applying django_celery_results.0008_chordcounter... OK
Applying django_celery_results.0009_groupresult... OK
Applying django_celery_results.0010_remove_duplicate_indices... OK
Applying django_celery_results.0011_taskresult_periodic_task_name... 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 wagtailcore.0030_index_on_pagerevision_created_at... OK
Applying wagtailcore.0031_add_page_view_restriction_types... OK
Applying wagtailcore.0032_add_bulk_delete_page_permission... OK
Applying wagtailcore.0033_remove_golive_expiry_help_text... OK
Applying wagtailcore.0034_page_live_revision... OK
Applying wagtailcore.0035_page_last_published_at... OK
Applying wagtailcore.0036_populate_page_last_published_at... OK
Applying wagtailcore.0037_set_page_owner_editable... OK
Applying wagtailcore.0038_make_first_published_at_editable... OK
Applying wagtailcore.0039_collectionviewrestriction... OK
Applying wagtailcore.0040_page_draft_title... OK
Applying wagtailcore.0041_group_collection_permissions_verbose_name_plural... OK
Applying wagtailcore.0042_index_on_pagerevision_approved_go_live_at... OK
Applying wagtailcore.0043_lock_fields... OK
Applying wagtailcore.0044_add_unlock_grouppagepermission... OK
Applying wagtailcore.0045_assign_unlock_grouppagepermission... OK
Applying wagtailcore.0046_site_name_remove_null... OK
Applying wagtailcore.0047_add_workflow_models... OK
Applying wagtailcore.0048_add_default_workflows... OK
Applying wagtailcore.0049_taskstate_finished_by... OK
Applying wagtailcore.0050_workflow_rejected_to_needs_changes... OK
Applying wagtailcore.0051_taskstate_comment... OK
Applying wagtailcore.0052_pagelogentry... OK
Applying wagtailcore.0053_locale_model... OK
Applying wagtailcore.0054_initial_locale... OK
Applying wagtailcore.0055_page_locale_fields... OK
Applying wagtailcore.0056_page_locale_fields_populate... OK
Applying wagtailcore.0057_page_locale_fields_notnull... OK
Applying wagtailcore.0058_page_alias_of... OK
Applying wagtailcore.0059_apply_collection_ordering... OK
Applying wagtailcore.0060_fix_workflow_unique_constraint... OK
Applying wagtailcore.0061_change_promote_tab_helpt_text_and_verbose_names... OK
Applying wagtailcore.0062_comment_models_and_pagesubscription... OK
Applying wagtailcore.0063_modellogentry... OK
Applying wagtailcore.0064_log_timestamp_indexes... OK
Applying wagtailcore.0065_log_entry_uuid... OK
Applying wagtailcore.0066_collection_management_permissions... OK
Applying wagtailcore.0067_alter_pagerevision_content_json... OK
Applying wagtailcore.0068_log_entry_empty_object... OK
Applying wagtailcore.0069_log_entry_jsonfield... OK
Applying generic_page.0001_initial... OK
Applying home.0001_initial... OK
Applying home.0002_remove_homepage_body... OK
Applying home.0003_homepage_body... OK
Applying taggit.0001_initial... OK
Applying taggit.0002_auto_20150616_2121... OK
Applying taggit.0003_taggeditem_add_unique_index... OK
Applying wagtailsvg.0001_initial... OK
Applying wagtailsvg.0002_svg_edit_code... OK
Applying wagtailsvg.0003_alter_svg_options... OK
Applying wagtailsvg.0004_remove_svg_edit_code... OK
Applying wagtailsvg.0005_alter_svg_file... OK
Applying wagtailimages.0001_squashed_0021... OK
Applying wagtailimages.0022_uploadedimage... OK
Applying wagtailimages.0023_add_choose_permissions... OK
Applying wagtailimages.0024_index_image_file_hash... OK
Applying self_hosted_apps.0001_initial... OK
Applying sessions.0001_initial... OK
Applying taggit.0004_alter_taggeditem_content_type_alter_taggeditem_tag... OK
Applying wagtailadmin.0001_create_admin_access_permissions... OK
Applying wagtailadmin.0002_admin... OK
Applying wagtailadmin.0003_admin_managed... OK
Applying wagtaildocs.0001_initial... OK
Applying wagtaildocs.0002_initial_data... OK
Applying wagtaildocs.0003_add_verbose_names... OK
Applying wagtaildocs.0004_capitalizeverbose... OK
Applying wagtaildocs.0005_document_collection... OK
Applying wagtaildocs.0006_copy_document_permissions_to_collections... OK
Applying wagtaildocs.0005_alter_uploaded_by_user_on_delete_action... OK
Applying wagtaildocs.0007_merge... OK
Applying wagtaildocs.0008_document_file_size... OK
Applying wagtaildocs.0009_document_verbose_name_plural... OK
Applying wagtaildocs.0010_document_file_hash... OK
Applying wagtaildocs.0011_add_choose_permissions... OK
Applying wagtaildocs.0012_uploadeddocument... OK
Applying wagtailembeds.0001_initial... OK
Applying wagtailembeds.0002_add_verbose_names... OK
Applying wagtailembeds.0003_capitalizeverbose... OK
Applying wagtailembeds.0004_embed_verbose_name_plural... OK
Applying wagtailembeds.0005_specify_thumbnail_url_max_length... OK
Applying wagtailembeds.0006_add_embed_hash... OK
Applying wagtailembeds.0007_populate_hash... OK
Applying wagtailembeds.0008_allow_long_urls... OK
Applying wagtailembeds.0009_embed_cache_until... OK
Applying wagtailforms.0001_initial... OK
Applying wagtailforms.0002_add_verbose_names... OK
Applying wagtailforms.0003_capitalizeverbose... OK
Applying wagtailforms.0004_add_verbose_name_plural... OK
Applying wagtailforms.0005_alter_formsubmission_form_data... 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 wagtailredirects.0006_redirect_increase_max_length... OK
Applying wagtailredirects.0007_add_autocreate_fields... OK
Applying wagtailredirects.0008_add_verbose_name_plural... OK
Applying wagtailsearch.0001_initial... OK
Applying wagtailsearch.0002_add_verbose_names... OK
Applying wagtailsearch.0003_remove_editors_pick... OK
Applying wagtailsearch.0004_querydailyhits_verbose_name_plural... OK
Applying wagtailsearch.0005_create_indexentry... OK
Applying wagtailsearch.0006_customise_indexentry... OK
Applying wagtailusers.0001_initial... OK
Applying wagtailusers.0002_add_verbose_name_on_userprofile... OK
Applying wagtailusers.0003_add_verbose_names... OK
Applying wagtailusers.0004_capitalizeverbose... OK
Applying wagtailusers.0005_make_related_name_wagtail_specific... OK
Applying wagtailusers.0006_userprofile_prefered_language... OK
Applying wagtailusers.0007_userprofile_current_time_zone... OK
Applying wagtailusers.0008_userprofile_avatar... OK
Applying wagtailusers.0009_userprofile_verbose_name_plural... OK
Applying wagtailusers.0010_userprofile_updated_comments_notifications... OK
The problem is, that I don't know how to package that package migration in my docker container.
Unless I do a makemigration
when I build the container. This seems like the wrong way.
But I could be mistaken on that opinion.
from wagtailsvg.
I had some help in the django forum: https://forum.djangoproject.com/t/possible-migration-file-missing-from-third-party-package/15170/7
It looks like this migration will only be created when you set the variable WAGTAILSVG_UPLOAD_FOLDER = 'svg'
.
I got this from the readme.
When I do not use this variable and just keep the default there will be no migration created on package level.
Only on my application level.
from wagtailsvg.
Indeed, thank you for finding the problem.
Do you know how to fix it from wagtailsvg ?
I can apply PR so you won't have the problem anymore.
from wagtailsvg.
I am not sure to handle this.
It looks like others do this with the MIGRATION_MODULES which could be an approach when handling migrations for third-party apps.
Did not tackle that though.
https://stackoverflow.com/questions/47153776/how-to-store-third-party-apps-migrations-in-django
from wagtailsvg.
@Aleksi44 you could maybe try something like tihis https://medium.com/@nurettinabaci/dynamic-upload-to-a9935995be33 and check if that method doesn't create a new migration when the folder changes
from wagtailsvg.
the issue was fixed on PR #22 but it's still not merged.
from wagtailsvg.
Thanks, I'll take care of it tonight.
from wagtailsvg.
Related Issues (11)
- Migration wagtailsvg.0001_initial dependencies reference nonexistent parent node ('wagtailcore', '0059_apply_collection_ordering') HOT 2
- Use svg images inside a RichTextField HOT 1
- SvgChooserBlock field to graphql HOT 3
- The image in preview doesn't change in Mozilla Firefox HOT 7
- Svg chooser block does not allow me to upload svg HOT 1
- Update wagtail-generic-chooser HOT 3
- Question: How to render svg's in a template? HOT 4
- Support for other storages? HOT 4
- SvgChooserBlock doesn't show up preview svg image StreamField. HOT 7
- Django 3.2 generate excessive migrations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wagtailsvg.