Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Pythonywhere:django.db.utils.OperationalError:没有这样的表:_Python_Django_Deployment_Pythonanywhere - Fatal编程技术网

Pythonywhere:django.db.utils.OperationalError:没有这样的表:

Pythonywhere:django.db.utils.OperationalError:没有这样的表:,python,django,deployment,pythonanywhere,Python,Django,Deployment,Pythonanywhere,我正在PythonAnywhere上部署一个项目。我正在使用sqlite数据库 DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'mydatabase.db', } } 当makemigrations启动时,将在项目根目录中创建文件mydatabase.db(其大小为0字节),但我得到一个错误-django.db.utils.Operationa

我正在
PythonAnywhere
上部署一个项目。我正在使用
sqlite
数据库

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'mydatabase.db',
    }
}
makemigrations
启动时,将在项目根目录中创建文件
mydatabase.db
(其大小为0字节),但我得到一个错误-
django.db.utils.OperationalError:没有这样的表:…

错误是由于我的疏忽造成的

在django中,
views.py
在迁移之前执行。有一行运行了
数据库查询
。由于服务器上的
数据库
是空的,并且脚本已经在执行对它的请求,很明显,在
迁移期间
我收到了这个错误


只需删除/注释掉数据库请求就足够了。

makemigrations
只需创建迁移文件。您需要运行
migrate
将迁移应用到数据库。有关详细信息,请参阅。我收到了相同的错误
。。。没有这样的表格:…
什么表格?请指定。
app\u prediction
,以便您的项目中有
app
应用程序,其中有模型
prediction
。运行
/manage.py makemigrations
/manage.py migrate
时,您会看到此错误。对吗?