1
resposta

[Sugestão] Não consigo subir o Server (DICAS)

Galera que está tentando subir o server do django e fica dando erro:

    no requirements.txt tem essa lib tira ela
    typed-ast==1.4.1

se der esse erro: instala essas 3 bibliotecas que tem na propria documentação do django rest

raceback (most recent call last):
  File "/home/kemuel/Downloads/projeto_clientes/manage.py", line 11, in main
    from django.core.management import execute_from_command_line
  File "/home/kemuel/Downloads/projeto_clientes/venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/kemuel/Downloads/projeto_clientes/venv/lib/python3.12/site-packages/django/utils/version.py", line 6, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/kemuel/Downloads/projeto_clientes/manage.py", line 22, in <module>
    main()
  File "/home/kemuel/Downloads/projeto_clientes/manage.py", line 13, in main
    raise ImportError(
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
    * pip install djangorestframework
    * pip install markdown     
    * pip install django-filter 

Se der esse erro:

    clientes.Cliente: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
    HINT: Configure the DEFAULT_AUTO_FIELD setting or the ClientesConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'
    

Vai no arquivo settings.py no django e cola esse comando: de preferencia no final do arquivo.

    1. 	DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
1 resposta

Olá Kemuel, tudo bem com você?

É ótimo ver a comunidade do fórum se ajudando, suas dicas são muito importantes para auxiliar os estudantes que estão recebendo os mesmos erros.

Continue interagindo no fórum Alura seja compartilhando suas dicas ou evoluções nos estudos.

Abraços e bons estudos!