还没有为我创建django_admin_log

时间:2014-05-03 23:11:47

标签: database django configuration

我正在使用Django 1.5.4版,我按照这里的说明进行操作

http://www.tangowithdjango.com/book/chapters/models.html

但我找不到django_admin_log表。

我从

手动删除了rango.db
C:\Users\Glowie\django\tango_with_django_project

settings.py中的INSTALLED_APPS看起来像这样

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    'django.contrib.admindocs',
    'rango',
)

我执行了命令

PS C:\users\Glowie\django\tango_with_django_project> python manage.py syncdb

哪个输出:

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log
Creating table rango_category
Creating table rango_page

然后要求我定义一个超级用户,我每次都这样做.....

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):

哪个输出

Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

然后我运行命令

PS C:\users\Glowie\django\tango_with_django_project> python manage.py sql rango

哪个输出

BEGIN;
CREATE TABLE "rango_category" (
    "id" integer NOT NULL PRIMARY KEY,
    "name" varchar(128) NOT NULL UNIQUE
)
;
CREATE TABLE "rango_page" (
    "id" integer NOT NULL PRIMARY KEY,
    "category_id" integer NOT NULL REFERENCES "rango_category" ("id"),
    "title" varchar(128) NOT NULL,
    "url" varchar(200) NOT NULL,
    "views" integer NOT NULL
)
;

COMMIT;

但是django_admin_log表在哪里。文字说

  

您应该看到为您创建了表django_admin_log。   完成后,打开项目的urls.py文件。这是在   项目配置目录。

我在哪里可以找到django_admin_log? 请告诉我"项目配置目录"。

1 个答案:

答案 0 :(得分:1)

django_admin_log是您在运行python manage.py syncdb时创建的表格。它显示在您发布的终端输出中,在您运行syncdb后显示:

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_groups
Creating table auth_user_user_permissions
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log  <---RIGHT HERE
Creating table rango_category
Creating table rango_page

这个表现在不必担心它实际上已经创建了。真正的关键是在项目配置目录中找到urls.py

项目配置目录是项目目录中与项目目录同名的目录。从早期的Tango with Django tutorial

开始
  

现在,您将在工作区中注意到设置为名称的目录   您的新项目tango_with_django_project。在这新   创建目录,您应该看到两个项目:

     
      
  • 与您的项目名称相同的另一个目录,tango_with_django_project ;和
  •   
  • 一个名为manage.py的Python脚本。
  •   
     

出于本教程的目的,我们将此嵌套目录称为   项目配置目录。在这个目录中,你会发现   四个Python脚本。我们稍后将详细讨论这些脚本,   但是现在你应该看到:

因此,根据您的目录结构,您的项目配置目录位于:

PS C:\users\Glowie\django\tango_with_django_project\tango_with_django_project>

并且教程要求您打开该目录中的urls.py文件。

相关问题