2015-10-15 14 views
5

Sau khi tìm kiếm lâu dài về postgre, khoảng killorphant manage.py, khoảng django_site, không có gì có thể để giúp tôi với lỗi này:Phải là chủ sở hữu của mối quan hệ django_site khi manage.py di chuyển

Synchronizing apps without migrations: 
    Creating tables... 
    Installing custom SQL... 
    Installing indexes... 
Running migrations: 
    Applying sites.0002_auto_20150929_1444...Traceback (most recent call last): 
    **File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute 
    return self.cursor.execute(sql, params) 
psycopg2.ProgrammingError: must be owner of relation django_site** 

Trường hợp ngoại lệ trên là nguyên nhân trực tiếp của ngoại lệ sau đây:

Traceback (most recent call last): 
    File "./manage.py", line 11, in <module> 
    execute_from_command_line(sys.argv) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line 
    utility.execute() 
    File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/__init__.py", line 377, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/base.py", line 288, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/base.py", line 338, in execute 
    output = self.handle(*args, **options) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 161, in handle 
    executor.migrate(targets, plan, fake=options.get("fake", False)) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/migrations/executor.py", line 68, in migrate 
    self.apply_migration(migration, fake=fake) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/migrations/executor.py", line 102, in apply_migration 
    migration.apply(project_state, schema_editor) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/migrations/migration.py", line 108, in apply 
    operation.database_forwards(self.app_label, schema_editor, project_state, new_state) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 139, in database_forwards 
    schema_editor.alter_field(from_model, from_field, to_field) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/schema.py", line 470, in alter_field 
    self._alter_field(model, old_field, new_field, old_type, new_type, old_db_params, new_db_params, strict) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/schema.py", line 642, in _alter_field 
    self.execute(self._create_unique_sql(model, [new_field.column])) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/schema.py", line 111, in execute 
    cursor.execute(sql, params) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/utils.py", line 81, in execute 
    return super(CursorDebugWrapper, self).execute(sql, params) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute 
    return self.cursor.execute(sql, params) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/utils.py", line 94, in __exit__ 
    six.reraise(dj_exc_type, dj_exc_value, traceback) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/utils/six.py", line 658, in reraise 
    raise value.with_traceback(tb) 
    File "/var/www/webapps/lib/python3.4/site-packages/django/db/backends/utils.py", line 65, in execute 
    **return self.cursor.execute(sql, params) 
django.db.utils.ProgrammingError: must be owner of relation django_site** 

Vì vậy, sau khi kiểm tra và tái kiểm tra, django-site nằm trong danh sách các ứng dụng được cài đặt, site_id = 1; cơ sở dữ liệu của tôi hoạt động ngoại trừ một số vấn đề về hình ảnh .. Sau đó, tôi đã cố gắng thực hiện một số di chuyển nhưng lỗi này tiếp tục chạy và bây giờ tôi đang tuyệt vọng tìm ra vấn đề.

Có ai đó có đầu mối về nó không?

Trả lời

12

Người dùng cơ sở dữ liệu bạn sử dụng cho django để kết nối với cơ sở dữ liệu không phải là chủ sở hữu của bảng. Bạn cần phải thay đổi nó trên vỏ postgres hoặc có thể pgadmin3 có thể giúp bạn.

Cái gì như:

ALTER DATABASE your_db OWNER TO your_django_db_user 
ALTER TABLE django_site OWNER TO your_django_db_user 
+0

Tôi đang trên một phía máy chủ, vì vậy tôi không có pgAdmin. Tôi sẽ thử những gì bạn viết ở đây. –

Các vấn đề liên quan