我尝试使用Django 1.11从遗留数据库中读取数据。我使用了inspectdb将数据库模型保存到我的app目录。但无论何时我尝试打开Django shell或runserver我都会收到此错误
ValueError:源代码字符串不能包含空字节
有人可以帮我解决这个错误,以便我可以从数据库中读取数据吗?
我的模特:
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# * Make sure each ForeignKey has `on_delete` set to the desired behavior.
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from __future__ import unicode_literals
from django.db import models
class JustAccount(models.Model):
id = models.IntegerField(primary_key=True) # AutoField?
account_name = models.CharField(db_column='Account_name', max_length=100) # Field name made lowercase.
account_number = models.IntegerField(db_column='Account_number') # Field name made lowercase.
ammount = models.FloatField(db_column='Ammount') # Field name made lowercase.
class Meta:
managed = False
db_table = 'just_account'