Answer the question
In order to leave comments, you need to log in
Django server won't start, has anyone encountered this error?
I'm trying to create a simple django blog, made a project, made an application.
Launched, everything works. I registered my blog in the setting:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog'
]
from django.contrib import admin
from django.urls import path
from django.urls import include
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls'))
from django.urls import path
from .views import *
urlpatterns = [
path('', posts_list)
]
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def posts_list(request):
return HttpResponse('<h1> Hello Word </h1>')
Traceback (most recent call last):
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\apps\registry.py", line 155, in get_app_config
return self.app_configs[app_label]
KeyError: 'admin'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ugrobug\PycharmProjects\site\blogengiene\manage.py", line 21, in <module>
main()
File "C:\Users\ugrobug\PycharmProjects\site\blogengiene\manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
utility.execute()
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, **options)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\utils\autoreload.py", line 579, in run_with_reloader
start_django(reloader, main_func, *args, **kwargs)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\utils\autoreload.py", line 564, in start_django
reloader.run(django_main_thread)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\utils\autoreload.py", line 272, in run
get_resolver().urlconf_module
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\utils\functional.py", line 80, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\urls\resolvers.py", line 564, in urlconf_module
return import_module(self.urlconf_name)
File "C:\Users\ugrobug\AppData\Local\Programs\Python\Python37-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\ugrobug\PycharmProjects\site\blogengiene\blogengiene\urls.py", line 22, in <module>
path('admin/', admin.site.urls),
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\utils\functional.py", line 256, in inner
self._setup()
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\contrib\admin\sites.py", line 529, in _setup
AdminSiteClass = import_string(apps.get_app_config('admin').default_site)
File "C:\Users\ugrobug\PycharmProjects\site\venv\lib\site-packages\django\apps\registry.py", line 162, in get_app_config
raise LookupError(message)
LookupError: No installed app with label 'admin'.
Answer the question
In order to leave comments, you need to log in
RockyMotion try the following steps:
1. write this INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog.apps.BlogConfig',
]
I spent everything according to the official documentation - it worked, but it does not differ at all from the lessons I did. The only difference is I didn't use Pycharm to start projects and applications and start the server. Apparently he was the problem.
The simplest option is to set the image as the background for the shared container and add backrgound-size: cover to it.
and if height is not specified at all?
for example like this:
img{
display:block;
width:100%;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question