【发布时间】:2016-06-23 11:35:20
【问题描述】:
拖延了很长时间后,我决定将我的 django 应用程序从 1.7.11 升级到 1.8.13(由于它的 LTS)。一切都很顺利,在修复了一些明显的错误(我需要升级到django-mptt==0.8.4 和django-filter==0.13.0 以及Django==1.8.13)并删除了一些冲突的字段属性之后,我终于可以正常运行我的服务器了。
显然我的应用运行良好(我手动测试网站,执行 2-3 次操作,但没有发现明显错误)。
但是,在运行测试时(使用./manage.py test -v 3),我得到以下输出:
[...]
Running pre-migrate handlers for application debug_toolbar
Creating tables...
Creating table corsheaders_corsmodel
Creating table actstream_follow
Creating table actstream_action
Creating table thumbnail_kvstore
Creating table django_comments
Creating table django_comment_flags
Creating table tagging_tag
Creating table tagging_taggeditem
Creating table blog_newslettersubscription
Running deferred SQL...
Traceback (most recent call last):
File "/home/user/workspace/project/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
return self.cursor.execute(sql)
psycopg2.ProgrammingError: relation "app_user" does not exist.
应用程序app 是我的AUTH_USER_MODEL,即在我的settings.py 中:
AUTH_USER_MODEL = 'app.User'
在我的app/models.py:
class User(AbstractBaseUser):
[...]
我已经阅读了很多问题,例如this、this、this、this 以及this。而且我已经搜索了很多,但我找不到解决我的问题的方法(它们都没有奏效)。
奇怪的是,如果我检查数据库(Postgresql),该表存在。执行:
SELECT relname, reltuples, relpages * 8 / 1024 AS "MB" FROM pg_class ORDER BY relpages DESC;
返回:
relname | reltuples | MB
... | |
app_user | 4034 | 0
... | |
有什么线索吗?任何帮助将非常感激!提前致谢。
更新:
我的INSTALLED_APPS:
INSTALLED_APPS = (
'grappelli',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.gis',
'crispy_forms',
'rosetta',
'django_extensions',
'django_slack',
'filebrowser',
'mptt',
'corsheaders',
'actstream',
'compressor',
'sorl.thumbnail',
'geoposition',
'reversion',
'rest_framework',
'rest_framework.authtoken',
'rest_framework_swagger',
'rest_auth',
'django_comments',
'tagging',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'rest_auth.registration',
'import_export',
'oauth2_provider',
'places',
'tasks',
'transmeta',
'app',
)
【问题讨论】:
-
请发布您的 INSTALLED_APPS
-
现已添加。谢谢!
-
我已经设法运行了测试,但是通过取出一些应用程序。如下:
actstream、django_comments、tagging、allauth、allauth.account、allauth.socialaccount、allauth.socialaccount.providers.facebook。如果我保留其中任何一个,我就会遇到问题中显示的问题,但是使用它们进行测试并且只有三个没有通过(与这些应用程序无关)。所以我得到了一个解决方案,但我不确定这会带来什么影响(因为我从其他人那里得到了这个项目,而且我不知道这些应用程序的确切用途(即使它们被使用了)。 -
有什么方法(除了通过项目搜索)知道这些应用程序是否被实际使用以及删除它们是否有什么后果?
-
等一下,我想我刚刚发现了它
标签: python django postgresql