Django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'mysite.routing'
Я пытаюсь создать webapp с помощью django и при запуске его на моей локальной системе, я застрял здесь из-за этой проблемы. Даже если asgi, wsgi и настройки настроены правильно, он показывает, что он не может импортировать asgi приложение. Может кто-нибудь проверить, в чем проблема?
asgi.py
"""
ASGI config for mysite project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
import sys
import django
from channels.routing import get_default_application
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
# django.setup()
application = get_asgi_application()
wsgi.py
"""
WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mysite.settings')
application = get_wsgi_application()
Сначала я подумал, что это из-за того, что Base dir не инициализируется, я попробовал использовать pathlib, но все равно ничего не получилось
setting.py
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 2.1.8.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
# BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i1+q47!dh6p&-8*$+k%nf2bwbzl6!b^a%k=0a-k&4hsxv)ccup'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
WSGI_APPLICATION = 'mysite.wsgi.application'
ASGI_APPLICATION = "mysite.routing.application"
Starting ASGI/Channels version 2.1.7 development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x7f3f6afc4f70>
Traceback (most recent call last):
File "/home/markins/miniconda3/lib/python3.9/site-packages/django/utils/autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "/home/markins/miniconda3/lib/python3.9/site-packages/channels/management/commands/runserver.py", line 101, in inner_run
application=self.get_application(options),
File "/home/markins/miniconda3/lib/python3.9/site-packages/channels/management/commands/runserver.py", line 126, in get_application
return StaticFilesWrapper(get_default_application())
File "/home/markins/miniconda3/lib/python3.9/site-packages/channels/routing.py", line 35, in get_default_application
raise ImproperlyConfigured("Cannot import ASGI_APPLICATION module %r" % path)
django.core.exceptions.ImproperlyConfigured: Cannot import ASGI_APPLICATION module 'mysite.routing'