Python sqlite3.OperationalError: no such table:

前端 未结 3 1714
再見小時候
再見小時候 2020-12-14 00:49

I am trying to store data about pupils at a school. I\'ve done a few tables before, such as one for passwords and Teachers which I will later bring together in one program.

3条回答
  •  不思量自难忘°
    2020-12-14 01:32

    I have to face same issue and there are a couple of approaches, but the one I think is the most probable one.

    Maybe you are loading views or queries to database but you haven´t granted enough time for Django to migrate the models to DB. That's why the "table doesn't exist".

    Make sure you use this sort of initialization in you view's code:

    form RegisterForm(forms.Form):
    
        def __init__(self, *args, **kwargs):
            super(RegisterForm, self).__init__(*args, **kwargs)
    

    A second approach is you clean previous migrations, delete the database and start over the migration process.

提交回复
热议问题