相关疑难解决方法(0)

PostgreSQL"DESCRIBE TABLE"

你如何DESCRIBE TABLE在PostgreSQL中使用相应的Oracle (使用psql命令)?

postgresql table-structure psql

1790
推荐指数
17
解决办法
110万
查看次数

在django测试期间加载夹具时的IntegrityError

我正在加载使用dumpdata创建的fixture,并获得以下异常:

Problem installing fixture 'db_dump.json': Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/django/core/management/commands/loaddata.py", line 174, in handle
    obj.save(using=using)
  File "/usr/lib/python2.6/site-packages/django/core/serializers/base.py", line 165, in save
    models.Model.save_base(self.object, using=using, raw=True)
  File "/usr/lib/python2.6/site-packages/django/db/models/base.py", line 526, in save_base
    rows = manager.using(using).filter(pk=pk_val)._update(values)
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 491, in _update
    return query.get_compiler(self.db).execute_sql(None)
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 869, in execute_sql
    cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.6/site-packages/django/db/backends/sqlite3/base.py", line 234, in execute
    return Database.Cursor.execute(self, query, params)
IntegrityError: columns app_label, model are not unique
Run Code Online (Sandbox Code Playgroud)

这是一个sqlite3后端.

更新:使用自然键在这里没有区别. …

django django-testing django-fixtures

24
推荐指数
2
解决办法
6902
查看次数

测试Django allauth

我正在尝试测试我的应用程序但不确定如何在测试环境中配置django-allauth.我正进入(状态:

ImproperlyConfigured: No Facebook app configured: please add a SocialApp using the Django admin

到目前为止,我的方法是tests.py使用实际的Facebook应用程序参数实例化app对象,这是一个在浏览器中本地正常运行的应用程序:

from allauth.socialaccount.models import SocialApp

apper = SocialApp.objects.create(provider=u'facebook', 
    name=u'fb1', client_id=u'7874132722290502',
    secret=u'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
apper.sites.create(domain='localhost:8000', name='creyu.org')
Run Code Online (Sandbox Code Playgroud)

我怎样才能运行这些测试?谢谢

python testing django facebook django-allauth

6
推荐指数
1
解决办法
913
查看次数

IntegrityError:(1062,密钥重复输入)

我试图清除我的数据库,mydb并重新填充它以查看我的Django模型的一些更改的影响.然后这一切都发生了.我回滚到我早期的模型设置,但我仍然得到错误.

我不是MySQL专家,我不能完全弄清楚问题以及如何处理它; 我尝试使用其他名称创建一个新数据库,但这没有发生.我认为这是我的Django项目创建的问题.

这是所有信息:


C:\Users...>python manage.py syncdb
Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table forum_category
Creating table forum_thread

Creating table forum_post

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes …

python mysql django

3
推荐指数
1
解决办法
1万
查看次数