Upgrade Help

This document exists to help document changes between versions of Wooey and what existing bootstrap projects may need to migrate to recent versions. The official changelog for releases is curated in github releases, which will document any major changes. Though every attempt is made to test upgrades, it is recommended to backup your database prior to an upgrade in case your particular usage of Wooey is not something the creators test. If an error arises, please open an issue on github.

General Upgrade Information

As with all app upgrades, after installing a newer version, you should ensure the app models are up to date with python manage.py migrate. Generally, this command should be baked in with the startup script of your webserver to ensure no instance is running with unapplied migrations.

Upgrading to 0.14

This is largely a cleanup and deprecation release.

1) Support for versions of Django less than 3.2 are dropped. This removed quite a few functions and requires modifying several files listed in later steps.

2) The minimum supported Python version is 3.7. For supporting scripts written in older versions of Python, one approach is to create a docker wrapper, such as in docker_scripts.

3) The function ugettext_lazy has been removed in Django 3.2 as the unicode/string representation is no longer relevant in python3. Thus, all uses of this should be replaced with gettext_lazy (one will be in wooey_settings.py).

from django.utils.translation import ugettext_lazy as _

becomes

from django.utils.translation import gettext_lazy as _

4) django-celery-results has been removed from Wooey as its tasks do not require a backend. This should be removed from INSTALLED_APPS in user_settings.py.

5) In user_urls.py, the url import should be removed (this was an unused import and is no longer a function in Django3.2+).

This entire line should be removed:

from django.conf.urls import include, url
  1. In django_urls.py, url should instead be replaced with re_path.

from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/logout/$', auth_views.LogoutView.as_view(), name='logout'),
]

becomes

from django.urls import include, re_path
from django.contrib import admin
from django.contrib.auth import views as auth_views

urlpatterns = [
    re_path(r'^admin/', admin.site.urls),
    re_path(r'^accounts/logout/$', auth_views.LogoutView.as_view(), name='logout'),
]
  1. In wooey_urls.py, url also needs to be changed to path.

urlpatterns += [
    #url(r'^admin/', include(admin.site.urls)),
    url(r'^', include('wooey.urls')),
]

becomes

from django.urls import include, path

urlpatterns += [
    # path('admin/', include(admin.site.urls)),
    path("", include("wooey.urls")),
    path("", include("django.contrib.auth.urls")),
]

8) If you were using a S3 bucket, you likely need to upgrade django-storages. You may need to change the AWS_QUERYSTRING_AUTH settings from False to True to comply with recent changes to S3.

9) Celery settings have been changed to coincide with the upcoming configuration change. Please review Celery Configuration to evaluate what names need to be remapped. In wooey_celery_app.py, you should remove the namespace=CELERY line after making appropiate changes.

0.9.11 To 0.10

0.10 adds in support for Django 1.10 as well as Django 1.11. Django versions prior to 1.8 are no longer officially supported.

  1. Celery Changes:

    Celery was upgraded to version 4.x and several changes are required:

    1. First, celery is no longer executed through

      python manage.py celery
      

      but instead via:

      celery -A your_project_name worker -l info (and any other arguments)
      
    2. Because django-celery is now deprecated and incompatible with newer Django and Celery versions, several settings in settings/user_settings.py must be updated:

      INSTALLED_APPS += (
          'djcelery',
          'kombu.transport.django',
      )
      

      must be changed to:

      INSTALLED_APPS += (
          'django_celery_results',
          'kombu.transport.filesystem',
      )
      

      If the django-celery task result backend was in use, the backend must be changed from:

      CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend'
      

      to:

      CELERY_RESULT_BACKEND = 'django-db'
      

      If a broker was never specified, the default broker url must be changed from

      BROKER_URL = 'django://'
      

      to

      CELERY_BROKER_URL = 'filesystem://'
      # This function exists just to ensure the filesystem has the correct folders
      def ensure_path(path):
          import errno
          try:
              os.makedirs(path)
          except Exception as e:
              if e.errno == errno.EEXIST:
                  pass
              else:
                  raise
          return path
      
      broker_dir = ensure_path(os.path.join(BASE_DIR, '.broker'))
      CELERY_BROKER_TRANSPORT_OPTIONS = {
          "data_folder_in": ensure_path(os.path.join(broker_dir, "out")),
          "data_folder_out": ensure_path(os.path.join(broker_dir, "out")),
          "data_folder_processed": ensure_path(os.path.join(broker_dir, "processed")),
      }
      

    Note: It is highly recommended to not use this broker and use something such as rabbitmq or redis.

    1. The celery app instance, located in your_project_name/wooey_celery_app.py must be updated to:

      from __future__ import absolute_import
      import os
      
      from celery import Celery
      
      
      os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project_name.settings')
      
      app = Celery('your_project_name')
      
      # Using a string here means the worker will not have to
      # pickle the object when using Windows.
      app.config_from_object('django.conf:settings', namespace='CELERY')
      app.autodiscover_tasks()
      
      @app.task(bind=True)
      def debug_task(self):
          print('Request: {0!r}'.format(self.request))
      
  2. Django Upgrades:

    Additional tweaks may be required for if a Django upgrade is performed, such as changing MIDDLEWARE_CLASSES to MIDDLEWARE. For these issues, the official Django Documentation should be referenced.