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

Update to use Django 1.7 / 1.8 #152

Open
aaaaalbert opened this issue Apr 2, 2015 · 2 comments
Open

Update to use Django 1.7 / 1.8 #152

aaaaalbert opened this issue Apr 2, 2015 · 2 comments
Assignees

Comments

@aaaaalbert
Copy link
Contributor

Quoting from the Django 1.8 release notes:

With the release of Django 1.8, Django 1.6 has reached end-of-life. As such, Django 1.6.11 is the final release of the 1.6 series. Django 1.7 will continue to receive security updates until the release of Django 1.9 (planned for October 2015). Django 1.4 (the previous LTS) will receive security updates for another six months (ending October 1, 2015) to give time for users to upgrade to Django 1.8 LTS.

We recently updated our clearinghouse Django app code to work with 1.6, but obviously must support upcoming versions too. @kaushik1091 kindly took the lead to check compatibility, and below are his first results. Thank you!

I would like to raise two questions here:

  • Who has experience with writing tests for Django apps? (E.g. check that a new user can register, log in, etc.; but also that erroneuos data in forms doesn't break anything.) The existing tests are not well maintained, and we will need something like this to ensure the migration worked correctly.
  • How about any additional packages we include in our app, like the Social Login / OAuth things, and especially @SantiagoTorres' @PolyPasswordHasher? Do they support 1.7+? Any changes we need to implement?

Kaushik's test results:

Testing 1.7

/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

Performing system checks...

System check identified some issues:

WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
    HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
control.ActionLogEvent.was_successful: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_active: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_broken: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.is_dirty: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.user_keys_in_sync: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.

System check identified 6 issues (0 silenced).
[2015-04-01 18:52:07.586247] DEBUG 973821263 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 18:52:07.587292] DEBUG 973821263 Resetting django query log because settings.DEBUG is True.
[2015-04-01 18:52:07.587386] ERROR 973821263 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 18:52:07.587520] DEBUG 973821263 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001002): None

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

April 01, 2015 - 18:52:07
Django version 1.7, using settings 'clearinghouse.website.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
^Cch@ubuntu:~/deployment/clearinghouse$ python website/manage.py runserver 8000
/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

Performing system checks...

System check identified some issues:

WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
    HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
control.ActionLogEvent.was_successful: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_active: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_broken: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.is_dirty: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.user_keys_in_sync: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.

System check identified 6 issues (0 silenced).
[2015-04-01 18:52:49.636918] DEBUG 173482785 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 18:52:49.639628] DEBUG 173482785 Resetting django query log because settings.DEBUG is True.
[2015-04-01 18:52:49.639997] ERROR 173482785 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 18:52:49.640368] DEBUG 173482785 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001248): None

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

April 01, 2015 - 18:52:49
Django version 1.7, using settings 'clearinghouse.website.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Testing 1.8

/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

/home/ch/deployment/clearinghouse/common/api/maindb.py:163: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call_and_only_first_argument

/home/ch/deployment/clearinghouse/common/api/maindb.py:579: RemovedInDjango18Warning: commit_manually is deprecated in favor of set_autocommit.
  @log_function_call

Performing system checks...

System check identified some issues:

WARNINGS:
?: (1_6.W001) Some project unittests may not execute as expected.
    HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information.
control.ActionLogEvent.was_successful: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_active: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Node.is_broken: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.is_dirty: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.
control.Vessel.user_keys_in_sync: (1_6.W002) BooleanField does not have a default value.
    HINT: Django 1.6 changed the default value of BooleanField from False to None. See https://docs.djangoproject.com/en/1.6/ref/models/fields/#booleanfield for more information.

System check identified 6 issues (0 silenced).
[2015-04-01 18:52:49.636918] DEBUG 173482785 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 18:52:49.639628] DEBUG 173482785 Resetting django query log because settings.DEBUG is True.
[2015-04-01 18:52:49.639997] ERROR 173482785 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 18:52:49.640368] DEBUG 173482785 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001248): None

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

April 01, 2015 - 18:52:49
Django version 1.7, using settings 'clearinghouse.website.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[2015-04-01 19:10:33.930214] DEBUG 730627169 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:33.936504] DEBUG 730627169 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:33.937632] ERROR 730627169 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:33.937803] DEBUG 730627169 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.004274): None
[2015-04-01 19:10:33.949118] INFO 730627169 Request started. GET /html/register <QueryDict: {}> logged_in_user:-
[2015-04-01 19:10:35.279297] DEBUG 730627169 Calling: get_logged_in_user (module clearinghouse.website.control.interface), args: ('<HttpRequest>',), kwargs: ().
[2015-04-01 19:10:35.280020] DEBUG 730627169 Exception from get_logged_in_user (module clearinghouse.website.control.interface): <class 'clearinghouse.common.exceptions.DoesNotExistError'> 
[01/Apr/2015 19:10:35] "GET /html/register HTTP/1.1" 200 4339
[2015-04-01 19:10:39.138421] DEBUG 228397245 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:39.139860] DEBUG 228397245 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:39.140257] ERROR 228397245 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:39.140657] DEBUG 228397245 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001786): None
[2015-04-01 19:10:39.143395] INFO 228397245 Request started. GET /html/home <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:39] "GET /html/home HTTP/1.1" 200 4037
[2015-04-01 19:10:39.536117] DEBUG 479603050 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:39.538727] DEBUG 479603050 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:39.538827] ERROR 479603050 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:39.538950] DEBUG 479603050 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.000912): None
[2015-04-01 19:10:39.541235] INFO 479603050 Request started. GET /site_media/css/help.css <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:39] "GET /site_media/css/help.css HTTP/1.1" 200 669
[2015-04-01 19:10:42.097494] DEBUG 489706453 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:42.098155] DEBUG 489706453 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:42.098268] ERROR 489706453 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:42.098432] DEBUG 489706453 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.000716): None
[2015-04-01 19:10:42.100405] INFO 489706453 Request started. GET /html/register <QueryDict: {}> logged_in_user:-
[2015-04-01 19:10:42.101982] DEBUG 489706453 Calling: get_logged_in_user (module clearinghouse.website.control.interface), args: ('<HttpRequest>',), kwargs: ().
[2015-04-01 19:10:42.106864] DEBUG 489706453 Exception from get_logged_in_user (module clearinghouse.website.control.interface): <class 'clearinghouse.common.exceptions.DoesNotExistError'> 
[01/Apr/2015 19:10:42] "GET /html/register HTTP/1.1" 200 4339
[2015-04-01 19:10:43.986727] DEBUG 653200301 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:43.988159] DEBUG 653200301 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:43.988591] ERROR 653200301 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:43.988963] DEBUG 653200301 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001385): None
[2015-04-01 19:10:43.992171] INFO 653200301 Request started. GET /html/accounts_help <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:44] "GET /html/accounts_help HTTP/1.1" 200 4616
[2015-04-01 19:10:46.172912] DEBUG 670962422 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:46.173513] DEBUG 670962422 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:46.173602] ERROR 670962422 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:46.173717] DEBUG 670962422 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.000646): None
[2015-04-01 19:10:46.176471] INFO 670962422 Request started. GET /html/login <QueryDict: {}> logged_in_user:-
[2015-04-01 19:10:46.183603] DEBUG 670962422 Calling: get_logged_in_user (module clearinghouse.website.control.interface), args: ('<HttpRequest>',), kwargs: ().
[2015-04-01 19:10:46.183831] DEBUG 670962422 Exception from get_logged_in_user (module clearinghouse.website.control.interface): <class 'clearinghouse.common.exceptions.DoesNotExistError'> 
[01/Apr/2015 19:10:46] "GET /html/login HTTP/1.1" 200 2928
[2015-04-01 19:10:46.664222] DEBUG 206446569 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:46.667207] DEBUG 206446569 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:46.668806] ERROR 206446569 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:46.668975] DEBUG 206446569 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.003150): None
[2015-04-01 19:10:46.673540] INFO 206446569 Request started. GET /site_media/scripts/login.js <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:46] "GET /site_media/scripts/login.js HTTP/1.1" 200 99
[2015-04-01 19:10:46.714610] DEBUG 698631146 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:46.718719] DEBUG 698631146 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:46.718821] ERROR 698631146 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:46.722913] DEBUG 698631146 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.004995): None
[2015-04-01 19:10:46.733338] INFO 698631146 Request started. GET /site_media/images/google-icon.png <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:46] "GET /site_media/images/google-icon.png HTTP/1.1" 200 1797
[2015-04-01 19:10:46.780489] DEBUG 343119118 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:46.782104] DEBUG 343119118 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:46.782319] ERROR 343119118 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:46.782538] DEBUG 343119118 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.001179): None
[2015-04-01 19:10:46.786972] INFO 343119118 Request started. GET /site_media/images/yahoo-icon.png <QueryDict: {}> logged_in_user:-
[01/Apr/2015 19:10:46] "GET /site_media/images/yahoo-icon.png HTTP/1.1" 200 1867
[2015-04-01 19:10:51.393589] DEBUG 167042525 Calling: init_maindb (module clearinghouse.common.api.maindb), args: (), kwargs: ().
[2015-04-01 19:10:51.395308] DEBUG 167042525 Resetting django query log because settings.DEBUG is True.
[2015-04-01 19:10:51.395711] ERROR 167042525 Reminder: settings.DEBUG is True. Don't run in production like this!
[2015-04-01 19:10:51.396215] DEBUG 167042525 Returning from init_maindb (module clearinghouse.common.api.maindb) (time 0:00:00.002413): None
[2015-04-01 19:10:51.403128] INFO 167042525 Request started. GET /html/register <QueryDict: {}> logged_in_user:-
[2015-04-01 19:10:51.403830] DEBUG 167042525 Calling: get_logged_in_user (module clearinghouse.website.control.interface), args: ('<HttpRequest>',), kwargs: ().
[2015-04-01 19:10:51.403980] DEBUG 167042525 Exception from get_logged_in_user (module clearinghouse.website.control.interface): <class 'clearinghouse.common.exceptions.DoesNotExistError'> 
[01/Apr/2015 19:10:51] "GET /html/register HTTP/1.1" 200 4339
ch@ubuntu:~/deployment/clearinghouse$ python website/manage.py runserver 8000
/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.28-py2.7.egg/social_auth/models.py:4: RemovedInDjango19Warning: django.utils.importlib will be removed in Django 1.9.
  from django.utils.importlib import import_module

/usr/local/lib/python2.7/dist-packages/django_social_auth-0.7.28-py2.7.egg/social_auth/utils.py:14: 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

Traceback (most recent call last):
  File "website/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/ch/deployment/clearinghouse/website/control/admin.py", line 18, in <module>
    from clearinghouse.common.api import maindb
  File "/home/ch/deployment/clearinghouse/common/api/maindb.py", line 162, in <module>
    @transaction.commit_manually
AttributeError: 'module' object has no attribute 'commit_manually'
@SantiagoTorres
Copy link
Contributor

Yes, PPH supports Django 1.7. I haven't tested for 1.8 but I can start looking.

From what I see in the trace, migration to 1.7 shouldn't be too hard 👍 I think the integration of PPH on ch for Django 1.7 should be transparent, but let me know if any issues arise.

@aaaaalbert
Copy link
Contributor Author

Under review by @lukpueh.

@lukpueh lukpueh self-assigned this May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants