Urls
In [1]:
Copied!
"""
URL configuration for project project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
"""
URL configuration for project project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
In [2]:
Copied!
urlpatterns = [
path('admin/', admin.site.urls),
]
urlpatterns = [
path('admin/', admin.site.urls),
]
--------------------------------------------------------------------------- ImproperlyConfigured Traceback (most recent call last) Cell In[2], line 2 1 urlpatterns = [ ----> 2 path('admin/', admin.site.urls), 3 ] File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\utils\functional.py:251, in new_method_proxy.<locals>.inner(self, *args) 249 def inner(self, *args): 250 if (_wrapped := self._wrapped) is empty: --> 251 self._setup() 252 _wrapped = self._wrapped 253 return func(_wrapped, *args) File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\contrib\admin\sites.py:605, in DefaultAdminSite._setup(self) 604 def _setup(self): --> 605 AdminSiteClass = import_string(apps.get_app_config("admin").default_site) 606 self._wrapped = AdminSiteClass() File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\apps\registry.py:156, in Apps.get_app_config(self, app_label) 150 def get_app_config(self, app_label): 151 """ 152 Import applications and returns an app config for the given label. 153 154 Raise LookupError if no application exists with this label. 155 """ --> 156 self.check_apps_ready() 157 try: 158 return self.app_configs[app_label] File c:\Users\00661711722\Documents\PBE_24.2_8002\.venv\Lib\site-packages\django\apps\registry.py:137, in Apps.check_apps_ready(self) 132 from django.conf import settings 134 # If "not ready" is due to unconfigured settings, accessing 135 # INSTALLED_APPS raises a more helpful ImproperlyConfigured 136 # exception. --> 137 settings.INSTALLED_APPS 138 raise AppRegistryNotReady("Apps aren't loaded yet.") 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:61, in LazySettings._setup(self, name) 59 if not settings_module: 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) ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.