Error in creating a django project in pycharm

Answered

After I select new project and give the necessary titles and selecting base conda as my interpreter type,

I am getting the following error and I have tried reinstalling pycharm but the issue isnt solved still.

 

Error creating Django application: Error on Python side. Exit code: 1, err: Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2024.1\plugins\python\helpers\pycharm\_jb_django_project_creator.py", line 12, in   management.execute_from_command_line(argv=["django-admin", "startproject", project_name, path]) File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line utility.execute() File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\__init__.py", line 440, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\base.py", line 402, in run_from_argv self.execute(*args, **cmd_options) File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\base.py", line 448, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\commands\startproject.py", line 21, in handle super().handle("project", project_name, target, **options) File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\management\templates.py", line 148, in handle django.setup() File "C:\Users\kahan\anaconda3\Lib\site-packages\django\__init__.py", line 16, in setup from django.urls import set_script_prefix File "C:\Users\kahan\anaconda3\Lib\site-packages\django\urls\__init__.py", line 1, in   from .base import ( File "C:\Users\kahan\anaconda3\Lib\site-packages\django\urls\base.py", line 8, in   from .exceptions import NoReverseMatch, Resolver404 File "C:\Users\kahan\anaconda3\Lib\site-packages\django\urls\exceptions.py", line 1, in   from django.http import Http404 File "C:\Users\kahan\anaconda3\Lib\site-packages\django\http\__init__.py", line 8, in   from django.http.response import ( File "C:\Users\kahan\anaconda3\Lib\site-packages\django\http\response.py", line 16, in   from django.core.serializers.json import DjangoJSONEncoder File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\serializers\__init__.py", line 23, in   from django.core.serializers.base import SerializerDoesNotExist File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\serializers\base.py", line 9, in   from django.db import models File "C:\Users\kahan\anaconda3\Lib\site-packages\django\db\models\__init__.py", line 40, in   from django.db.models.fields.files import FileField, ImageField File "C:\Users\kahan\anaconda3\Lib\site-packages\django\db\models\fields\files.py", line 8, in   from django.core.files.storage import Storage, default_storage File "C:\Users\kahan\anaconda3\Lib\site-packages\django\core\files\storage\__init__.py", line 3, in   from django.conf import DEFAULT_STORAGE_ALIAS, settings ImportError: cannot import name 'DEFAULT_STORAGE_ALIAS' from 'django.conf' (C:\Users\kahan\anaconda3\Lib\site-packages\django\conf\__init__.py) out:

1
3 comments

When you create a new project, do you select Django or pure Python? Which Python version?

What if you manually reinstall the Django project as mentioned here

0

I have selected Django.

Python version is 3.12.4.

I have already done the steps mentioned in the stackoverflow post you share, still it's not working.

0

I was unable to reproduce the same behavior with Python 3.12.4 and miniconda3.

Try reinstalling the conda using the steps here to ensure it's not corrupted.

In case the issue persists, can you try to create a conda environment outside PyCharm and install the django package manually. Does it work?

0

Please sign in to leave a comment.