Running Django locally

Greetings. I’m a new developer who wants to contribute to Django. I cloned and opened Django to run on my Windows local, but when I run runtest.py I get the error ‘sqlite3.OperationalError: no such table: test_utils_car’. Can you help me please <3 ?

Exception in thread Thread-25 (thread_func):
Traceback (most recent call last):
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\sqlite3\base.py", line 354, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
sqlite3.OperationalError: no such table: test_utils_car

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

Traceback (most recent call last):
  File "C:\Users\yunus\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "C:\Users\yunus\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\yunus\OneDrive\Masaüstü\django\tests\test_utils\tests.py", line 2144, in thread_func
    next(Car.objects.iterator(), None)
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\models\query.py", line 518, in _iterator
    yield from iterable
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\models\query.py", line 91, in __iter__
    results = compiler.execute_sql(
              ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\models\sql\compiler.py", line 1570, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\utils.py", line 79, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\utils.py", line 92, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\utils.py", line 100, in _execute
    with self.db.wrap_database_errors:
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\yunus\OneDrive\Masaüstü\django\django\db\backends\sqlite3\base.py", line 354, in execute
    return super().execute(query, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.OperationalError: no such table: test_utils_car

Side Note: Please don’t post images of code, templates, error message, tracebacks, etc. Copy / paste the output into the body of your message.

When posting code here, enclose the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. This forces the forum software to keep your code properly formatted.

1 Like

Please show the initial output of the runtest.py command, starting from the command itself being issued up to the System check ... line.

1 Like
djangodev) C:\Users\yunus\OneDrive\Masaüstü\django\tests>py runtests.py
Testing against Django installed in 'C:\Users\yunus\OneDrive\Masaüstü\django\django' with up to 12 processes
Found 17187 test(s).
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Creating test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
System check identified no issues (17 silenced).

I have tried to recreate your situation as best I can based upon what you’ve shown here, and I am unable to reproduce the issue you’re encountering.

This would lead me to believe that this is likely something environmental in your system causing problems. You might start by digging into the exact test that is failing to see what it’s trying to do, and try to recreate those issues independently from the overall test suite.

Other things you may want to try or verify is that you have all the necessary permissions to the directory in which this is being run, and that you aren’t running into any capacity issues.

It appears that you’re trying to do this in a OneDrive directory, so you might want to try it somewhere else to verify that OneDrive isn’t creating any interference.

You might want to reinstall Python and/or create a virtual environment in which this is to be run.

You may want to view your system’s logs to see if something has happened at a lower level that is being reflected this way.

You might want to try getting a trivial Django app running in your environment to verify there’s nothing more fundamentally wrong.

I know none of these are particularly useful or insightful, but in the absence of more detailed information, it’s hard to tell what is failing.