from django.shortcuts import render
Create your views here.
def index(request):
import swapi
films = swapi.get_all("films")
context = {
'list': films
}
return render( request, 'index.html', context)
Internal Server Error: /films/
Traceback (most recent call last):
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/swapi/swapi.py", line 3, in
from swapi.utils import query, all_resource_urls
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/swapi/utils.py", line 1, in
import requests
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/init.py", line 58, in
from . import utils
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/utils.py", line 26, in
from .compat import parse_http_list as _parse_list_header
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/compat.py", line 7, in
from .packages import chardet
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/packages/init.py", line 3, in
from . import urllib3
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/packages/urllib3/init.py", line 10, in
from .connectionpool import (
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/packages/urllib3/connectionpool.py", line 38, in
from .response import HTTPResponse
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/packages/urllib3/response.py", line 5, in
from ._collections import HTTPHeaderDict
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/requests/packages/urllib3/_collections.py", line 1, in
from collections import Mapping, MutableMapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/acuta/Документи/Python/django/part_10/starwars/films/views.py", line 6, in index
import swapi
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/swapi/init.py", line 7, in
from .swapi import (
File "/home/acuta/Документи/Python/django/part_10/.venv/lib/python3.10/site-packages/swapi/swapi.py", line 19, in
import settings
ModuleNotFoundError: No module named 'settings'
[10/Sep/2023 10:53:55] "GET /films/ HTTP/1.1" 500 222569