0

after the installation of the PyJWT 2.4.0 i can't import the module jwt it shows me "Import could not be resolved

import jwt
import datetime
from django.conf import settings

def generate_access_token(user):
    payload = {
        'user_id':user.id,
        'exp':datetime.datetime.utcnow() + datetime.timedelta(minutes=60),
        'iat' : datetime.datetime.utcnow()
    }
    return jwt.encode(payload,settings.SECRET_KEY,algorithm='HS256').decode('utf-8')



FROM python:3.9
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install -r requirements.txt
COPY . /app

CMD python manage.py runserver 0.0.0.0:8000

0 Answers0