0% found this document useful (0 votes)
54 views7 pages

Steps

The document discusses troubleshooting errors when trying to set up a Django project. It shows commands run in PowerShell to set up a virtual environment, install Django and dependencies, but errors occur like missing modules that need to be resolved.

Uploaded by

Lamiae Elgueloui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views7 pages

Steps

The document discusses troubleshooting errors when trying to set up a Django project. It shows commands run in PowerShell to set up a virtual environment, install Django and dependencies, but errors occur like missing modules that need to be resolved.

Uploaded by

Lamiae Elgueloui
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 7

Windows PowerShell

Copyright (C) Microsoft Corporation. Tous droits réservés.

Testez le nouveau système multiplateforme PowerShell https://aka.ms/pscore6

PS C:\Users\dell\Desktop\Me\Test\rio_games> python manage.py makemigrations


C:\Users\dell\AppData\Local\Microsoft\WindowsApps\python.exe: can't open file 'C:\\
Users\\dell\\Desktop\\Me\\Test\\rio_games\\manage.py': [Errno 2] No such file or
directory
PS C:\Users\dell\Desktop\Me\Test\rio_games> cd RioGames
PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python manage.py
makemigrations
Traceback (most recent call last):
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\pytz\lazy.py", line 3, in <module>
from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):


File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 23, in
<module>
main()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 19, in
main
execute_from_command_line(sys.argv)
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\core\management\__init__.py
", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\core\management\__init__.py
", line 357, in execute
django.setup()
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\__init__.py", line 16, in s
etup
from django.urls import set_script_prefix
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\urls\__init__.py", line 1,
in <module>
from .base import (
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\urls\base.py", line 8, in <
module>
from .exceptions import NoReverseMatch, Resolver404
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\urls\exceptions.py", line 1
, in <module>
from django.http import Http404
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\http\__init__.py", line 5,
in <module>
from django.http.response import (
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\http\response.py", line 15,
in <module>
from django.core.serializers.json import DjangoJSONEncoder
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\core\serializers\__init__.p
y", line 23, in <module>
from django.core.serializers.base import SerializerDoesNotExist
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\core\serializers\base.py",
line 6, in <module>
from django.db import models
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\db\models\__init__.py", lin
e 3, in <module>
from django.db.models.aggregates import * # NOQA
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\db\models\aggregates.py", l
ine 5, in <module>
from django.db.models.expressions import Case, Func, Star, When
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\db\models\expressions.py",
line 7, in <module>
from django.db.models import fields
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\django\utils\timezone.py", line 10
, in <module>
import pytz
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\pytz\__init__.py", line 37, in <mo
dule>
from pytz.lazy import LazyDict, LazyList, LazySet
File "C:\Users\dell\AppData\Local\Packages\
PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\
Python310\site-packages\pytz\lazy.py", line 5, in <module>
from collections import Mapping as DictMixin
ImportError: cannot import name 'Mapping' from 'collections' (C:\Program Files\
WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\
lib\collections\__ini
PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python -m venv venv
PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> .\venv\Scripts\Activate
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> pip install -r
requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory:
'requirements.txt'
[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python manage.py
migrate
Traceback (most recent call last):
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 12, in
main
from django.core.management import execute_from_command_line

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

Traceback (most recent call last):


File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 23, in
<module>
main()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 14, 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?
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python manage.py
migrate
Traceback (most recent call last):
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 12, in
main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:
main()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 14, 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?
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> pip install django
Collecting django
Downloading Django-4.2.7-py3-none-any.whl (8.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.0/8.0 MB 1.2 MB/s eta 0:00:00
Collecting tzdata
Using cached tzdata-2023.3-py2.py3-none-any.whl (341 kB)
Collecting sqlparse>=0.3.1
Using cached sqlparse-0.4.4-py3-none-any.whl (41 kB)
Collecting asgiref<4,>=3.6.0
Using cached asgiref-3.7.2-py3-none-any.whl (24 kB)
Collecting typing-extensions>=4
Using cached typing_extensions-4.8.0-py3-none-any.whl (31 kB)
Installing collected packages: tzdata, typing-extensions, sqlparse, asgiref, django
Successfully installed asgiref-3.7.2 django-4.2.7 sqlparse-0.4.4 typing-extensions-
4.8.0 tzdata-2023.3

[notice] A new release of pip is available: 23.0.1 -> 23.3.1


[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python manage.py
migrate
Traceback (most recent call last):
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 15, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'

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

Traceback (most recent call last):


File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 23, in
<module>
main()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 19, in
main
execute_from_command_line(sys.argv)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\__init__.py", line 416, in execute
django.setup()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\apps\registry.py", line 116, in populate
app_config.import_models()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\apps\config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "C:\Program Files\WindowsApps\
PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\importlib\
__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\Rio\models.py", line 2, in
<module>
from django.contrib.auth.models import User
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\contrib\auth\base_user.py", line 57, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\models\base.py", line 143, in __new__
value.contribute_to_class(cls, name)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\models\options.py", line 243, in contribute_to_class
self.db_table, connection.ops.max_name_length()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\connection.py", line 15, in __getattr__
return getattr(self._connections[self._alias], item)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\connection.py", line 62, in __getitem__
conn = self.create_connection(alias)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\utils.py", line 113, in load_backend
return import_module("%s.base" % backend_name)
File "C:\Program Files\WindowsApps\
PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\importlib\
__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> .\venv\Scripts\Activate
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-2.2.0-cp310-cp310-win_amd64.whl (199 kB)
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.2.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.1


[notice] To update, run: python.exe -m pip install --upgrade pip
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames> python manage.py
migrate
Traceback (most recent call last):
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\base\base.py", line 289, in ensure_connection
self.connect()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\base\base.py", line 270, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 247, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
MySQLdb\__init__.py", line 121, in Connect
return Connection(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
MySQLdb\connections.py", line 193, in __init__
super().__init__(*args, **kwargs2)
MySQLdb.OperationalError: (1049, "Unknown database 'riogames'")

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

Traceback (most recent call last):


File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 23, in
<module>
main()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\manage.py", line 19, in
main
execute_from_command_line(sys.argv)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\__init__.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\__init__.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\commands\migrate.py", line 100, in handle
self.check(databases=[database])
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\management\base.py", line 485, in check
all_issues = checks.run_checks(
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\checks\registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\core\checks\database.py", line 13, in check_database_backends
issues.extend(conn.validation.check(**kwargs))
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\validation.py", line 9, in check
issues.extend(self._check_sql_mode(**kwargs))
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\validation.py", line 14, in _check_sql_mode
self.connection.sql_mode & {"STRICT_TRANS_TABLES", "STRICT_ALL_TABLES"}
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 443, in sql_mode
sql_mode = self.mysql_server_data["sql_mode"]
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 399, in mysql_server_data
with self.temporary_connection() as cursor:
File "C:\Program Files\WindowsApps\
PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\
contextlib.py", line 135, in __enter__
return func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\base\base.py", line 288, in ensure_connection
with self.wrap_database_errors:
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\base\base.py", line 289, in ensure_connection
self.connect()
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\base\base.py", line 270, in connect
self.connection = self.get_new_connection(conn_params)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\utils\asyncio.py", line 26, in inner
return func(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
django\db\backends\mysql\base.py", line 247, in get_new_connection
connection = Database.connect(**conn_params)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
MySQLdb\__init__.py", line 121, in Connect
return Connection(*args, **kwargs)
File "C:\Users\dell\Desktop\Me\Test\rio_games\RioGames\venv\lib\site-packages\
MySQLdb\connections.py", line 193, in __init__
super().__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1049, "Unknown database 'riogames'")
(venv) PS C:\Users\dell\Desktop\Me\Test\rio_games\RioGames>

You might also like