GGberry
GGberry

Reputation: 945

Django makemigrations and migrate

I am having trouble with the py manage.py makemigrations [project_name] and py manage.py migrate command. Every time I try these two commands in the right order, I get the following error:

Traceback (most recent call last):
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\manage.py", line 20, in <module>
    main()
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\core\management\__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\core\management\base.py", line 301, in run_from_argv
    connections.close_all()
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\db\utils.py", line 225, in close_all
    connection.close()
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\db\backends\sqlite3\base.py", line 190, in close
    if not self.is_in_memory_db():
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\db\backends\sqlite3\base.py", line 287, in is_in_memory_db
    return self.creation.is_in_memory_db(self.settings_dict['NAME'])
  File "C:\Users\Gilbert\PycharmProjects\GGprojects\django\ll_env\lib\site-packages\django\db\backends\sqlite3\creation.py", line 13, in is_in_memory_db
    return database_name == ':memory:' or 'mode=memory' in database_name
TypeError: argument of type 'WindowsPath' is not iterable

Looking at the error, I would tell maybe my Python PATH isn't correct. The current path for it is C:\Users\Gilbert\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.9. Is that the reason there is an error? And will it affect my Django project? Also, how can I solve this problem?

Upvotes: 0

Views: 328

Answers (1)

chandni goyal
chandni goyal

Reputation: 157

It seems like it's not getting database path. check your database name in settings.py file.

For example: For sqlite3, it should be like :

DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': str(os.path.join(BASE_DIR, "db.sqlite3"))
   }
 }

if this not works for you, then please share your database settings here so that i can help

Upvotes: 1

Related Questions