openlearningtools / opencompetencies

A tool for organizing educational competencies.
MIT License
16 stars 3 forks source link

Update project to Django 1.8 #43

Closed ehmatthes closed 9 years ago

ehmatthes commented 9 years ago

Should be straightforward; I'm not aware of any backwards-incompatible changes that OC uses.

ehmatthes commented 9 years ago

Uninstalled Django, then uninstalled South. May have to reinstall South temporarily? We don't have any critical data in the project, since the first version of Open Competencies was never actually used. I could be free to drop the database and start from scratch.

ehmatthes commented 9 years ago
pip uninstall Django South
pip install Django

Installing 1.8.1.

ehmatthes commented 9 years ago
$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 86, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: No module named south

Okay, let's reinstall South

$ pip install South

And try that again...

$ python manage.py runserver
/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/south/db/postgresql_psycopg2.py:4: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead.
  from django.db.backends.util import truncate_name

There is no South database module 'south.db.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.

Removed South from INSTALLED_APPS...

python manage.py runserver
/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/south/db/postgresql_psycopg2.py:4: RemovedInDjango19Warning: The django.db.backends.util module has been renamed. Use django.db.backends.utils instead.
  from django.db.backends.util import truncate_name

There is no South database module 'south.db.postgresql_psycopg2' for your database. Please either choose a supported database, check for SOUTH_DATABASE_ADAPTER[S] settings, or remove South from INSTALLED_APPS.
(venv)ehmatthes@ehmatthes-ThinkPad-T430s:/srv/projects/oc_prod$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/projects/oc_prod/competencies/models.py", line 233, in <module>
    class PathwayForm(ModelForm):
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/forms/models.py", line 274, in __new__
    "needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form PathwayForm needs updating.
ehmatthes commented 9 years ago

Okay, going to have to deal with South issues. We're not going to use South in 1.8, and we don't need to keep existing migrations because we can start over with an empty database, so let's just remove South and go from there:

$ pip uninstall South

(for real this time)

$ python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/srv/projects/oc_prod/competencies/models.py", line 233, in <module>
    class PathwayForm(ModelForm):
  File "/srv/projects/oc_prod/venv/local/lib/python2.7/site-packages/django/forms/models.py", line 274, in __new__
    "needs updating." % name
django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form PathwayForm needs updating.
ehmatthes commented 9 years ago

Planning to remove the Pathway feature for now; I'll try commenting out the Pathway references, and see how much that helps.

ehmatthes commented 9 years ago

$ python manage.py runserver Performing system checks...

System check identified some issues:

WARNINGS:
competencies.Pathway.competency_areas: (fields.W340) null has no effect on ManyToManyField.
competencies.Pathway.essential_understandings: (fields.W340) null has no effect on ManyToManyField.
competencies.Pathway.learning_targets: (fields.W340) null has no effect on ManyToManyField.
competencies.Pathway.subdiscipline_areas: (fields.W340) null has no effect on ManyToManyField.
competencies.UserProfile.pathways: (fields.W340) null has no effect on ManyToManyField.
competencies.UserProfile.schools: (fields.W340) null has no effect on ManyToManyField.
competencies.UserProfile.subject_areas: (fields.W340) null has no effect on ManyToManyField.

System check identified 7 issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

May 15, 2015 - 13:47:32
Django version 1.8.1, using settings 'opencompetencies.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
/srv/projects/oc_prod/competencies/views.py:6: RemovedInDjango19Warning: The utilities in django.db.models.loading are deprecated in favor of the new application loading system.
  from django.db.models.loading import get_model

It works for now, obviously with some outstanding issues. Many of these issues will be addressed in other aspects of this milestone. I'll close this particular issue, and address the outstanding issues in other work on this milestone.