简体   繁体   English

Django REST Framework:禁用所有内置模式的迁移,即,(身份验证内容类型。管理员等)

[英]Django REST Framework: Disable migration of all built in schemas, i.e., (auth. contenttypes. admin., etc.)

I would like to disable migrations for all built in schemas, ie, auth., contenttypes. 我想禁用所有内置模式(即身份验证,内容类型)的迁移。 admin., etc. I'm not using any of these and they really slow down testing. 管理员等。我没有使用这些工具,它们确实减慢了测试速度。 Is it possible to easily disable migrations for these schemas? 是否可以轻松禁用这些模式的迁移?

If you aren't using an app, it is perfectly acceptable to remove it from your INSTALLED_APPS in your projects's settings.py . 如果您不使用应用程序,则可以将其从项目的settings.py INSTALLED_APPS中删除。 This is what I have, and I don't have unused apps clogging my migration history. 这就是我所拥有的,并且我没有未使用的应用程序阻塞了我的迁移历史记录。

INSTALLED_APPS = [
    'django.contrib.contenttypes',
    'my_app_name_redacted',
]

If you are using it, you need to do the migrations for them to work properly. 如果使用它,则需要进行迁移,以使其正常工作。

Incidentally, if you want to only migrate for a specific app, but keep them installed so you can later, you can add the app name in the manage.py migrate command. 顺便说一句,如果你希望迁移特定应用的,但让他们安装,以便您可以稍后,您可以在添加应用程序名称manage.py migrate命令。

python manage.py makemigrations my_app_name_redacted
python manage.py migrate my_app_name_redacted

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决应用程序的 29 个未应用的迁移:admin、api、auth、authtoken、contenttypes、sessions、social_django - How can I solve the 29 unapplied migration(s) for app(s): admin, api, auth, authtoken, contenttypes, sessions, social_django 禁用 Django model 管理按钮(保存、删除等) - Disable Django model admin buttons (save, delete, etc.) 无法使用Bokeh服务器以交互方式更新渲染器(即圆形,三角形等)的大小 - Unable to interactively update renderer (i.e. circle, triangle, etc.) size using Bokeh server Django 中的内容类型框架 - contenttypes framework in Django Django`auth`和`contenttypes`打破了syncdb - Django `auth` and `contenttypes` breaks syncdb 如何从内置身份验证实现的用户表单中保存数据。 用户在 Django 中使用 UserCreationForm? - How to save data from the User form that is implemented by built-in auth. User using UserCreationForm in Django? Django Admin。 在日期之后禁用`list_editable`字段进行编辑? - Django Admin. Disable `list_editable` fields for editing after date? Django:运行测试时迁移期间的ContentTypes - Django: ContentTypes during migration while running tests 使用 django auth 实现 sso。 这安全吗? - Implementation of sso with django auth. Is this safe? Django管理员。 显示分层下拉过滤器 - Django admin. Displaying a hierarchical dropdown filter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM