{"action":"created","issue":{"url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/294","labels_url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/294/labels{/name}","comments_url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/294/comments","events_url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/294/events","html_url":"https://github.com/evonove/django-oauth-toolkit/issues/294","id":107177449,"number":294,"title":"\"can't compare datetime.datetime to NoneType\" for accestoken expires","user":{"login":"teuneboon","id":571486,"avatar_url":"https://avatars.githubusercontent.com/u/571486?v=3","gravatar_id":"","url":"https://api.github.com/users/teuneboon","html_url":"https://github.com/teuneboon","followers_url":"https://api.github.com/users/teuneboon/followers","following_url":"https://api.github.com/users/teuneboon/following{/other_user}","gists_url":"https://api.github.com/users/teuneboon/gists{/gist_id}","starred_url":"https://api.github.com/users/teuneboon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teuneboon/subscriptions","organizations_url":"https://api.github.com/users/teuneboon/orgs","repos_url":"https://api.github.com/users/teuneboon/repos","events_url":"https://api.github.com/users/teuneboon/events{/privacy}","received_events_url":"https://api.github.com/users/teuneboon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-18T10:35:16Z","updated_at":"2015-09-18T12:36:25Z","closed_at":"2015-09-18T12:36:25Z","body":"I'm running an API using django-oauth-toolkit and django-restframework. This always ran fine, recently I wanted to be able to test the API locally on my pc(Debian 8, Python 2.7.9, latest pip django-oauth-toolkit and django) and this error started to occur on every API call:\r\n\r\n```\r\nEnvironment:\r\n\r\n\r\nRequest Method: GET\r\nRequest URL: http://127.0.0.1:8081/v3/users/current/\r\n\r\nDjango Version: 1.8.3\r\nPython Version: 2.7.9\r\nInstalled Applications:\r\n('django.contrib.admin',\r\n 'django.contrib.auth',\r\n 'django.contrib.contenttypes',\r\n 'django.contrib.sessions',\r\n 'django.contrib.messages',\r\n 'django.contrib.staticfiles',\r\n 'oauth2_provider',\r\n 'corsheaders',\r\n 'rest_framework',\r\n 'apm')\r\nInstalled Middleware:\r\n('django.contrib.sessions.middleware.SessionMiddleware',\r\n 'corsheaders.middleware.CorsMiddleware',\r\n 'django.middleware.common.CommonMiddleware',\r\n 'oauth2_provider.middleware.OAuth2TokenMiddleware',\r\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\r\n 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',\r\n 'django.contrib.messages.middleware.MessageMiddleware')\r\n\r\n\r\nTraceback:\r\nFile \"/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py\" in get_response\r\n  108.                 response = middleware_method(request)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/middleware.py\" in process_request\r\n  28.                 user = authenticate(request=request)\r\nFile \"/usr/local/lib/python2.7/dist-packages/django/contrib/auth/__init__.py\" in authenticate\r\n  74.             user = backend.authenticate(**credentials)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/backends.py\" in authenticate\r\n  17.             valid, r = oauthlib_core.verify_request(request, scopes=[])\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/oauth2_backends.py\" in verify_request\r\n  155.         valid, r = self.server.verify_request(uri, http_method, body, headers, scopes=scopes)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/endpoints/base.py\" in wrapper\r\n  64.             return f(endpoint, uri, *args, **kwargs)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/endpoints/resource.py\" in verify_request\r\n  75.         return token_type_handler.validate_request(request), request\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauthlib/oauth2/rfc6749/tokens.py\" in validate_request\r\n  286.             token, request.scopes, request)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/oauth2_validators.py\" in validate_bearer_token\r\n  225.             if access_token.is_valid(scopes):\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/models.py\" in is_valid\r\n  193.         return not self.is_expired() and self.allow_scopes(scopes)\r\nFile \"/usr/local/lib/python2.7/dist-packages/oauth2_provider/models.py\" in is_expired\r\n  199.         return timezone.now() >= self.expires\r\n\r\nException Type: TypeError at /v3/users/current/\r\nException Value: can't compare datetime.datetime to NoneType\r\n```\r\n\r\nFound the most relevant line in the repository as well: https://github.com/evonove/django-oauth-toolkit/blob/master/oauth2_provider/models.py#L199\r\n\r\nI'm using the exact same database for my local environment as I was using on the server it worked. There are no access tokens in the database without an expire.\r\n\r\nAm I doing something wrong or did I encounter a bug?"},"comment":{"url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/comments/141440006","html_url":"https://github.com/evonove/django-oauth-toolkit/issues/294#issuecomment-141440006","issue_url":"https://api.github.com/repos/evonove/django-oauth-toolkit/issues/294","id":141440006,"user":{"login":"teuneboon","id":571486,"avatar_url":"https://avatars.githubusercontent.com/u/571486?v=3","gravatar_id":"","url":"https://api.github.com/users/teuneboon","html_url":"https://github.com/teuneboon","followers_url":"https://api.github.com/users/teuneboon/followers","following_url":"https://api.github.com/users/teuneboon/following{/other_user}","gists_url":"https://api.github.com/users/teuneboon/gists{/gist_id}","starred_url":"https://api.github.com/users/teuneboon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teuneboon/subscriptions","organizations_url":"https://api.github.com/users/teuneboon/orgs","repos_url":"https://api.github.com/users/teuneboon/repos","events_url":"https://api.github.com/users/teuneboon/events{/privacy}","received_events_url":"https://api.github.com/users/teuneboon/received_events","type":"User","site_admin":false},"created_at":"2015-09-18T12:36:25Z","updated_at":"2015-09-18T12:36:25Z","body":"Please ignore, I failed and didn't upgrade my pip packages correctly"}}