Solucionado (ver solução)
Solucionado
(ver solução)
5
respostas

Não consegui rodar o makemigrations

Segui o passo a passo mas na hora de rodar as mingrações deu o seguinte erro

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\core\management\__init__.py", 
line 401, in execute_from_command_line
    utility.execute()

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\core\management\__init__.py", 
line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\core\management\base.py", line 341, in run_from_argv
    connections.close_all()

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\db\utils.py", line 230, in close_all
    connection.close()

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\db\backends\sqlite3\base.py", 
line 261, in close
    if not self.is_in_memory_db():

  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\db\backends\sqlite3\base.py", 
line 380, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "C:\Users\marin\Dropbox\My PC (DESKTOP-CMT3DDM)\Desktop\Curso Rest Framewor 2\ambientevirtual\lib\site-packages\django\db\backends\sqlite3\creation.py", line 12, in is_in_memory_db
    return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'WindowsPath' is not iterable
5 respostas

Oi Raul, tudo bem?

Consegue mandar como está seus DATABASES no settings.py?

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': BASE_DIR / 'db.sqlite3',
    }
}
solução!

Oi, tenta trocar o 'NAME' por isso:

'NAME': str(os.path.join(BASE_DIR, "db.sqlite3"))

Ou:

NAME': str(BASE_DIR / 'db.sqlite3'),

Se ainda assim não for.. Provavelmente seja algo com o ambiente virtual caso esteja usando venv ou pipenv.

Aparentemente funcionou, mas não migrou o Model, vou testar e ver se já ta migrado mesmo. Obrigado!

Rodou sim. Valeeeu