Asgi
In [1]:
Copied!
"""
ASGI config for project 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/5.1/howto/deployment/asgi/
"""
"""
ASGI config for project 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/5.1/howto/deployment/asgi/
"""
Out[1]:
'\nASGI config for project project.\n\nIt exposes the ASGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/5.1/howto/deployment/asgi/\n'
In [2]:
Copied!
import os
import os
In [3]:
Copied!
from django.core.asgi import get_asgi_application
from django.core.asgi import get_asgi_application
In [4]:
Copied!
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project.settings')
Out[4]:
'project.settings'
In [5]:
Copied!
application = get_asgi_application()
application = get_asgi_application()
--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[5], line 1 ----> 1 application = get_asgi_application() File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\core\asgi.py:12, in get_asgi_application() 5 def get_asgi_application(): 6 """ 7 The public interface to Django's ASGI support. Return an ASGI 3 callable. 8 9 Avoids making django.core.handlers.ASGIHandler a public API, in case the 10 internal implementation changes or moves in the future. 11 """ ---> 12 django.setup(set_prefix=False) 13 return ASGIHandler() File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\__init__.py:19, in setup(set_prefix) 16 from django.urls import set_script_prefix 17 from django.utils.log import configure_logging ---> 19 configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) 20 if set_prefix: 21 set_script_prefix( 22 "/" if settings.FORCE_SCRIPT_NAME is None else settings.FORCE_SCRIPT_NAME 23 ) File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\conf\__init__.py:81, in LazySettings.__getattr__(self, name) 79 """Return the value of a setting and cache it in self.__dict__.""" 80 if (_wrapped := self._wrapped) is empty: ---> 81 self._setup(name) 82 _wrapped = self._wrapped 83 val = getattr(_wrapped, name) File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\conf\__init__.py:68, in LazySettings._setup(self, name) 60 desc = ("setting %s" % name) if name else "settings" 61 raise ImproperlyConfigured( 62 "Requested %s, but settings are not configured. " 63 "You must either define the environment variable %s " 64 "or call settings.configure() before accessing settings." 65 % (desc, ENVIRONMENT_VARIABLE) 66 ) ---> 68 self._wrapped = Settings(settings_module) File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\conf\__init__.py:166, in Settings.__init__(self, settings_module) 163 # store the settings module in case someone later cares 164 self.SETTINGS_MODULE = settings_module --> 166 mod = importlib.import_module(self.SETTINGS_MODULE) 168 tuple_settings = ( 169 "ALLOWED_HOSTS", 170 "INSTALLED_APPS", (...) 173 "SECRET_KEY_FALLBACKS", 174 ) 175 self._explicit_settings = set() File C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2032.0_x64__qbz5n2kfra8p0\Lib\importlib\__init__.py:90, in import_module(name, package) 88 break 89 level += 1 ---> 90 return _bootstrap._gcd_import(name[level:], package, level) File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level) File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_) File <frozen importlib._bootstrap>:1310, in _find_and_load_unlocked(name, import_) File <frozen importlib._bootstrap>:488, in _call_with_frames_removed(f, *args, **kwds) File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level) File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_) File <frozen importlib._bootstrap>:1324, in _find_and_load_unlocked(name, import_) ModuleNotFoundError: No module named 'project'