异常值:无此类表:example\u pos

2024-10-02 08:17:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个小问题,就是从https://github.com/zhebrak/django-statsy尝试exemple文件

OperationalError at /
no such table: example_post
Request Method: GET
Request URL:    http://localhost:8000/
Django Version: 1.11.5
Exception Type: OperationalError
Exception Value: no such table: example_post
Exception Location: /home/jeremie/.virtualenvs/statsy/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py in execute_sql, line 894
Python Executable:  /home/jeremie/.virtualenvs/statsy/bin/python
Python Version: 2.7.12
Python Path:    
['/home/jeremie/django-statsy',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7/lib-tk',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7/lib-old',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/home/jeremie/.virtualenvs/statsy/local/lib/python2.7/site-packages',
 '/home/jeremie/.virtualenvs/statsy/lib/python2.7/site-packages',
 '/home/jeremie/django-statsy']
Server time:    Fri, 15 Sep 2017 15:13:34 -0500

以下是我目前所做的:

  1. git clone https://github.com/zhebrak/django-statsy.git
  2. mkvirtualenv statsy
  3. cd django-statsy
  4. workon statsy
  5. pip install -r requirements.txt
  6. python manage.py makemigrations
  7. python manage.py migrate
  8. python manage.py runserver

我只想在example文件中输入,看看结果是什么类型的,并测试应用程序本身。为什么我有这个问题?如果我在一个使用Django 1.10python 2.7的项目中工作,你推荐这个应用程序吗?在

更新

^{pr2}$

下面是我运行localhost:8000时的结果:image

我怎样才能检验出给出的例子呢?在


Tags: djangopyhttpsgithubhomemanageexamplelib
1条回答
网友
1楼 · 发布于 2024-10-02 08:17:22

根据您在评论中的回复,您似乎还没有创建example_post数据库表。{{{3>要在cd2>文件中添加设置,请执行以下操作:

./manage.py makemigrations
./manage.py migrate

如果example应用程序不在INSTALLED_APPS中,则不会创建数据库迁移文件,也不会创建表。在

相关问题 更多 >

    热门问题