- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个在我的 PC 上慢慢建立的项目,它运行良好。我只是想把它放到服务器上,但我收到了这个错误:
django.db.utils.ProgrammingError: relation "django_content_type" does not exist
Traceback (most recent call last):
File "manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 371, in execute_from_command_line
utility.execute()
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/__init__.py", line 365, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **cmd_options)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/base.py", line 332, in execute
self.check()
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/base.py", line 364, in check
include_deployment_checks=include_deployment_checks,
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 58, in _run_checks
issues.extend(super()._run_checks(**kwargs))
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/management/base.py", line 351, in _run_checks
return checks.run_checks(**kwargs)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/checks/registry.py", line 73, in run_checks
new_errors = check(app_configs=app_configs)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/checks/urls.py", line 40, in check_url_namespaces_unique
all_namespaces = _load_all_namespaces(resolver)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/core/checks/urls.py", line 57, in _load_all_namespaces
url_patterns = getattr(resolver, 'url_patterns', [])
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/urls/resolvers.py", line 540, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/utils/functional.py", line 36, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/urls/resolvers.py", line 533, in urlconf_module
return import_module(self.urlconf_name)
File "/var/www/jobsite/env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/jobsite/jobsite/urls.py", line 32, in <module>
path('', include('user_management.urls')),
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/urls/conf.py", line 34, in include
urlconf_module = import_module(urlconf_module)
File "/var/www/jobsite/env/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/var/www/jobsite/user_management/urls.py", line 3, in <module>
from user_management import views
File "/var/www/jobsite/user_management/views.py", line 11, in <module>
from user_management.forms import ApplicantSignUpForm, CompanySignUpForm, CompanyUserSignUpForm, ApplicationForm
File "/var/www/jobsite/user_management/forms.py", line 82, in <module>
class ApplicationForm(forms.ModelForm):
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/forms/models.py", line 256, in __new__
apply_limit_choices_to=False,
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/forms/models.py", line 172, in fields_for_model
formfield = f.formfield(**kwargs)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/fields/related.py", line 953, in formfield
'queryset': self.remote_field.model._default_manager.using(using),
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/jobsite/env/lib/python3.5/site-packages/secretballot/__init__.py", line 59, in get_queryset
content_type = ContentType.objects.get_for_model(self.model).id
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/contrib/contenttypes/models.py", line 51, in get_for_model
ct = self.get(app_label=opts.app_label, model=opts.model_name)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/query.py", line 397, in get
num = len(clone)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/query.py", line 254, in __len__
self._fetch_all()
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/query.py", line 1179, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/query.py", line 53, in __iter__
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1068, in execute_sql
cursor.execute(sql, params)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/var/www/jobsite/env/lib/python3.5/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "django_content_type" does not exist
LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_co...
class ApplicationForm(forms.ModelForm):
class Meta:
model = Application
exclude = ['applied_at']
widgets = {
'job' : forms.HiddenInput(),
'user' : forms.HiddenInput(),
'apply_name' :forms.TextInput(attrs={ "class" : 'form-control'}),
'apply_email' : forms.EmailInput(attrs={ "class" : 'form-control'}),
'apply_cv' : forms.FileInput(attrs={'class' : 'form-control',
'id' : 'input-file'}),
'ip_address' : forms.HiddenInput()
}
最佳答案
阿兰整理了一下。
这发生在第一次迁移时。
问题是 urls.py
.
环绕您的 url_patterns = [...]
里面try-Except
构造,并在异常部分设置 urlpatterns=[]。您的错误可能正在发生,因为您的代码正在尝试使用尚未设置的数据库执行操作。
关于django.db.utils.ProgrammingError : relation "django_content_type" does not exist,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52745693/
我知道,关系数据库是一种数据库,其中一个表中的字段链接到其他表中的行,就像这样。 但我不明白这对我作为网络开发人员意味着什么! 据我所知,具有联接和嵌套选择的查询会降低性能(尤其是具有数十个联接的 d
我正在逻辑层面上设计一个数据库,以便稍后将其传递给程序员来交付。我只是粗略地了解它们的工作原理,所以我很难简洁地表达我的问题。这是我的问题: 我有一个名为 MEANINGS 的表。 我有一个名为 WO
在 Jira 中,将项目链接在一起既简单又实用。 例如,您可以轻松克隆一个问题:创建问题 100,将其克隆到 101。100 然后显示“这个问题有一个克隆:101”,然后 101 显示“这个问题是一个
所以我有这些实体: Group { id: number; name: string; persons: Person[]; } Person { name: stri
我真不敢相信,经过 5 年的 Rails 编程,我还没有想出一个好的解决方案来解决这个常见问题。另外,我假设这个特定问题有 100 个答案,但我不知道定义(关系?协会?等)来很好地搜索它。所以我们开始
我想在我的数据库记录中包含动态字段。 例如:我想构建一个应用程序供用户创建自己的表单。 用户可以创建以下表单: 个人资料: 全名 街道 工作 电话 首页 工作 移动 兴趣 兴趣 1 兴趣 2 兴趣 3
共有三个表:businesses、categories、categorizations、 CREATE TABLE businesses ( id SERIAL PRIMARY KEY, na
这个问题在这里已经有了答案: How can I vertically center a div element for all browsers using CSS? (48 个答案) 关闭 6
对于问题的错误措辞,我们深表歉意。我是 stackoverflow 的新手,也是 PIG 的新手,正在尝试自己进行实验。 我有一个处理 words.t 文件和 data.txt 文件的场景。 文字.t
关于像Cassandra 这样的反革命NoSQL 数据库的讨论很多。 , CouchDB , Hypertable , MongoDB , Project Voldemort , BigTable ,
我的处境与ICTylor's post here 类似。 . 所以我有: user1=User.find(1); user2=User.find(2); written=Micropost.where
尝试获取与事件关联的用户列表。这是我 Eloquent 模型: 用户.php: public function fbevents() { $this->belongsToMany('Fbeve
我有一个在 MySQL 数据库上运行的 Web 应用程序(正在开发中)。我正在考虑将我的应用程序迁移到 Google App Engine,并希望更好地了解如何将我的简单关系数据库模型转换为非关系方法
我应该在构造函数中放入什么:与实例相关的东西还是与类相关的东西? 考虑这段代码: var count = 0 TView = function (x, y) { this.x = x, this.y
我正在努力使用 postgreSQL,因为我不知道如何将 A 类型的一个实例链接到 B 类型的一组实例。我将举一个简短的例子: 假设我们要建立一个包含音乐专辑和人物的数据库,每个人都有一个他们最喜欢的
我需要检索一个对象并获取关系和嵌套关系。 所以,我有以下三个模型: 用户模型: module.exports = { attributes: { name: { type: '
给定一个表定义: Articles: art_id | name -------|-------------- 1 | article1 2 | article2 3
谁能举例说明“em 是相对于字体大小的,% 是相对于父元素的”? 相对于字体大小和相对于父元素是什么意思? 最佳答案 考虑一下您是否要在另一个框内定义一个框的高度。如果您将高度指定为 50%,它将是包
我有一个多对多关系,当我加载位于此关系一侧的实体时,我希望将另一侧相关实体的 ArrayCollection 视为其属性。然而,这并没有发生——加载的 ArrayCollection 中没有任何元素,
Relation#update(id, attributes) 文档提到“无论对象是否成功保存到数据库,都会返回结果对象。”,而 Relation#update_all (updates, condi
我是一名优秀的程序员,十分优秀!