I could use some help figuring out how to debug this:
I suspect that there is something wrong with my models.py file but the error messages are pretty vague.
I use Alembic and SQLAlchemy instead of Django ORM (relatively new to all the above) and successfully made a migration into Alembic version folder. The reason I'm using Alembic SQLAlchemy is because I am trying to hit external API and was told in another post that Alembic was needed to manage migration histories or there would be issues with Django tracking migrations.
I have a custom command class that calls the scraper and I am passing the data to Pandas dataframe then attempt to write it to database defined in my models.py file. For brevity I will just post my models.py, the end of the error log as well as a link to the full repo.
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, String, Numeric, BigInteger, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
from django.db import models
class CMC(Base):
__tablename__ = 'apis_cmc'
id = Column(Integer, primary_key=True)
inserted_at = Column(DateTime, default=datetime.utcnow)
name = Column(String)
symbol = Column(String)
price = Column(Numeric)
market_cap = Column(BigInteger)
market_cap_dominance = Column(BigInteger)
fully_diluted_market_cap = Column(BigInteger)
percent_change_1h = Column(Numeric)
percent_change_24h = Column(Numeric)
percent_change_30d = Column(Numeric)
percent_change_60d = Column(Numeric)
percent_change_7d = Column(Numeric)
percent_change_90d = Column(Numeric)
volume_24h = Column(Numeric)
volume_change_24h = Column(Numeric)
UniqueConstraint('symbol', 'inserted_at', name='uix_1')
def __str__(self):
return self.name
File "/Users/justinbenfit/Desktop/Programming/website/cds_website/venv/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 116, in register
for model in model_or_iterable:
TypeError: 'DeclarativeMeta' object is not iterable
https://github.com/Justinbenfit23/crypto_data_science_website
The GitHub issues I have seen for this error seem to refer to adding an iter method to the model class which I don't think I have here, so I'm stuck. Any directions are appreciated.