小编Hak*_*kim的帖子

mysql致命错误:无法为缓冲池分配内存

我有MySQL的这个错误日志,任何想法?网站工作了一段时间,然后我在几个小时后完全关闭了MySQL.

140919 10:48:27 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140919 10:48:27 [Note] Plugin 'FEDERATED' is disabled.
140919 10:48:27 InnoDB: The InnoDB memory heap is disabled
140919 10:48:27 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140919 10:48:27 InnoDB: Compressed tables use zlib 1.2.3.4
140919 10:48:28 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140919 10:48:28 InnoDB: …
Run Code Online (Sandbox Code Playgroud)

mysql innodb

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

django 两个外键到同一模型 - 管理错误

我有一个 Profiles 应用程序,它有一个名为 profile 的模型,我使用该模型来扩展 django 内置的用户模型,而无需对其进行子类化。

模型.py

class BaseProfile(models.Model):
    user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='owner',primary_key=True)
    supervisor = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='supervisor', null=True, blank=True)

@python_2_unicode_compatible
class Profile(BaseProfile):
    def __str__(self):
        return "{}'s profile". format(self.user)
Run Code Online (Sandbox Code Playgroud)

管理文件

class UserProfileInline(admin.StackedInline):
    model = Profile

class NewUserAdmin(NamedUserAdmin):
    inlines = [UserProfileInline ]

admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
Run Code Online (Sandbox Code Playgroud)

行政

错误是

<class 'profiles.admin.UserProfileInline'>: (admin.E202) 'profiles.Profile' has more than one ForeignKey to 'authtools.User'.
Run Code Online (Sandbox Code Playgroud)

显然我想选择一个用户作为另一个用户的主管。我认为模型中的关系是可以的,抱怨的是 admins.py 文件。任何的想法 ?

python django

2
推荐指数
1
解决办法
1797
查看次数

标签 统计

django ×1

innodb ×1

mysql ×1

python ×1