Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
custom reset password django
can anybody lead to how to implement custom reset password in Django I wanna implement it to able to reset the password with the username and email I searched a lot but I didn't find a good one thanks a lot -
Django settings module error. TypeError: __import__() argument 1 must be string, not None
Im getting this error when trying to run python manage.py runserver on my Django application. I have set DJANGO_SETTINGS_MODULE=settings.local. Traceback (most recent call last): File "manage.py", line 17, in <module> settings_mod = __import__(settings_name, globals(), locals(), [], -1) TypeError: __import__() argument 1 must be string, not None It seems nothing may be passing to settings_mod properly? -
Start and Stop a periodically background Task with Django
I would like to make a bitcoin notification with Django. If managed to have a working Telegram bot that send the bitcoin stat when I ask him to do so. Now I would like him to send me a message if bitcoin reaches a specific value. There are some tutorials with running python script on server but not with Django. I read some answers and descriptions about django channels but couldn't adapt them to my project. I would like to send, by telegram, a command about the amount and duration. Django would then start a process with these values and values of the channel I'm sending from in the background. If now, within the duration, the amount is reached, Django sends a message back to my channel. This should also be possible for more than one person. Is these possible to do with Django out of the box, maybe with decorators, or do I need django-channels or something else? -
Django: Change folder structure of locale
Currently my folder structure looks like that: ~/projects/project_name/ src/ project_name settings locale *applications* docs/ requirements I want to bring locale one up so it's together with src, docs etc. That's currently in my settings fily: BASE_DIR = Path(__file__).resolve().parent.parent.parent LOCALE_PATHS = [BASE_DIR / 'locale'] I tried to change it to BASE_DIR = Path(file).resolve().parent.parent.parent LOCALE_PATHS = [BASE_DIR.parent / 'locale'] But it didn't work. Also not with os.path.join(BASE_DIR, ...). Anyone know how to achieve that? -
How to prefetch Wagtail post tags?
I have around 10 posts and it is generating about 100 queries to fetch post tags. The taggit library Wagtail used underneath supportprefetch_related, but adding prefetch_related has no effect. After more research, I found that the culprit is Wagtail's ClusterTaggableManager that overrides taggit's TaggableManager. In the changelog, it says 2.0 (22.04.2016) ~~~~~~~~~~~~~~~~ * Fix: prefetch_related on a ClusterTaggableManager no longer fails (but doesn't prefetch either) It has been 2 years and it seems they are not going to fix it anytime soon. So... Is there anything I can do to reduce the number of queries? Thanks! -
Django: custom login does not show validation errors upon unsuccessful login attempt
the code is for some reason not showing the validation errors (that are shown in the forms.py) when a person unsuccessfully logs in. It just displays the empty template. I believe the template is getting overwritten but I am not sure whereabouts in my code is the problem: views.py def log_in(request): form = LogInForm(request.POST or None) if request.method == 'POST': username = request.POST['username'] password = request.POST['password'] user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) return redirect('menu') return HttpResponseRedirect("/login") else: return render(request, 'login.html', {'form': form}) login.html {% extends 'html/base.html' %} {% load bootstrap %} {% load static %} {% block add_head %} <link rel="stylesheet" href="{% static 'css/login.css' %}"> <link href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <link rel="stylesheet" href="{% static 'css/menu.css' %}"> {% endblock %} {% block logout %} <a href="{% url 'index' %}" class="button" type="button" style="vertical-align:middle; background-color: red; width: 7%;"><span>Home</span></a> {% endblock %} {% block content %} <div class="container"> <div class="row" style="margin-top:20px; text-align: center; font-size: large"> <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3"> <form role="form" method="POST" enctype="multipart/form-data"> <hr class="colorgraph" style="margin-top: 0"> {{ form|bootstrap }} <hr class="colorgraph"> {% csrf_token %} <div style="text-align: center;"> <input type="submit" class="btn btn-lg btn-primary inline-block" style="width: 30%; background: purple; border: purple;" value="Log in"/> <a href="{% url 'signup' … -
Django 1.10 - Update Web Page with data from Database every X seconds
I need to update my web page every X seconds with new information from the database. This is a relatively small application so I thought schedule would do the job. What I have done so far: Getting latest value from database Passing on to template Followed schedule docs (or at least I think I did) but nothing seems to happen when I print to console just as a test. Here is my code in views.py: from __future__ import unicode_literals from django.shortcuts import render from django.http import HttpResponse from lineoee.models import Lineoee3 import threading import time import schedule def job(): last_oee1 = oee_list[-1] print(last_oee1) #test print def index(request): context = {} lines = Lineoee3.objects.all().values('oee') enter code here oee_list = list(Lineoee3.objects.all().values_list('oee', flat=True)) schedule.every(10).seconds.do(job) last_oee = oee_list[-1] var = "Current OEE is: " context = {'lines' : lines, 'var' : var, 'last_oee' : last_oee,} return render(request, 'lineoee/index.html',context) The code above works well except for the schedule part. No errors are given. How do I print an updated version of the last oee value every X seconds? -
Nginx does not load css files (Django)
I made a new project in Django. On my local Computer everything is working just fine, so i tried to make it public. I used DigitalOcean as the host. I found 2 Tutorials to publish a Django Project on a DigitalOcean VPS. One is for Security and one is for publishing. Django security Tutorial: Link Django project publishing: Link After i followed the Tutorials everything worked fine except one thing. All files (Images, JS) are loaded correctly except the static css files, which is really strange. I think it is an Nginx problem. I am new to Nginx, so i don't know what to do. I tried a few Stackoverflow Questions and searched for this problem a lot, but I can't figure out what to do. The css files are located in a subfolder of a folder called static. Image of the static files structure static files settings.py: STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' STATICFILES_DIR = '/home/djangodeploy/bhitweb2/static' Nginx: server { listen 80; server_name 142.93.100.9; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/djangodeploy/bhitweb2; } location /media/ { root /home/djangodeploy/bhitweb2; } location / { include proxy_params; proxy_pass http://unix:/home/djangodeploy/bhitweb2/bhitweb2.sock; } } Does anyone know a solution? -
Missing id field in ModelForm
I am using DjangoCrispyForms and I have created a ModelForm for my User model. In Meta class I have registered what fields I would like to have in the form, one of them is id of User. The problem is that this id field doesn't appear in the form, I had to manually add such a field to my form class. It gets more complex when I want to save changes to DB and I need to extract id from cleaned_data. class EditUserForm(forms.ModelForm): id = forms.IntegerField() # needed to add this def __init__(self, *args, **kwargs): super(EditUserForm, self).__init__(*args, **kwargs) self.helper = FormHelper(self) self.fields['id'].widget = HiddenInput() self.helper.layout = Layout( Fieldset( 'Edit user', 'username', 'first_name', 'last_name', 'email', 'is_superuser', 'id' ), ButtonHolder( Submit('submit', 'Save') )) def clean(self): username = self.cleaned_data.get('username') email = self.cleaned_data.get('email') if len(User.objects.filter(username=username)) > 1: self.add_error('username', 'Username is taken.') if len(User.objects.filter(email=email)) > 1: self.add_error('email', 'Account with this email exists') return self.cleaned_data def save(self, commit=True): instance = super(EditUserForm, self).save(commit=False) data_id = self.cleaned_data.get('id') # need to get this from data instance.id = data_id # and set id for instance if commit: instance.save() return instance class Meta: model = User fields = ['id', 'username', 'first_name', 'last_name', 'email', 'is_superuser'] # here we can see that id … -
django extend query condition `COLLATION`
django==1.11.9 mysql version 5.6.38 +----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | +----------------------+-----------------+ I have an accent field in my data, and I set the unique field. However, multiple results will appear in the query. Although I know you can by ALTER TABLE test DEFAULT COLLATE utf8_bin; set the table properties. But I think the better way is through the query to add conditions SELECT * FROM test WHERE name = 'a' collate utf8_bin;. Now I don't know how to use it in the queryset method. When I was in inserting data usually use update_or_create() method, which will directly lead to some other form (with accent) data is not inserted into it. Can this query condition be extended in Django's queryset method? Thank you for your answer. -
how to add a language in Django that its not supported by default?
Im trying to make a website in 5 languages. The main language should be kurdish but it is not supported by Django default. I tried already the how to add new languages into Django? but it didnt work for me. I receive an error mesagge **LANG_INFO = dict(django.conf.locale.LANG_INFO.items() + EXTRA_LANG_INFO.items()) TypeError: unsupported operand type(s) for +: 'dict_items' and 'dict_items'** I also tried already to copy an english po file and rename it "ku" (kurdish) and i added into django/conf/init.py the language info. 'ku': { 'bidi': False, 'code': 'ku', 'name': 'Kurdish', 'name_local': 'Kurdî', }, I can see the language by languages option by template but when i click it i receive an error message. File "/usr/lib/python3.6/gettext.py", line 91, in _tokenize raise ValueError('invalid token in plural form: %s' % value) ValueError: invalid token in plural form: EXPRESSION Does anybody know how can i fix it? Thanks so much! -
Make To tables linked in Django
I am working on a project in Django where 1 person has to make data and 2 person approve data after checking it. I have created a table for Maker which is being popluated with data by filling forms how can i give same data to approver with some extra field like to approve or reject it. -
Django getting object which is just created, but returns nothing
I have a view: if request.method == "POST": if request.user.is_authenticated: if request.is_ajax(): try: post = Post.objects.all().last() except: return JsonResponse({'res': 0}) print('got post: ' + str(post)) try: post_chat_create = PostChat.objects.create(post=post, kind=POSTCHAT_TEXT, before=None, you_say=True, uuid=uuid.uuid4().hex) print('post chat has been created') except Exception as e: print('if it has exception: ' + str(e)) print('just created post chat: ' + str(post_chat_create.pk)) try: post_chat_last = PostChat.objects.all().last() print('any made post chat?: ' + str(post_chat_last)) except PostChat.DoesNotExist: print('has error on getting post_chat_last') print('has no error on getting post_chat_last') I think it is very weird because it prints something like it: print on terminal: got post: Post pk: 2, user: useruser1 post chat has been created just created post chat: 32 any made post chat?: postchat: None has no error on getting post_chat_last Question: Why? for sure, there was a creating of PostChat object. Because of this terminal line:just created post chat: 32 but print('any made post chat?: ' + str(post_chat_last)) this line returns: any made post chat?: postchat: None It's strange. Just been made some PostChat, but can't get it. Why this happened? Here's models.py: class Post(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True) title = models.TextField(max_length=1000, null=True, blank=True, default=None) description = models.TextField(max_length=2000, null=True, blank=True, default=None) has_another_profile = models.BooleanField(default=False) … -
assign resulting csv file to django model
I'm developing a website that consists of different songs. These songs contain different attributes, one of them is a midi file that I upload through the fileField field of django. When I add a song with these attributes using a form, I call a script that generates a csv file with midi attribute information. The problem is that I would like to assign this resulting csv file directly to another Filefield, i.e. when I create the form, this csv is assigned to a fileField. I'd like to know if somebody could please help me with this. If you need any code or something else let me know. -
Django Form Not Saving, Terminal Shows Data & Save Method Added
All I'm trying to do is save the simple form. Everything looks fine but after I click save and the form is re-rendered there is no new trade in the Database. No error message is thrown either. At first, I thought there was an issue with the user but it looks fine as well. Been reading a lot of documentation on this topic but haven't found where the issue is yet. Thanks for any help and please let me know if there is anything extra I can add. create.html <form id='trade_create_view' method='POST' action='.'> {% csrf_token %} {{ form.as_p }} <input type='submit' value='Submit' > </form> views.py def trade_create_view(request): form = TradeForm(request.POST or None, instance=request.user) if form.is_valid(): print(form.cleaned_data) form.save() form = TradeForm() context = { 'form': form, } return render(request, "tj/cp/trade/create.html", context) forms.py from django import forms from .models import Trade class TradeForm(forms.ModelForm): class Meta: model = Trade fields = [ 'user', 'target_size', 'target_entry', 'target_exit', 'ticker', 'exchange', 'short', 'comments', 'size', 'entry_price', 'exit_price', 'entry_date', 'exit_date', 'fees', 'permission', ] exclude = ['user',] model.py class Trade(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE, null=False) comments = models.TextField(max_length=10000, blank=True, null=True) created = models.DateField(auto_now_add=True) last_edit = models.DateField(auto_now=True) #general trade info ticker = models.ForeignKey(Ticker, on_delete=models.CASCADE) short = models.BooleanField(default=False) exchange = models.ForeignKey(Exchange, … -
is it possible to make the content visible to a single user, before it was public to all the users ,using django?
I am making a web page using django in it people can publish their research papers,can comment ,but now i want that the research papers till that day after completion of every year should only be visible to the head through web page and not to all the users ,but they should be able to publish for the next year and this process can recur every year .Thankyou in advance. -
Django; null value in column "user_id" violates not-null contsraint Django
I'm creating a project using Django. I'm trying to adapt cropper (js library) into my project. I was following this tutorial. https://simpleisbetterthancomplex.com/tutorial/2017/03/02/how-to-crop-images-in-a-django-application.html Now I want to associate the user with the cropped image but this error happens and I don't know how I can associate the user with image inside the customized save method. Here is my code. models.py class ProfileImage(models.Model): file = models.ImageField(upload_to='blog/profile') created = models.DateTimeField(auto_now_add=True) #Associate with the user user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) forms.py class EditProfileImageForm(forms.ModelForm): x = forms.FloatField(widget=forms.HiddenInput()) y = forms.FloatField(widget=forms.HiddenInput()) width = forms.FloatField(widget=forms.HiddenInput()) height = forms.FloatField(widget=forms.HiddenInput()) class Meta: model = ProfileImage fields = ('file', 'x', 'y', 'width', 'height', ) #save the resized image def save(self): photo = super(EditProfileImageForm, self).save() x = self.cleaned_data.get('x') y = self.cleaned_data.get('y') w = self.cleaned_data.get('width') h = self.cleaned_data.get('height') image = Image.open(photo.file) cropped_image = image.crop((x, y, w+x, h+y)) resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) resized_image.save(photo.file.path) return photo views.py @login_required def edit_profile_image(request): try: image = ProfileImage.objects.get(user=request.user) except: image = None if request.method == 'POST': form = EditProfileImageForm(request.POST, request.FILES) if form.is_valid(): form.save() return HttpResponseRedirect(reverse_lazy('blog:index')) else: form = EditProfileImageForm() return render(request, 'blog/edit_profile_image.html', {'form': form, 'image': image}) How can I fix this error? -
Save a raw html form django
I am trying to save some user data from a raw html form in django. My code looks like this: # This is the view --> if request.method == 'POST': name = request.POST['name'] email = request.POST['email'] age = request.POST['age'] password = request.POST['password'] # Some validation (But unnecessary for this Question) # save the form into my user model -
Nginx server not starting - failed because the control process exited with error code.
I am trying to deploy my django project to AWS EC2 cloud on Nginx server but I am getting error as - Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. When I run systemctl status nginx.service it shows me - (django_env) ubuntu@ip-172-31-29-67:~$ systemctl status nginx.service ● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2018-08-09 10:57:17 UTC; 1min 13s ago Process: 13130 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=2) Process: 14470 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE) Main PID: 12837 (code=exited, status=0/SUCCESS) Aug 09 10:57:17 ip-172-31-29-67 systemd[1]: Starting A high performance web server and a reverse proxy server... Aug 09 10:57:17 ip-172-31-29-67 nginx[14470]: nginx: [emerg] "listen" directive is not allowed here in /etc/nginx/sites-enabled/bingle.conf:3 Aug 09 10:57:17 ip-172-31-29-67 nginx[14470]: nginx: configuration file /etc/nginx/nginx.conf test failed Aug 09 10:57:17 ip-172-31-29-67 systemd[1]: nginx.service: Control process exited, code=exited status=1 Aug 09 10:57:17 ip-172-31-29-67 systemd[1]: Failed to start A high performance web server and a reverse proxy server. Aug 09 10:57:17 ip-172-31-29-67 systemd[1]: nginx.service: Unit entered failed state. Aug … -
Change the data in div periodically on django template
I want to change the comments(data) appearing on my page periodically. I'm new to using javascript as well as django. I have referred to a question here yet the data is not changing, it does on page refresh though. Here's my code in views.py def index(request): count = Article.objects.all().count() comments = Article.objects.values_list('content')[randint(0, count - 1)][0] context = { 'current_date':datetime.now(), 'title':'Home', 'comments':comments } return render(request, 'index.html', context) in urls.py urlpatterns = [ url(r'^$', index, name='index'), url(r'^about/$',about), # url(r'^comments/$',ArticleCreateView.as_view(), name='comments'), url(r'^admin/', admin.site.urls),] in index.html <div> <div id="comments"> {{ comments }} </div> <script> var ALARM_URL = "{% url 'index' %}"; function refresh() { $.ajax({ url: ALARM_URL, success: function(data) { $('#comments').html(data); } }); }; $(document).ready(function ($) { refresh(); var int = setInterval("refresh()", 3000); -
Django IntegrityError - NOT NULL constraint failed: learning_logs_topic.owner_id
The Problem Hi, I'm making a project called "learning_log", where you can make new topics and add entries associated with that specific topic. I have a problem; when I try to add a new topic, an IntegrityError pops up on the screen, when I try to make a new topic in the browser. It keeps highlighting the code: form.save() in my views.py, after I set up a User authentication and registration system. This is the traceback I get: Exception Type: IntegrityError at /new_topic/ Exception Value: NOT NULL constraint failed: learning_logs_topic.owner_id The Code My views.py looks like this: from django.shortcuts import render from django.http import HttpResponseRedirect, Http404 from django.urls import reverse from django.contrib.auth.decorators import login_required from .models import Topic, Entry from .forms import TopicForm, EntryForm def index(request): """The Home Page for Learning Log.""" return render(request, 'learning_logs/index.html') @login_required def topics(request): """Show all topics.""" topics = Topic.objects.filter(owner=request.user).order_by('date_added') context = {'topics': topics} return render(request, 'learning_logs/topics.html', context) @login_required def topic(request, topic_id): """Show a single topic and all its entries.""" topic = Topic.objects.get(id=topic_id) # Make sure the Topic belongs to the current user. if topic.owner != request.user: raise Http404 entries = topic.entry_set.order_by('-date_added') context = {'topic': topic, 'entries': entries} return render(request, 'learning_logs/topic.html', context) @login_required def new_topic(request): """Add … -
How to remove user from Django Blocked list, (User blocked by Django throttle)?
I'm using Django throttle to block the user after 5 login attempts. I'm using this code --> (How to prevent brute force attack in Django Rest + Using Django Rest Throttling ) to block the user. I want to add a feature where admin can reset user (remove blocked users from the blocked list) How can I do this, Plase suggest me? Thanks in advanced. -
Django Rest Framework - writable nested serializer context
So I have a hierarchy of models, all of which will be created using the parent serializer. For the grandchild validation I need information from the Brother. The problem is that the last serializers in the nested hierarchy will be validated first, so I won't be able to pass the brother information to the Grandchild serializer. I am looking for a way to either change the order the serializers are validated in, or a way to pass the other serializers' data to the Grandchild serializer The models and serialzier look like this: class Parent(TimeStampedModel): child = models.OneToOneField('app.Child', related_name='parent') brother = models.OneToOneField('app.Brother', related_name='parent') class Child(TimeStampedModel): grandchild = models.OneToOneField('app.GrandChild', related_name='dad') class ParentSerializer(serializer.ModelSerializer): name = serializer.CharField(max_length=10, allow_null=False) child = ChildSerializer(required=False, allow_null=True) brother = BrotherSerializer(required=False, allow_null=True) class ChildSerializer(serializers.ModelSerializer): name = serializer.CharField(max_length=10, allow_null=False) grandchild = GrandchildSerializer(required=False, allow_null=True) I have tried a few things so far, and there were 2 things that worked: - Access the parent serializer's data from the nested one using self.parent.data or self.parent.parent.data. - In the view, pop the nested models' data and manually instanciate the serializers and create them, like this: grandchild_data = request.data['child'].pop('grandchild', None) brother_data = request.data.pop('brother', None) serializer_context = super(view, self).get_serializer_context() serializer_context.update({'brother': brother_data}) grandchild_serializer = GrandchildSerializer(data=grandchild_data, context=serializer_context) grandchild_serializer.is_valid(raise_exception=True) grandchild_serializer.save() … -
ModuleNotFoundError: No module named 'capfuzz'
When I trying to start the MobSF (Mobile-Security Framework)in Windows 10 by giving the command like - python manage.py runserver Request you to help to rectify the below issue- c:\Users\username\Mobile-Security-Framework-MobSF>python manage.py runserver Performing system checks... Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x000001C247E189D8> Traceback (most recent call last): File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\management\commands\runserver.py", line 120, in inner_run self.check(display_num_errors=True) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\management\base.py", line 364, in check include_deployment_checks=include_deployment_checks, File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\management\base.py", line 351, in _run_checks return checks.run_checks(**kwargs) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\checks\registry.py", line 73, in run_checks new_errors = check(app_configs=app_configs) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\checks\urls.py", line 13, in check_url_config return check_resolver(resolver) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\core\checks\urls.py", line 23, in check_resolver return check_method() File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\urls\resolvers.py", line 397, in check for pattern in self.url_patterns: File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\utils\functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\urls\resolvers.py", line 536, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\utils\functional.py", line 36, in __get__ res = instance.__dict__[self.name] = self.func(instance) File "C:\Users\username\AppData\Roaming\Python\Python37\site-packages\django\urls\resolvers.py", line 529, in urlconf_module return import_module(self.urlconf_name) File "C:\Program Files\Python37\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, … -
403 by graphene-django. don't use csrf_exempt
I use graphene-django. Creating an application, GraphiQL worked well for login and other functions. but when I use Insomnia, I get a 403 error. I referrred this. https://github.com/howtographql/howtographql/blob/master/content/backend/graphql-python/4-authentication.md I tried csrf_exempt(It works fine, but of course not) django-cors-headers(It does not work well) How can I recovery the 403 error?