作者:穿过a黑夜_440 | 来源:互联网 | 2023-09-17 10:10
recentlyIstartedasmallDjangoprojectthatIdevelopedonalocalmachineusingaSQLite3databa
recently I started a small Django project that I developed on a local machine using a SQLite3 database and the integrated development server. I now copied the whole project to a server running Debian.
最近我开始了一个小型的Django项目,我使用SQLite3数据库和集成开发服务器在本地机器上开发。我现在将整个项目复制到运行Debian的服务器上。
Everything worked well as long as I kept using the SQLite3 database. Now I wanted to switch to a local MySQL database, so I changed the settings.py file in my project's root folder, created the database and added a user. I then ran syncdb and it created the needed tables without any problems.
只要我继续使用SQLite3数据库,一切都运行良好。现在我想切换到本地MySQL数据库,所以我更改了项目根文件夹中的settings.py文件,创建了数据库并添加了一个用户。然后我运行了syncdb,它创建了所需的表,没有任何问题。
Now I wanted to use the app, but I keep getting errors, because Django can not find the tables - neither the 'standard tables' like django_sessions nor my own tables - even though they are there (I checked the database).
现在我想使用这个应用程序,但是我一直都会遇到错误,因为Django无法找到表 - 既不是像django_sessions这样的'标准表'也不是我自己的表 - 即使它们在那里(我检查了数据库)。
The one thing that seems awkward about the DatabaseError pages I get is the following line:
我得到的DatabaseError页面看起来很尴尬的一点是以下行:
Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py in execute, line 234
It seems like Django is still using the SQLite3 backend even though I set it to use the MySQL backend.
似乎Django仍在使用SQLite3后端,即使我将其设置为使用MySQL后端。
The other thing that nearly makes me freak out is this: I deleted the data.sqlite file in my app's root folder using rm. But when I use my app, the file is being recreated!
另一件令我惊慌失措的是:我使用rm删除了应用程序根文件夹中的data.sqlite文件。但是当我使用我的应用程序时,文件正在重新创建!
Can anyone tell me where I went wrong?
谁能告诉我哪里出错了?
2 个解决方案