Django project using incorrect (old) database settings

I recently started a small Django project that I developed on a local machine using a SQLite3 database and an integrated development server. Now I have copied the entire project to a server running Debian.

Everything worked fine while I continued to use the SQLite3 database. Now I wanted to switch to the local MySQL database, so I changed the settings.py file in the project root folder, created the database and added the user. Then I ran syncdb and created the necessary tables without any problems.

Now I wanted to use the application, but I keep getting errors because Django cannot find tables - neither "standard tables" like django_sessions, nor my own tables, even if they exist (I checked the database).

The only thing that seems inconvenient regarding the DatabaseError pages that I get is the following line:

Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/backends/sqlite3/base.py in execute, line 234 

It seems that Django still uses the SQLite3 backend, although I installed it to use the MySQL backend.

Another thing that almost makes me worried is this: I deleted the data.sqlite file in the application root folder using rm. But when I use my application, the file is recreated!

Can someone tell me where I was wrong?

+6
source share
2 answers

When starting with mod_wsgi or mod_python, the new code is not included until the web server is rebooted / restarted.

If you use apache with mod_wsgi, you can also touch wsgi.py file to restart only python code.

+3
source

If you start apache, it starts "sudo / etc / init.d / apache2 reload" every time you make changes.

+1
source

Source: https://habr.com/ru/post/905414/


All Articles