1
我想實現我的Python應用程序peewee,並確定我的課的時候是這樣的:撒尿凌晨元子類繼承
import datetime
import peewee as pw
import acme.core as acme
adapter = pw.MySQLDatabase(
acme.get_config(path='database.db'),
host=acme.get_config(path='database.host'),
port=int(acme.get_config(path='database.port', default=3306)),
user=acme.get_config(path='database.user'),
passwd=acme.get_config(path='database.password'))
class Model(pw.Model):
"""
The base model that will connect the database
"""
id = pw.PrimaryKeyField()
created_at = pw.DateTimeField()
updated_at = pw.DateTimeField(default=datetime.datetime.now)
class Meta:
database = adapter
class ServerModule(Model):
enabled = pw.BooleanField()
ipaddr = pw.IntegerField()
port = pw.IntegerField()
class Meta(Model.Meta):
db_table = 'module_server'
我收到以下錯誤:
Traceback (most recent call last):
File "db.py", line 25, in <module>
class ServerModule(Model):
File "db.py", line 33, in ServerModule
class Meta(Model.Meta):
AttributeError: type object 'Toto' has no attribute 'Meta'
我曾嘗試基本的Python子類繼承和它的工作原理,但在這裏它不,有人可以指向我正確的方向?