Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to upload file to django using requests_toolbelt
When i try to upload a file to django using requests_toolbelt and sending everything in client.post data param, django doesn't receive the file. client = requests.session() client = client.get(upload_url) csrftoken = client.cookies['csrftoken'] encoding = MultipartEncoder(fields={'file': open(file, 'rb'), 'csrfmiddlewaretoken': csrftoken}) monitor = MultipartEncoderMonitor(encoding, callback_function) client.post(upload_url, data=monitor, headers={'Content-Type': monitor.content_type}) but if i send the csrftoken in data param and the monitor in files param it gives me. TypeError: 'MultipartEncoderMonitor' object is not iterable All of this is just to get a working progress bar when uploading files to django. -
Convert SQL query set into Django Model Query-set
I need a little help, I come from working with relational data models and now I venture into Django Framework, I need to make an API that returns something like this SQL query SELECT user_profile_userprofile.email, user_profile_userprofile.name, business_unity.active AS status, profile.name AS profile, business_unity.name AS unit FROM user_profile_userprofile JOIN profile ON user_profile_userprofile.id = profile.id JOIN user_profile_unity ON user_profile_unity.user_id = user_profile_userprofile.id JOIN business_unity ON user_profile_unity.id = business_unity.id; The models are already created but I don't know how to make a view in python that meets the conditions of this query -
Django pagination in ListView raise Error "Slice"
i want display pagination on my page but i noticed that when i add "paginate_by" raise me error "slice" class BookNotLogged(generic.ListView): template_name="BookNotLogged.html" context_object_name='listofBook' paginate_by = 2 #when i add this its raise me error model = Book queryset = Book.objects.all() def get_queryset(self): context={ 'book1':Book.objects.get(id="2"), 'book2':Book.objects.get(id="3"), 'book3':Book.objects.get(id="4"), 'book4':Book.objects.get(id="8"), 'book5':Book.objects.get(id="9"), 'book6':Book.objects.get(id="10"), 'book7':Book.objects.get(id="11"), 'book8':Book.objects.get(id="12"), 'book9':Book.objects.get(id="13") } return context -
I keep getting the error OperationalError at /forums/ no such table: forums_simple_post
I am building a simple forum application and I keep getting the error OperationalError at /forums/ no such table: forums_simple_post when I go on my forum page. Does anyone know how to fix this I would much appreciate the help? views.py from django.shortcuts import render from django.urls import reverse_lazy from django.views import generic from . import forms from forums_simple.models import Post # Create your views here. class ForumForm(generic.CreateView): template_name = 'forums_simple/forum.html' form_class = forms.ForumForm success_url = '/' def form_vaild(self, form): self.object = form.save(commit=False) self.object.save() return super().form_vaild(form) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['object_list'] = Post.objects.all() return context urls.py from django.contrib import admin from django.urls import path, include from . import views app_name = 'forums' urlpatterns = [ path('', views.ForumForm.as_view(), name='forum') ] models.py from django.db import models # Create your models here. class Post(models.Model): message = models.TextField(blank=True, null=False) created_at = models.DateTimeField(auto_now=True) forms.py from django import forms from . import models class ForumForm(forms.ModelForm): class Meta: model = models.Post fields = ('message',) forum.html {% extends "base.html" %} {% load crispy_forms_tags %} {% block content %} <div class="container"> {% for message in object_list %} {{ post.message }} {% endfor %} </div> <div class="container"> <form class="forum_class" action="index.html" method="post"> {% csrf_token %} {% crispy form %} … -
How to Validate CSV file while reading?
I would like to create a new validation for CSV file. The idea is: if in csv file while reading in the first line is header - id and code then continue, if not - raise an error. Right now I have some functionality for writing and reading csv file to StringIO. def write(): header = ['id', 'code'] buffer = io.StringIO() writer = csv.writer(buffer) writer.writerow(header) # after writing data from table def create(self, request, *args, **kwargs): serializer = CsvSerializer(data=request.data) if not serializer.is_valid(): return Response(serializer.errors, status=status.HTTP_422_UNPROCESSABLE_ENTITY) csv_file = serializer.validated_data['file'] file = csv_file.read().decode('utf-8') csv_fields = ['id', 'code'] csv_reader = csv.DictReader(io.StringIO(file), fieldnames=csv_fields) next(csv_reader) # skip headers from csv for processing the file and do other stuff Im asking for a help to add validation to this code or give me some advices. The csv file looks like (correct one): id code 0101010 2049583 3232323 3232232 3232323 4434454 3232333 4532222 This is the examples of incorrect csv: 01010 20493 3232323 3232232 3232323 4434454 3232333 4532222 abc dsdsd 0101010 2049583 3232323 3232232 3232323 4434454 3232333 4532222 Id and code quantity is every time different, because of the entered data in DB -
How to populate a django Model FormSet with Model instances AND default field values
The problem is how to populate each form of a Model Formset using a queryset, and also providing initial data to the unbound forms in the formset. Why? I have a model called Answer. I want to create many Answers to a Question model, and each Question is within a Section, another model. When in the question detail page, I already know the Section and the Question the Answer object should belong to, and these will eventually just be rendered as hidden fields, but I need them in order to save the Answer object. My models (reduced to the essential fields): class Section(models.Model): section = models.CharField(max_length=100) def __str__(self): return self.section class Question(models.Model): question = models.CharField(max_length=500) section = models.ForeignKey(Section, on_delete=models.CASCADE) def __str__(self): return self.question class Answer(models.Model): answer = models.CharField(max_length=200, null=True, default='') question = models.ForeignKey(Question, on_delete=models.CASCADE) section = models.ForeignKey(Section, on_delete=models.CASCADE) def __str__(self): return self.answer My form: class AddAnswerForm(forms.ModelForm): class Meta: model = Answer fields = ['answer', 'question', 'section'] I want to do this with Model Formsets since the user should be able to keep adding answers, and also edit answers previously given. I've looked at the docs, which for django are excellent, and found how to add initial data here. Initially, the … -
Django multiple forms, one form resets other form
Got some forms in my view... I want that only what I have submitted is changed in the database. So that no forms overwrite each other. How can I do this with my view? I even noticed that the order in which each '..._form.is_valid()' is, makes a difference in what gets overwritten views.py @login_required def DashboardView(request): browser = str(request.user_agent.browser.family) user = str(request.user) short_user = user[0:7] + "..." try: radius = request.user.fieldradius except FieldRadius.DoesNotExist: radius = FieldRadius(user=request.user) try: font_size = request.user.fontsize except FontSize.DoesNotExist: font_size = FontSize(user=request.user) try: change_color = request.user.colors except Colors.DoesNotExist: change_color = Colors(user=request.user) try: toggle_settings = request.user.togglesettings except ToggleSettings.DoesNotExist: toggle_settings = ToggleSettings(user=request.user) try: page_details = request.user.pagedetails except PageDetails.DoesNotExist: page_details = PageDetails(user=request.user) if request.method == 'POST': form = FieldForm(request.POST, instance=Field(user=request.user)) togglesettings_form = ToggleSettingsForm( request.POST, instance=toggle_settings) radius_form = FieldRadiusForm(request.POST, instance=radius) change_color_form = ColorsForm(request.POST, instance=change_color) fontsize_form = FontSizeForm(request.POST, instance=font_size) pagedetails_form = PageDetailsForm( request.POST, request.FILES, instance=page_details) if togglesettings_form.is_valid(): togglesettings_form.save() return redirect('/dashboard/#panel1') if form.is_valid(): time.sleep(1.5) obj = form.save(commit=False) obj.creator_adress = get_client_ip(request) obj.save() return redirect('/dashboard') if radius_form.is_valid(): radius_form.save() return redirect('/dashboard') if fontsize_form.is_valid(): fontsize_form.save() return redirect('/dashboard') if change_color_form.is_valid(): change_color_form.save() return redirect('/dashboard') if pagedetails_form.is_valid(): pagedetails_form.save() return redirect('/dashboard') else: form = FieldForm() radius_form = FieldRadiusForm(instance=radius) fontsize_form = FontSizeForm(instance=font_size) change_color_form = ColorsForm(instance=change_color) pagedetails_form = PageDetailsForm(instance=page_details) togglesettings_form = ToggleSettingsForm() return … -
How to bulk_create image field?
I have a model which I bulk_create and bulk_update from external data, but I havn't managed to do it with the model's image field. Is there a way to do so? I have a list of BytesIO objects (each corresponding to one object), for example: <_io.BytesIO object at 0x7f0ad4390b30> should be added as an image to object 1. Doing it manually and sequentially is possible, and I would add a single image to a single model like this: obj.image.save(file_name, files.File(file_object)) (With from io import BytesIO, from PIL import Image and from django.core import files prerequesite, if it is worth mentioning). But how can I do it in bulk, or as efficient as possible in any other manner? Thanks in advance :-)) Cheers -
don't let user create multiple objects with same value
I have a model with a foreign key called "title". I want to restrict each user to only be able to create an object with each title once, so that they can't have multiple objects with the same title. Does anybody know how I can achieve this? -
django-simple-history populate history when existing history present
After setting up history for a model using django-simple-history, I wanted to run populate_history to populate the history table based on the existing contents of the table. However, other users have already made a number of changes, causing the history table to be partially populated. Running populate_history --auto simply results in message Existing history found, skipping model. I wish to retain the existing history, but populate history for all records not currently stored in the history. Is there a way to do this? -
Why is my test failing on swapping to self.live_server_url() in Django?
so I'm doing a django calendar project with some TDD and running into an odd issue. I made a functional test using selenium that walks through logging in, adding an event to a calender and logging out. I had the test passing mostly but noticed I was adding items to my own database and figured I should use the LiveServerTestCase to avoid this. So I had the test inherit that and replaced self.browser.get('http://localhost:8000') with self.browser.get(self.live_server_url). The problem is that now the functional test fails part way through. This is the error that comes up: selenium.common.exceptions.ElementNotInteractableException: Message: Element <input id="id_title" class="event_name" name="title" type="text"> is not reachable by keyboard. This is happening because when a button is clicked, the JavaScript function I wrote doesn't change the form from style="visibility: hidden;" to style="visibility: visible;" I've confirmed in git the only line I'm changing is swapping from self.browser.get('http://localhost:8000') to self.browser.get(self.live_server_url). Why would swapping to the live server url cause this issue? Are there other ways I can delete objects after running the test? Any help is appreciated. -
when i submit email form it send back my own email Django python
class ProjectListAndFormView(SuccessMessageMixin, ListView, FormView): model = Project # data from database template_name = 'mainpage/main.html' context_object_name = 'list_projects' # name of the var in html template queryset = Project.objects.all().order_by("-pub_date")# list of all projects object_list = None form_class = ContactForm success_url = '/' # After submiting the form keep staying on the same url success_message = 'Your Form has been successfully submitted!' def form_valid(self, form): # This method is called when valid form data has been POSTed. cd = form.cleaned_data con = get_connection('django.core.mail.backends.console.EmailBackend') send_mail( cd['name'], cd['message'], cd.get('email', 'noreply@example.com'), ['22agrandon@gmail.com'], fail_silently=False ) return super(ProjectListAndFormView, self).form_valid(form) views.py im having trouble with a form page on my website. Whenever i enter a random email on the email form part on the website it sends a succesful mail but from my own emayil even if i put a random email. How do i fix this so when someone enters their email, it sucesfully sends me an email from their email? -
adding a url in django-template
i tried to add a url in django template which is supposedly to log out a user <div><a href="{% url 'accounts.views.user_logout' %}">logout</a></div> but it threw a NoReverseMatch the template: <header class="grid-header header"> <div class='logo-text'>Nitro fleet</div> <div class="profile-detail"> {% if user.is_authenticated %} <img class="profile-img" src="{{user.picture.url}}" /> <div> <div>{{user.username}}</div> <div><a href="{% url 'accounts.views.user_logout' %}">logout</a></div> </div> {%endif%} </div> </header> the url of the app (accounts) that has the logout view: from django.urls import path from . import views appname = 'accounts' urlpatterns = [ path('register', views.register_view , name='user_register'), path('login', views.user_login , name='user_login'), path('logout', views.user_logout , name='user_logout'), ] the view function: def user_logout(request): logout(request) return HttpResponseRedirect(request.path_info) the complete error log: NoReverseMatch at /maintenance/ Reverse for 'accounts.views.user_logout' not found. 'accounts.views.user_logout' is not a valid view function or pattern name. Request Method: GET Request URL: http://127.0.0.1:8000/maintenance/ Django Version: 3.2.9 Exception Type: NoReverseMatch Exception Value: Reverse for 'accounts.views.user_logout' not found. 'accounts.views.user_logout' is not a valid view function or pattern name. Exception Location: C:\Users\PC\AppData\Local\Programs\Python\Python310\lib\site-packages\django\urls\resolvers.py, line 694, in _reverse_with_prefix Python Executable: C:\Users\PC\AppData\Local\Programs\Python\Python310\python.exe Python Version: 3.10.0 Python Path: ['C:\\Users\\PC\\Desktop\\nitrofleet', 'C:\\Users\\PC\\AppData\\Local\\Programs\\Python\\Python310\\python310.zip', 'C:\\Users\\PC\\AppData\\Local\\Programs\\Python\\Python310\\DLLs', 'C:\\Users\\PC\\AppData\\Local\\Programs\\Python\\Python310\\lib', 'C:\\Users\\PC\\AppData\\Local\\Programs\\Python\\Python310', 'C:\\Users\\PC\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages'] Server time: Mon, 31 Jan 2022 20:43:51 +0000 -
How do I run my DJANGORESTFRAMEWORK APP with SSL (https) on Hostinger VPS
(Front end - VUE) Installed SSL on the site via certbot, HTTPS website cannot send a request to http, therefore it makes https, and the DJANGORESTFRAMEWORK server works on http ( python3 manage.py runserver 0.0.0.0:668 ) certbot apparently does not allow making a certain port under SSL , How do I handle it? Please help me all day I’ve been sitting with this, I saw a decision to create a subdomain, but how can I put SSL there if apache wont be working becouse DRF will be (they conflict), and I can’t get to https DRF even after disabling apache and running DRF on 80 port HELP PLEASE! (UBUNTU 20) problem -
How to delete a form with django formset?
Is there a way to remove a form that dynamically appears in a formset from django and javascript? I tried it but when I click it returns me to the index and if I check my previous formset (which are on the same page) I get an error I've already done tests, I've reviewed the documentation and it's not a problem with my JS but with django. In this tutorial I found that it can be done, however I don't understand -
Django STMP with IONOS
Having an adress mail managed by IONOS, I'm struggling to set it up with Django to be able to send mails automatically. Here's my error: TimeoutError: [Errno 110] Connection timed out I personnalized the SMTP in my settings: DEFAULT_FROM_EMAIL="mymail" EMAIL_HOST = 'smtp.ionos.fr' EMAIL_HOST_USER = 'myusername' EMAIL_HOST_PASSWORD = 'mymdp' EMAIL_PORT = 25 EMAIL_USE_SSL = True and here's how I send mails: from django.core.mail import send_mail def send_forgotten_password_mail(self, request, pk=None): send_mail( 'Subject here', 'Here is the message.', None, ['tosend'], fail_silently=False, ) I'm not that used to send mails through SMTP with Django, so I might miss something. Thank you for your help. -
Save user who submitted form(django)
So I'm creating a reporting app for my organization I want to be able to save the user that submits the report. Problem is if I use the models.ForeignKey(User,on_delete=models.PROTECT) method on my model I get a drop down for all the users which is not what I want. models.py class Report(models.Model): id = models.UUIDField(primary_key=True,default=uuid.uuid1,editable=False) department = models.ForeignKey(Company,null=True,on_delete=models.SET_NULL) user= models.ForeignKey(User,on_delete=models.PROTECT) submission_date= models.DateField(auto_now=True) #invisible to user submission_time = models.TimeField(auto_now=True) #invisible to ,user date = models.DateField(default=now,blank=False) time = models.TimeField(default=now,blank=False,help_text="hh:mm:ss") location = PlainLocationField() building = models.ForeignKey(bld,null=True,on_delete=models.SET_NULL) size = models.PositiveIntegerField() notes = models.TextField(blank=True) def __str__(self): return f'{self.date} {self.time} ({self.company}) form.py from django.forms import ModelForm, fields from django.shortcuts import redirect from django.urls.conf import include from .models import Report from django import forms from location_field.forms.plain import PlainLocationField class ReportForm(forms.ModelForm): class Meta: model = Report fields = '__all__' location = PlainLocationField() def redirect(): return redirect("Report") views.py from django.forms import fields from django.forms.forms import Form from django.http import request from django.http.request import HttpRequest, validate_host from django.http.response import HttpResponse, HttpResponseRedirect from django.shortcuts import render,redirect from django.urls.base import reverse from django.views.generic.base import TemplateView from django.contrib.auth import authenticate, login from django.contrib.auth.mixins import LoginRequiredMixin # Create your views here. from .forms import ReportForm from .models import Report from django.views.generic.edit import CreateView, UpdateView, DeleteView … -
Validate CSV file while reading by headers python
I would like to validate CSV file with headers: name, last_name The idea is, if in uploaded csv file in the first line are name and last_name then continue, if not - raise an error. def write(): header = ['name', 'last_name'] buffer = io.StringIO() writer = csv.writer(buffer) writer.writerow(header) # after writing data from table def create(self, request, *args, **kwargs): serializer = CsvSerializer(data=request.data) if not serializer.is_valid(): return Response(serializer.errors, status=status.HTTP_422_UNPROCESSABLE_ENTITY) try: csv_file = serializer.validated_data['file'] file = csv_file.read().decode('utf-8') except: raise ValidationError('File cannot be parsed', code='parsing_issue') csv_fields = ['name', 'last_name'] csv_reader = csv.DictReader(io.StringIO(file), fieldnames=csv_fields) next(csv_reader) # skip headers from csv for processing the file -
Running SQL query in Django
We have four tables Including Category, Seller, Product, Product_Seller. Each product has one category. each seller can sell a product. Suppose you do not sell the same product multiple times and each seller sells each product at most once. We want to find products that have more than 5 sellers. and we want to find the second category that has the largest number of products. I want to run the SQL code in Django. But it has multiple errors. Please let me know how can I fix it. Thank you for your time and consideration. from django.db import models from django.db import connection class Category(models.Model): title = models.CharField(max_length=128) class Seller(models.Model): name = models.CharField(max_length=128) class Product(models.Model): category_id = models.ForeignKey(category), rate = models.IntegerField(blank=True, null=True) class Product_Seller(models.Model): product_id = models.ForeignKey(product), seller_id = models.ForeignKey(seller), price = models.IntegerField(blank=True, null=True) cursor = connection.cursor() cursor.execute( SELECT product_id FROM Product_Seller groupby product_id having Count(product_id) >5;) cursor.execute( SELECT category_id FROM Product groupby category_id having max(Count(category_id)) and NOT IN(SELECT category_id FROM Product groupby category_id having max(Count(category_id)));) -
django-filter checkbox ajax
I am trying to implement django-filters + ajax(jquery) after sending the request, the selected checkboxes "disappear" I have little experience yet, tell me how to fix it? I need to connect django-filter + ajax(jquery) ```filters.py class ItemFilter(django_filters.FilterSet): category__name = django_filters.ModelMultipleChoiceFilter(field_name='name', widget=forms.CheckboxSelectMultiple,queryset=Category.objects.all()) class Meta: model = Item fields = ['category__name'] views.py class CategoryList(View): template_name = 'category/store.html' def post(self, request): select_check = self.request.POST.getlist('checkBOX[]') categories = Category.objects.all().filter(id__in=select_check) filter_test = ItemFilter(self.request.POST, queryset=categories) ..... return render(request,template_name=self.template_name, context=context) store.html {% for c in filter_test.form %} <form method="post" id="filter-checkbox" class="myform"> {% csrf_token %} <div class="form-checkbox"> <p id="check_box_id" type="checkbox" name='check_box' >{{ c }}</p> </div> {% endfor %} <button type="submit" class="myform-submit">Submit</button> </form> </div>``` -
How to list separated result in Django Rest Framework
Currently I have four endpoints: /boards /boards/public_to_company /boards/my_collections /boards/shared_with_me the first endpoint retrieve all boards, and the next 3 are custom actions that aplly some filters. But I would like /boards returns what the three boards returns, but separated, something like this: { public_to_company_boards: Object { count: 8, boards: […] } shared_w_boards Object: { count: 1, boards: […] } user_boards Object:{ count: 2, boards: […] } } I'm not sure if I need to use anotate or something like that. my current model: class Board(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=200, blank=False, null=False) description = models.TextField(max_length=1000, blank=True, null=True) public_to_company = models.BooleanField(default=False) share_list = ArrayField(models.CharField(max_length=15), null=True, blank=True, default=list) last_update = models.DateTimeField(auto_now=True) owner = models.CharField(max_length=200, blank=False, null=False) deleted = models.BooleanField(default=False) history = HistoricalRecords() serializer: class BoardSerializerList(serializers.ModelSerializer): qtd_cards = serializers.SerializerMethodField() @staticmethod def get_qtd_cards(instance): return instance.cards.count() class Meta: model = Board fields = '__all__' read_only_fields = ['owner'] view: class BoardViewSet(ModelViewSet): queryset = Board.objects.exclude(deleted=True) serializer_class = BoardSerializerList permission_classes = [BoardPermission] authentication_classes = [TuriviusAuthentication] def destroy(self, request: Request, *args, **kwargs) -> Response: board = self.get_object() if not board.deleted: board.deleted = True board.save() return Response(status=status.HTTP_204_NO_CONTENT) return Response(status=status.HTTP_400_BAD_REQUEST) def get_serializer_class(self): if self.action == 'retrieve': return BoardSerializerRetrieve return super().get_serializer_class() @action(detail=True, methods=['get', 'post', 'delete'], serializer_class=CommentSerializer) def comments(self, request): … -
Number of format specifications in 'msgid' and 'msgstr' does not match msgfmt: found 1 fatal error
Django-Admin generates the following error: Execution of msgfmt failed: /home/djuka/project_app/locale/eng/LC_MESSAGES/django.po:49: number of format specifications in 'msgid' and 'msgstr' does not match msgfmt: found 1 fatal error CommandError: compilemessages generated one or more errors. I have the same number of strings in msgid and msgstr and i still get an error. Here is the code. #: reBankMini/templates/reBankMiniApp/index.html:135 #, python-format msgid "" "Leta 2020 je po svetu nastalo rekordnih 54 milijonov ton elektronskih " "odpadkov, kar je 21 odstotkov več kot v zadnjih petih letih. E-odpadki so " "najhitreje rastoči gospodinjski odpadki na svetu, ki jih povzročajo predvsem " "višje stopnje porabe električne in elektronske opreme, kratki življenjski " "cikli in malo možnosti za popravila. Le 17,4%% zavrženih e-odpadkov leta " "2020 je bilo recikliranih. Pri procesu recikliranju pride do številnih " "okolju nevarnih reakcij. Mi recikliramo drugače. Prizadevamo si za varne, " "trajnostne in popravljive izdelke, s katerimi bo vsak uporabnik aktivno " "vključen v reševanje okoljskih problemov." msgstr "" "In 2020, a record 54 million tons of electronic " "waste was generated worldwide, which is 21 percent more than in the last five years. E-waste is " "the fastest growing household waste in the world, caused mainly by " "higher … -
How to automatically update field in Django Admin (back end)
Imagine, that I have a model Ticket: class Ticket(models.Model): name= models.CharField(max_length=30, verbose_name='name') ticket_status = models.BooleanField(default=False, verbose_name='Is Active?') ticket_end = models.DateField(blank=True, verbose_name='Closing Date', null=True) class TicketAdmin(admin.ModelAdmin): list_display= ('name','ticket_status','ticket_end ') I can override save method: def save(self, *args, **kwargs): if self.dep_end > ## Expiration date here ##: self.dep_status = False super(Ticket, self).save(*args, **kwargs) And it's work in case when I am manually update object. But how realize automatically update in back end (in Django admin). Something like this: ticket_end = 1.02.2022, when the current date = 2.02.2022: update ticket_status = False. -
Django: App not compatible with buildpack
I am trying to deploy my Django app on Heroku and I am getting this error - error Based on the answers to this question, here is what I have tried so far - Adding the 'requirements.txt' file in the root directory of the project. Adding 'Procfile' in the root directory of my project. Made sure git is initialized in the root directory of my project. This is what my project structure looks like - Project Structure This is what my 'Procfile' looks like - web: gunicorn GameStudio.wsgi --log-file - Any suggestions/pointers will be highly appreciated. Thank you for your time! -
Django authentication jwt authentication
Can I use JWT(Json web token) in Django project which is not API? Or JWT is only used for API projects? If yes please recommend other alternatives