1
votes

I get this error

"ProgrammingError at /admin/ relation "django_admin_log" does not exist LINE 1: ..."."app_label", "django_content_type"."model" FROM "django_ad..."

django_admin_log table does not exist in the database. Does anyone know how I can create it? I am not worried about deleting the data for my app.

when i try './manage.py sqlmigrate admin 0001' or './manage.py sqlmigrate admin 0001'

i get "

BEGIN;

-- Create model LogEntry

CREATE TABLE "django_admin_log" ("id" serial NOT NULL PRIMARY KEY, "action_time" timestamp with time zone NOT NULL, "object_id" text NULL, "object_repr" varchar(200) NOT NULL, "action_flag" smallint NOT NULL CHECK ("action_flag" >= 0), "change_message" text NOT NULL, "content_type_id" integer NULL, "user_id" integer NOT NULL); ALTER TABLE "django_admin_log" ADD CONSTRAINT "django_admin_content_type_id_c4bce8eb_fk_django_content_type_id" FOREIGN KEY ("content_type_id") REFERENCES "django_content_type" ("id") DEFERRABLE INITIALLY DEFERRED; ALTER TABLE "django_admin_log" ADD CONSTRAINT "django_admin_log_user_id_c564eba6_fk_auth_user_id" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED; CREATE INDEX "django_admin_log_417f1b1c" ON "django_admin_log" ("content_type_id"); CREATE INDEX "django_admin_log_e8701ad4" ON "django_admin_log" ("user_id"); COMMIT;"

but i still get the same error? i use postgresql if anyone cares.

3

3 Answers

2
votes

experienced the same issue, the best way is to copy the CREATE TABLE log, login to your database ./manage.py dbshell and Paste the content over there without adding the last line (COMMIT ) it will solve the problem and manually create the table for you.

0
votes

In order to create the table from scratch for Django 1.7 > :

./manage.py sqlmigrate admin 0001
0
votes

After ./manage.py sqlmigrate admin 0001, please run python manage.py migrate.