Django broken
I was working a tutorial and one of their points was that you should be able to create a project and it will just run. Unfortunately, that doesn't work with IDEA + Python plugin.
I get the output below. If django-admin.py is deprecated, why is IDEA still calling it?
And other issues.
No manage.py file specified in Settings->Django Support
/usr/local/bin/python3.9 /Library/Frameworks/Python.framework/Versions/3.9/bin/django-admin.py runserver 8000
/Library/Frameworks/Python.framework/Versions/3.9/bin/django-admin.py:17: RemovedInDjango40Warning: django-admin.py is deprecated in favor of django-admin.
warnings.warn(
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/bin/django-admin.py", line 21, in <module>
management.execute_from_command_line()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 61, in execute
super().execute(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/core/management/commands/runserver.py", line 68, in handle
if not settings.DEBUG and not settings.ALLOWED_HOSTS:
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
self._setup(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/django/conf/__init__.py", line 63, in _setup
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Process finished with exit code 1
请先登录再写评论。
Do you have Django configured in settings?
That fixed the deprecation issue, but not the ImproperlyConfigured error.
Please attach a screenshot of your run configuration.
Does the issue reproduce in a new project?