"RuntimeError: не удалось получить последний идентификатор вставки" на моем MySQL - PullRequest
0 голосов
/ 20 декабря 2018

Я пытаюсь установить пакет Prelude и пакет Prewikka из этих источников .Я следую всем инструкциям этого ManualUser .

я уже собираю все источники без ошибок на моем Ubuntu, но когда я пытаюсь подключиться к localhost:8000, я получаю ошибки со стороны сервера:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/local/lib/python2.7/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/local/lib/python2.7/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 152, in _init_system_job
    res = env.db.query("SELECT 1 FROM Prewikka_Crontab WHERE ext_type=%s AND userid IS NULL", ext_type)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 547, in query
    return preludedb.SQL.query(self, sql)
RuntimeError: Table 'prewikka.Prewikka_Crontab' doesn't exist

, поэтому я пытаюсь создать базу данных таблицвручную:

mysql> desc Prewikka_Crontab;
+----------+-----------+------+-----+---------+-------+
| Field    | Type      | Null | Key | Default | Extra |
+----------+-----------+------+-----+---------+-------+
| id       | int(11)   | YES  | UNI | NULL    |       |
| name     | char(255) | NO   | PRI | NONE    |       |
| userid   | int(11)   | YES  | UNI | NULL    |       |
| schedule | char(255) | NO   | UNI | NONE    |       |
| ext_type | char(255) | NO   | UNI | NONE    |       |
| ext_id   | int(11)   | YES  | UNI | NULL    |       |
| base     | char(255) | NO   | UNI | NONE    |       |
| runcnt   | char(255) | NO   | UNI | NONE    |       |
| enabled  | char(255) | NO   | UNI | NONE    |       |
| error    | char(255) | NO   | UNI | NONE    |       |
+----------+-----------+------+-----+---------+-------+
10 rows in set (0.09 sec)

mysql>

и затем я снова пытаюсь подключиться к localhost:8000, я получаю ошибки:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 90, in _html_respond
    from prewikka import baseview
  File "/usr/local/lib/python2.7/dist-packages/prewikka/baseview.py", line 27, in <module>
    from prewikka import error, history, hookmanager, resource, response, template, utils, view
  File "/usr/local/lib/python2.7/dist-packages/prewikka/history.py", line 102, in <module>
    crontab.schedule("search_history", N_("Search history deletion"), "0 * * * *", _regfunc=history._history_cron, enabled=True)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 240, in schedule
    self._init_system_job(ext_type, name, schedule, enabled, _regfunc)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/database.py", line 91, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 154, in _init_system_job
    self.add(name, schedule, ext_type=ext_type, enabled=enabled)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 219, in add
    return self.update(None, name=name, schedule=schedule, user=user, ext_type=ext_type, ext_id=ext_id, enabled=enabled)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/crontab.py", line 209, in update
    return env.db.getLastInsertIdent()
RuntimeError: could not retrieve last insert ID

Я все еще не понимаю ошибки RuntimeError: could not retrieve last insert ID на моембаза данных.

Редактировать # 1

Я попробовал @Vineesh advice, моя база данных таблицы:

mysql> DESC Prewikka_Crontab;
+----------+-----------+------+-----+---------+----------------+
| Field    | Type      | Null | Key | Default | Extra          |
+----------+-----------+------+-----+---------+----------------+
| id       | int(11)   | NO   | PRI | NULL    | auto_increment |
| name     | char(255) | NO   | UNI | NONE    |                |
| userid   | int(11)   | YES  | UNI | NULL    |                |
| schedule | char(255) | NO   | UNI | NONE    |                |
| ext_type | char(255) | NO   | UNI | NONE    |                |
| ext_id   | int(11)   | YES  | UNI | NULL    |                |
| base     | char(255) | NO   | UNI | NONE    |                |
| runcnt   | char(255) | NO   | UNI | NONE    |                |
| enabled  | char(255) | NO   | UNI | NONE    |                |
| error    | char(255) | NO   | UNI | NONE    |                |
+----------+-----------+------+-----+---------+----------------+
10 rows in set (0.03 sec)

и когда я подключаю свой сервер, яполучить ошибки:

$ prewikka-httpd
Traceback (most recent call last):
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/local/bin/prewikka-httpd", line 62, in application
    return wsgi.application(environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/web/wsgi.py", line 161, in application
    core.process(WSGIRequest(environ, start_response))
  File "/usr/local/lib/python2.7/dist-packages/prewikka/main.py", line 280, in process
    response = err.respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 106, in respond
    return self._html_respond()
  File "/usr/local/lib/python2.7/dist-packages/prewikka/error.py", line 91, in _html_respond
    return baseview.BaseView().respond(self._setup_template(self.template, False), self.code)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/view.py", line 481, in __init__
    registrar.DelayedRegistrar.__init__(self)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/registrar.py", line 46, in __init__
    i(ref)
  File "/usr/local/lib/python2.7/dist-packages/prewikka/view.py", line 583, in _add_route
    self._views_rules[rule] = v
TypeError: unhashable type: 'Rule'

что мне делать?Надеюсь, что кто-нибудь может мне помочь!

Заранее спасибо.

Ответы [ 2 ]

0 голосов
/ 25 декабря 2018

появляются ошибки вывода, потому что это очень плохая таблица в моих индексных таблицах.мне нужно удалить его и создать заново.

таблица форматирования, доступная в скрипте python по адресу здесь

таблица обязательна:

mysql> DESC Prewikka_Crontab;
+----------+---------------------+------+-----+---------+----------------+
| Field    | Type                | Null | Key | Default | Extra          |
+----------+---------------------+------+-----+---------+----------------+
| id       | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| name     | varchar(255)        | NO   |     | NULL    |                |
| userid   | varchar(32)         | YES  |     | NULL    |                |
| schedule | varchar(32)         | YES  |     | NULL    |                |
| ext_type | varchar(255)        | YES  |     | NULL    |                |
| ext_id   | int(11)             | YES  |     | NULL    |                |
| base     | datetime            | NO   |     | NULL    |                |
| enabled  | tinyint(4)          | YES  |     | 1       |                |
| runcnt   | int(11)             | YES  |     | 0       |                |
| error    | text                | YES  |     | NULL    |                |
+----------+---------------------+------+-----+---------+----------------+
10 rows in set (0.01 sec)

Надеюсь, это поможет.

0 голосов
/ 20 декабря 2018

Поле id в вашей таблице «Prewikka_Crontab» должно быть столбцом с автоинкрементом.

...