Untitled

mail@pastecode.io avatar
unknown
python
8 days ago
3.6 kB
2
Indexable
Never


Boa noite 
Codigo do models.py 
from django.db import models
from datetime  import datetime

class Investimento (models.model): 
      investimento = models.TextField(max_length=255)
      valor        = models.FloatField() 
      pago         = models.BooleanField(default=False)
      data         = models.DateTimeField(default=datetime)
#fim da classe 
#Erro 
File "C:\Python312\Lib\site-packages\django\apps\registry.py", line 116, in populate
    app_config.import_models()
  File "C:\Python312\Lib\site-packages\django\apps\config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\#EngSoftw@\Python\CodigosFontes\projetos\invista_me\projeto_invista_me\invista_me\models.py", line 4, in <module>
    class Investimento (models.model):
                        ^^^^^^^^^^^^
AttributeError: module 'django.db.models' has no attribute 'model'. Did you mean: 'Model'?
PS C:\#EngSoftw@\Python\CodigosFontes\projetos\invista_me\projeto_invista_me> 

======================================================

Suporte como faço para mandar o codigo pra vcs digo as pastas do projeto com todos as subpastas da aplicação junto 
e  a terceira vez que tento fazer e sempre entre aula 10 e 14 apanho e não saio mais delas , segue o erro da terceira tentativa ja na dez e algo simples que era fazer o makemigrations do codigo do models.py pra criar a tabela , mas quero que vcs olhem pois tem algum ponto que não me adiantei e to errando nele , tentei mandar o arquivo zipado com tudo mas não foi , por onde mando , pra vcs avaliarem 


Erro 
 return import_module(self.urlconf_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\importlib\__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "C:\#EngSoftw@\Python\CodigosFontes\devaprender\django\Envista_me\projeto_investa_me\projeto_investa_me\urls.py", line 4, in <module>
    from envista_me import views
  File "C:\#EngSoftw@\Python\CodigosFontes\devaprender\django\Envista_me\projeto_investa_me\envista_me\views.py", line 3, in <module>  
    from .models import  listinventimentos
ImportError: cannot import name 'listinventimentos' from 'envista_me.models' (C:\#EngSoftw@\Python\CodigosFontes\devaprender\django\Envista_me\projeto_investa_me\envista_me\models.py)

Este erro ocorre quando do o runserver
Leave a Comment