taroved / pol

RSS generator website
MIT License
381 stars 88 forks source link

HTTP 500 while creating new feed: Field 'owner_id' doesn't have a default value #29

Closed SlavikCA closed 5 years ago

SlavikCA commented 5 years ago

I set up POL on my Ubuntu And tried to create feed for my test page: https://music.slavikf.com/logs/test2.php

And I got HTTP 500 for /setup_create_feed page

Request body:

{"html":["html",{"tag-id":"1"},[["body",{"tag-id":"2"},[["br",{"tag-id":"3"},[]],["br",{"tag-id":"4"},[]],["br",{"tag-id":"5"},[]],["br",{"tag-id":"6"},[]],["br",{"tag-id":"7"},[]],["br",{"tag-id":"8"},[]]]]]],"names":{"title":"2","description":"2"},"url":"https://music.slavikf.com/logs/test2.php"}

Response:

IntegrityError at /setup_create_feed
(1364, "Field 'owner_id' doesn't have a default value")

Request Method: POST
Request URL: http://192.168.0.203:8000/setup_create_feed
Django Version: 1.8.6
Python Executable: /usr/bin/python
Python Version: 2.7.12
Python Path: ['/var/www/pol/frontend', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
Server time: Sun, 30 Jun 2019 06:02:36 +0000
Installed Applications:
('django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'pipeline',
 'frontend')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/pol/frontend/frontend/views.py" in setup_create_feed
  129.         feed_id = _create_feed(url, xpathes)
File "/var/www/pol/frontend/frontend/views.py" in _create_feed
  102.     feed.save()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in save
  734.                        force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in save_base
  762.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in _save_table
  846.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py" in _do_insert
  885.                                using=using, raw=raw)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in manager_method
  127.                 return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in _insert
  920.         return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql
  974.                 cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py" in __exit__
  98.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "/usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py" in execute
  124.             return self.cursor.execute(query, args)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py" in execute
  226.             self.errorhandler(self, exc, value)
File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py" in defaulterrorhandler
  36.         raise errorvalue

Exception Type: IntegrityError at /setup_create_feed
Exception Value: (1364, "Field 'owner_id' doesn't have a default value")
Request information:
GET: No GET data

POST: No POST data

FILES: No FILES data
...

Same page works fine on public site

SlavikCA commented 5 years ago

ok, fixed by this:

ALTER TABLE frontend_feed ALTER `owner_id` SET DEFAULT NULL;
ALTER TABLE frontend_feed ALTER `name` SET DEFAULT NULL;

Can you add that, as a migration?