Django-nonrel: Syntax to Reset an App

☆樱花仙子☆ 提交于 2019-12-24 11:16:34

问题


To reset my app, I ran this:

./manage.py reset node

It is giving me this error output:

WARNING:root:The rdbms API is not available because the MySQLdb library could not be loaded.
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/a/mywebsites/django/seperolinux/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/base.py", line 286, in handle
    app_output = self.handle_app(app, **options)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/commands/reset.py", line 35, in handle_app
    sql_list = sql_reset(app, self.style, connection)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/sql.py", line 107, in sql_reset
    return sql_delete(app, style, connection) + sql_all(app, style, connection)
  File "/home/a/mywebsites/django/seperolinux/django/core/management/sql.py", line 66, in sql_delete
    table_names = connection.introspection.get_table_list(cursor)
AttributeError: 'DatabaseIntrospection' object has no attribute 'get_table_list'

How do I reset a Model in Django-nonrel?


回答1:


./manage.py reset node

executes sqlreset to create DROPT TABLE and CREATE TABLE SQL statements for the given app.

https://docs.djangoproject.com/en/1.3/ref/django-admin/#reset-appname-appname

This does not work with the App Engine Datastore, because the Datastore is schemaless so there is no need for CREATE/DROP table commands.

If you want to delete existing model from the datastore, you can use the App Engine Development Console to delete all entities of the model (just make sure you use the correct port when accessing the Development Console) .



来源:https://stackoverflow.com/questions/11373310/django-nonrel-syntax-to-reset-an-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!