- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Django 1.11 制作应用程序“cnfs”,并使用 MYSQL 数据库。我经常遇到这个问题,当我输入以下代码时,我收到这样的错误:
$python manage.py migrate
System check identified some issues: WARNINGS: ?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default' HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode Operations to perform: Apply all migrations: admin, auth, cnfs, contenttypes, sites Running migrations: No migrations to apply. Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/init.py", line 363, in execute_from_command_line utility.execute() File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/init.py", line 355, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv self.execute(*args, **cmd_options) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute output = self.handle(*args, **options) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 227, in handle self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan, File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/management/sql.py", line 53, in emit_post_migrate_signal **kwargs File "/home/ubuntu/.local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 193, in send for receiver in self._live_receivers(sender) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/contrib/sites/management.py", line 20, in create_default_site if not Site.objects.using(using).exists(): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/query.py", line 670, in exists return self.query.has_results(using=self.db) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/query.py", line 517, in has_results return compiler.has_results() File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 845, in has_results return bool(self.execute_sql(SINGLE)) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql raise original_exception django.db.utils.ProgrammingError: (1146, "Table 'cnfs.django_site' doesn't exist")
我确实花了几天时间在这上面,当我使用默认的 django 数据库引擎 sqlite3 时,我没有遇到这个问题。我尝试这样做: $python manage.py 迁移站点
我的 SITE_ID 设置已设为 1。我尝试从 INSTALLED_APPS 设置中删除“django.contrib.sites”,但这会引发此错误:
Internal Server Error: / Traceback (most recent call last): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = get_response(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/django/utils/deprecation.py", line 138, in call response = self.process_request(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 62, in process_request super(SubdomainURLRoutingMiddleware, self).process_request(request) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 38, in process_request (self.get_domain_for_request(request), request.get_host())) File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/middleware.py", line 31, in get_domain_for_request return get_domain() File "/home/ubuntu/.local/lib/python2.7/site-packages/subdomains/utils.py", line 12, in current_site_domain from django.contrib.sites.models import Site File "/home/ubuntu/.local/lib/python2.7/site-packages/django/contrib/sites/models.py", line 84, in class Site(models.Model): File "/home/ubuntu/.local/lib/python2.7/site-packages/django/db/models/base.py", line 118, in new "INSTALLED_APPS." % (module, name) RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
如有任何建议,我们将不胜感激。
谢谢。
最佳答案
从已安装的应用程序中取消注释 django.contrib.sites
然后
python manage.py migrate sites
python manage.py migrate
如果数据库中的表很少,请删除这些表,然后运行此
关于mysql - 1146 "app_name.django_site missing",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44628923/
我已经看到有两种方法可以将 Django 应用程序添加到 settings .假设应用程序是 app_name ,我见过以下模式: 使用 app_name INSTALLED_APPS = [
大家好,我编辑了这篇文章,但仍然出现错误,请有人帮忙。 错误是: File "C:\Users\myshop\myshop\urls.py", line 25, in url(r'^',
我将应用程序的名称定义为字符串中的“MyApp”,并将 list 文件中的应用程序名称引用到该字符串: 字符串.xml: ... MyApp .... list .xml: 但是,当我现在在我的设备
我实际上将条码扫描器 (ZXing) 作为一个库集成到我的应用程序中,因此用户无需下载 BarcodeScanner 应用程序,我可以添加一些用例。 我没有任何功能问题,我的应用程序按预期工作,但我在
我正在使用django-2.0为我的网站制作博客应用程序 当我运行服务器时,我看到以下错误 File "C:\Users\User\Desktop\djite\djite\djite\urls.py"
我正在尝试开发一个非常简单的应用程序,用于计算住房抵押贷款支付的总利息。有2个屏幕。第一个要求用户输入每月还款额、贷款年限和初始贷款金额。第一个屏幕加载得很好。但是,当单击该按钮时,我得到了“不幸的是
我希望能够快速直观地验证我的模拟器上是否安装了新版本。我正在考虑的一种方法是让 @string/app_name 值在每个新构建时使用唯一的哈希更新,或者可能只是一个随机的四个字符值。然后,当我在手机
这个问题在这里已经有了答案: How to change the name of application in Launcher in android according to the langua
所以,我通过这个学习 django http://mherman.org/blog/2012/12/30/django-basics/教程,我有一个问题。 我在数据库中添加了几本书,但在管理站点中我只
我收到这些错误 不支持在不提供 app_name 的情况下在 include() 中指定命名空间。在包含的模块中设置 app_name 属性,或者传递一个包含模式列表和 app_name 的 2 元组
我配置了电话验证服务但是,当我收到短信时,它显示一些残暴的内容。 我得到类似“firebase-生产.app...” 如何解决? 最佳答案 根据Firebase Help ,要更改 APP_NAME,
我在 Facebook 上创建了一个应用程序。感谢这个应用程序,用户可以在他们的墙上发布。一切正常,但我想指定一个 url 以在用户单击出版物上的“通过 {APP_NAME}”链接时重定向到。目前,它
首先,我知道这个问题已经被问过很多次了,但我已经尝试了所有这些答案,但仍然没有运气。让我解释一下。 我有 2 个应用程序,1 个库存应用程序,以及一个添加了 fino 工具的应用程序 (sysdrea
我在 Facebook 上创建了一个应用程序。感谢这个应用程序,用户可以在他们的墙上发布。一切正常,但我想指定一个 url 以在用户单击出版物上的“通过 {APP_NAME}”链接时重定向到。目前,它
我在使用 facebook 登录时遇到问题。我将 Facebook 集成到我的应用程序中。用户第一次登录时,它显示登录页面,但从下一次开始,它会转到“您已经授权 APP_NAME”页面。 我检查了 S
我正在使用 Django 1.11 制作应用程序“cnfs”,并使用 MYSQL 数据库。我经常遇到这个问题,当我输入以下代码时,我收到这样的错误: $python manage.py migrate
我创建了 .xcconfig 文件来存储 应用程序包 ID 和 应用程序名称,以便我可以针对开发、暂存和生产环境更改它. 但是当我在目标身份中输入 $(APP_BUNDLE_ID) 并按 Enter
productFlavors { dev { applicationId project.property('ANDROID_BUILD_APPLICATIONID_DEV')
我刚刚完成了一个新应用的开发。在发布应用程序之前,我使用了我的两台设备(运行 4.02 的 Galaxy Nexus 和运行 3.1 的 Galaxy Tab10.1)来测试该应用程序。 当我将应用程
我很难理解 app_name 和命名空间之间的联系。 考虑项目级别的urls.py from django.urls import path, include urlpatterns = [
我是一名优秀的程序员,十分优秀!