Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to send data to Django from Kafka (python library)?
i am trying to implement an app that streams Data from a message bus. I have chosen to use Pykafka as a bus but i dont know if it can connect with my Django app. Using Django Channels all the solutions i have found use Redis as a message queue but i want to create something more scalable. Any advice even a basic one can be helpful, thaks in advance. -
How to parse the many values of one-to-many relationship into HTML template in Django?
I have a one-to-many relationship in Django as such: class Listing(models.Model): title = models.CharField(max_length=60) class Images(models.Model): listings = models.ForeignKey(Listing, on_delete=models.CASCADE) image_urls = models.URLField(max_length = 200) I have the following view defined: from .models import Listing, Images def index(request): All_Listings = Listing.objects.filter(isActive=True) return render(request, "index.html", { "All_Listings": All_Listings, "Images" : Images }) Now for each listing I want to show all related images in my HTML. I have tried to do the following: {% extends "layout.html" %} {% block body %} {% for listing in All_Listings %} <h2>{{ list(Images.objects.filter(listings_id=2)) }}<h2> {% endfor%} {% endblock %} (If this works, than later on I will replace 2 with listing.id) This returns the following error: Exception Type: TemplateSyntaxError Exception Value: Could not parse the remainder: '(Images.objects.filter(listings_id=2))' from 'list(Images.objects.filter(listings_id=2))' However, when I run this from the terminal it works: >>> list(Images.objects.filter(listings_id=2)) [<Images: https://www.kettererkunst.com/still/kunst/pic570/531/422000352-4.jpg>, <Images: https://www.kettererkunst.com/still/kunst/pic570/531/422000352-1.jpg>] How should I approach this? -
RuntimeWarning: DateTimeField Lesson.startdate received a naive datetime (2022-09-18 00:00:00) while time zone support is active. RuntimeWarning)
RuntimeWarning: DateTimeField Lesson.startdate received a naive datetime (2022-09-18 00:00:00) while time zone support is active. RuntimeWarning) def auto_send_notification(request): today = date.today() substatus = SubscribeEmailModel.objects.filter(topic__startdate=today, sent_mail=False) Models.py class Lesson(models.Model): startdate = models.DateTimeField(auto_now=True, null=True) enddate = models.DateTimeField(auto_now=True,null=True) -
Unable to connect. Error: self signed certificate (Retool, Heroku and Django)
I'm doing a Django project using Heroku and Retool for my database and tests. Still, when I try to connect my Retool resource to the Heroku database it shows the error "Unable to connect. Error: self-signed certificate". Has this happened to anyone else? Thanks! PS.: I need to connect using SSL -
Dynamically load data into a Django Template from a Django Modal without page refresh
I have the following Django model and I use the first 3 fields to generate a tree-view in the template as shown below. class operationTemplates(models.Model): templateID = models.IntegerField(primary_key = True) templateCategory = models.CharField(max_length=255, blank=True, null=True) templateName = models.CharField(max_length=400, blank=True, null=True) templatePreopBundle = models.TextField( blank=True, null=True) templateIndication = models.TextField( blank=True, null=True) templatePosition = models.TextField( blank=True, null=True) templateProcedure = models.TextField( blank=True, null=True) templateClosure = models.TextField( blank=True, null=True) templatePostOpInstructions = models.TextField( blank=True, null=True) <!-- tree view --> <ul class="tree"> <li> <input type="checkbox" id="c0" /> <label class="tree_label" for="c0">Vascular Surgery</label> <ul> {% for k, v in group.items %} <li> <input type="checkbox" id="c{{forloop.counter}}" /> <label for="c{{forloop.counter}}" class="tree_label">{{ k }}</label> <ul> {% for x in v %} <li><span class="tree_label"><a href="{{ x.templateID }}">{{ x.templateName }}</a></span></li> {% endfor %} </ul> </li> {% endfor %} </ul> </li> </ul> <!-- tree view end--> Tree-View generated dynamically using date from the above modal When the user clicks on a particular leaf of the tree, I want to be able to query and display all the fields relevant to that record from the Danjo Model without a page refresh. What is the best way to achieve this? Do I need to use JSON/JavaScript? Or is there an elegant way to do it just … -
<p> tag has padding around it
I have form with multiple inputs in it: <input type="text" placeholder="First name" class="input_1_error input_1"> <input type="text" placeholder="Last Name" class="input_2" name="last_name" size="1" value="{{ data.last_name }}"> <input type="text" placeholder="Username" class="input_3" name="username" size="1" value="{{ data.username }}"> <input type="text" placeholder="Email" class="input_6 input_6_error" name="email" size="1" value="{{ data.email }}"> but when I add <p>Please enter your email</p> under email it creates much more space than I would want -
How to design Student QRcode meal card system using Django
Hello Django developers, I want to build student cafeteria system using QRcode scanner. Here is how it should work. Student scann there meal card, then the system displays student info and also it should mark served. Then the system count the number of served students. The system should ignore or show red labeled text if there is rescanning. So here i who can help me what things i have to consider to get the django model. Thank you -
Error in running a project regarding virtual environment and "DJANGO_SECRET_KEY" in VS code
I want to run a project from gitlab on my local machine. I cloned the project, created a virtual environment and activated it. When I want to run without debugging I got this error: File "c:\Users\ME\Desktop\test\z_tool\settings.py", line 28, in SECRET_KEY = env.str('DJANGO_SECRET_KEY') File "c:\Users\ME\Desktop\test\myenv\lib\site-packages\environs_init_.py", line 110, in method raise EnvError('Environment variable "{}" not set'.format(proxied_key or parsed_key)) environs.EnvError: Environment variable "DJANGO_SECRET_KEY" not set The output of this project is a form, how can I solve this error to get the output? -
CSRF token verification error in django admin using SSL, nginx
I have a csrf token error when trying to log in to the django admin in production after adding SSL. So if I use the configuration below without ssl everything works fine: upstream app_server { server unix:/home/app/run/gunicorn.sock fail_timeout=0; } server { listen 80; # add here the ip address of your server # or a domain pointing to that ip (like example.com or www.example.com) server_name 107.***.28.***; keepalive_timeout 5; client_max_body_size 4G; access_log /home/app/logs/nginx-access.log; error_log /home/app/logs/nginx-error.log; location /static/ { alias /home/app/static/; } # checks for static file, if not found proxy to app location / { try_files $uri @proxy_to_app; } location @proxy_to_app { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect off; proxy_pass http://app_server; } } But if I change to configuration do listen SSL when filling in any form on the page I get the csrf_token error. My configuration nginx using SSL: upstream app_server { server unix:/home/app/run/gunicorn.sock fail_timeout=0; } server { #listen 80; # add here the ip address of your server # or a domain pointing to that ip (like example.com or www.example.com) listen 443 ssl; server_name example.com; ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; keepalive_timeout 5; client_max_body_size 4G; access_log /home/app/logs/nginx-access.log; error_log /home/app/logs/nginx-error.log; # Compression config gzip on; gzip_min_length 1000; gzip_buffers 4 32k; gzip_proxied … -
In a Django Rest Framework view, does request.user make a database call or the database call happens before the request reaches the view?
I need to retrieve some information about my users and I am trying to avoid making unnecessary database calls. The information I need is stored in three models: User, UserProfile and Membership. Both UserProfile and Membership have a OneToOne relationship with the User model. I know that I can use select_related() to retrieve related models from the database in a single call. So I could do something like: User.objects.select_related('userprofile').select_related('membership').get(id=request.user.id) But that must not be correct, because if I am using some user information to do the query, it means I already retrieved this information in a previous call. So what would be the best way to get this information minimising database calls? Would it be even possible to get the information from these 3 models in a single call? -
How do I search 2 tables in
I am continuing to learn Django as a newbie.....I would like some direction in relation to 1 search query against two tables that hold the same headers such as customer names. So table 1 is customer names from 2022 and table 2 is customer names from 2021. I can create the models / admin and URL and set the project up. How do I create a query to search both tables at the same time and display the result? View.py def index(request,): q = request.GET.get('q') if q: #this is what is searched against.....ie the columns in our model.py vector = SearchVector('name') #This is the value the user is searching for: query = SearchQuery (q) # customers = customer.objects.filter(name__search=q) # customers = customer.objects.annotate(search=vector).filter(search=query) customers = customer1.objects.annotate(rank=SearchRank(vector, query)).filter(rank__gte=0.001).order_by('-rank') else: customers = None context = {'customers': customers} return render(request, 'index.html', context) Index.html <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>GAEN</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous"> </head> <body> {% include 'navbar.html' %} <div class="container"> {% block content %} <br><br><br><br> <form> <div class="mb-3"> <label for="Search Query" class="form-label "> <h3>db Search Query</h3> </label> <br><br> <input type="text" class="form-control" aria-describedby="#" name="q"> <br><br> <button type="submit" class="btn btn-primary ">Submit</button> <button type="submit" class="btn btn-danger">Reset</button> </div> </form> {% … -
Django ManyToManyField does not get cleared
I am using a ManyToManyField and want to be able to clear it. This is my current code (Yes, I do override the save method of the same Object Class) def save(self, *args, **kwargs): if self.maxparticipants == 0: self.participants.clear() super(Event, self).save(*args, **kwargs) What it does:It checks if the maxparticipant count is 0 (so there is no participant allowed) and if it's true it should remove every participant from the m2m. When printing self.participants.all() I get Queryset([]) - it works fine.... in theory because it won't get written to the database :/ If you need more details just add a comment :) -
google login in django do not give email and username instead give first_name and last_name in django_rest_social_oauth2 and update value superuser
using google login in django do not give email and username instead give first_name and last_name only and update that in my superuser in django_rest_social_oauth2 SOCIAL_AUTH_GOOGLE_OAUTH2_SCOPE = [ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'] SOCIAL_AUTH_USERNAME_IS_FULL_EMAIL = True SOCIAL_AUTH_GOOGLE_OAUTH2_USER_FIELDS = ['first_name', 'last_name', 'email','username'] AUTHENTICATION_BACKENDS = ( # Facebook OAuth2 'social_core.backends.facebook.FacebookAppOAuth2', 'social_core.backends.facebook.FacebookOAuth2', # Google OAuth2 'social_core.backends.google.GoogleOAuth2', # django-rest-framework-social-oauth2 'rest_framework_social_oauth2.backends.DjangoOAuth2', # Django 'django.contrib.auth.backends.ModelBackend', ) SOCIAL_AUTH_USER_MODEL = '<custom user model>' -
NameError: name 'playground' is not defined
I am beginner. I am trying to learn Django. But I face a problem. I defined app name inside my project file but django did not found it. I am using Atom as a Code Edittor. Please Any one help me..enter image description here this is my code path('playground/',include(playground.urls)) File "C:\Users\Hasan\Documents\Django\STOREPRONT\STOREPRONT\urls.py", line 8, in path('playground/',include(playground.urls)) NameError: name 'playground' is not defined -
I am trying to get POST request but django response with GET request
I am trying to get the post request and i have tried everything it is still getting me get requests. Please Help. I have tried using that i saw in other problems displayed here. but it is not working for me. {% csrf_token%} Item name {{form.item_name}} Quantity {{form.quantity}} <div class="form-group"> <label for="address">Address</label> {{form.address}} </div> <div class="modal-footer d-flex justify-content-center"> <button type="submit" id="submit" class="btn btn-success" data-dismiss="modal" >Donate</button> </div> </form> This is my view file #this is my view @login_required(login_url='loginPage') def home(request): form = DonateForm() print(request.user.id) get_user = user_info.objects.get(id=request.user.id) print('Inside Home View') print(get_user) print(request) if request.method == 'POST': form = DonateForm(request.POST) print('Inside Home Page') if form.is_valid(): print('Form is valid!!') user = form.save() Donate.objects.create(user_name = user,item_name=form.cleaned_data['item'],quantity=form.cleaned_data['itemquantity']) else: messages.add_message(request,messages.INFO,'Your details are Incorrect!!') else: print('No Post Request!!') return render(request,'donate/home.html',{'form':form,'get_user':get_user}) Here is my Models.py class Donate(models.Model): user_name = models.ForeignKey(user_info,on_delete=models.CASCADE) item_name = models.CharField(max_length=30,null=False , blank=False, default ="None") quantity = models.IntegerField(null=False,blank=False,default=0) address = models.CharField(max_length=100 , null=False , blank= False, default="None") def __str__(self): return f"{self.user_name.user.username} donated {self.item_name}" -
Django - call Manager with multiple inherited classes
So I have this class that helps me override the update method of a queryset: class QuerySetUpdateOverriden(QuerySet, object): def update(self, *args, **kwargs): super().update(*args, **kwargs) if hasattr(self, 'method_from_object'): self.method_from_object() return and here's my class where I use it: class MyObject: objects = QuerySetUpdateOverriden.as_manager() def method_from_object(self): print("called") the print statement is never reached. And I get why - the objects field doesn't inherit MyObject too. So, the question is - how can I make it inherit MyObject so method_from_object will be called? Thanks. -
How to get the file object in `request.data` in Django?
(1) Upload a tar file. (2) How to get the file object in request.data? Thanks. class AlbumViewSet(viewsets.ModelViewSet): @action(methods=['POST'], detail=False, url_path='upload-album') def upload_album(self, request): # Upload one tar file. logging.error("----> request.data = {}".format(request.data)) -
Ifc.js: wasm streaming compile failed: LinkError: import object field 'a' is not a Memory
I am reading IFC files and ifc.js seemed like a solid option although I am not so experienced with javascript but I thought it could be a good opportunity to learn about it. I followed the documentation example that can be food here ``https://ifcjs.github.io/info/docs/Hello%20world```. I packed the app inside of a django project and everything is fine until I try to load up a file. I am getting the following error: RuntimeError: abort(LinkError: import object field 'a' is not a Memory). Build with -s ASSERTIONS=1 for more info. On my browser debugger, the error links to the following class of my bundle.js file class IFCLoader extends Loader { constructor(manager) { super(manager); this.ifcManager = new IFCManager(); } load(url, onLoad, onProgress, onError) { const scope = this; const loader = new FileLoader(scope.manager); this.onProgress = onProgress; loader.setPath(scope.path); loader.setResponseType('arraybuffer'); loader.setRequestHeader(scope.requestHeader); loader.setWithCredentials(scope.withCredentials); loader.load(url, async function (buffer) { try { if (typeof buffer == 'string') { throw new Error('IFC files must be given as a buffer!'); } onLoad(await scope.parse(buffer)); } catch (e) { if (onError) { onError(e); } else { console.error(e); } I have no clue how to correct this issue and any help would be highly appreciated. I am happy to post additional files or … -
How in Django to override the "read" method only in/for the admin?
I know that they don't do this, but for one of my pet-projects I want a strange thing: store jinja-templates in the database (and be able to edit them through the admin panel). There is something like this model (in models.py): class TbTemplate(models.Model): szFileName = models.CharField( primary_key=True, db_index=True, unique=True, verbose_name="Path/Name" ) szJinjaCode = models.TextField( verbose_name='Template', help_text='Template Code (jinja2)' ) szDescription = models.CharField( max_length=100, verbose_name='Description' ) def __unicode__(self): return f"{self.szFileName} ({self.szDescription})" def __str__(self): return self.__unicode__() class Meta: verbose_name = '[…Template]' verbose_name_plural = '[…Templates]' Next, in view.py you can do something like this: # -*- coding: utf-8 -*- from django.http import HttpRequest, HttpResponse from django.template.loader import render_to_string from web.models import TbTemplate def something(request: HttpRequest, template: str) -> HttpResponse: """ :param request: http-in :param template: Template name :return response: http-out """ to_template = {} # ... # ... do smth # ... tmpl = TbTemplate.objects.get(pk=template) html = render_to_string(tmpl.szJinjaCode, to_template) return HttpResponse(html) And everything works. Templates to available for editing through the admin panel (of course, you need to hang a "mirror"-like widget for syntax highlighting, etc.)... But I want to use in jinja templates like: {% include "something_template.jinja2" %} ... And for this it is necessary that the templates are not only in … -
How to read the content of the header of a web page using Django and requests?
I have created a search engine for web pages in Django and would like to perform queries on these pages so that I can find out the value of their various X-Frame-Options headers. So I wrote the following code: def search(request): . . . final_result = [] for page_num in range(1, max_pages_to_scrap+1): url = "https://www.ask.com/web?q=" + search + "&qo=pagination&page=" + str(page_num) res = requests.get(url) soup = bs(res.text, 'lxml') result_listings = soup.find_all('div', {'class': 'PartialSearchResults-item'}) for result in result_listings: result_title = result.find(class_='PartialSearchResults-item-title').text result_url = result.find('a').get('href') result_desc = result.find(class_='PartialSearchResults-item-abstract').text final_result.append((result_title, result_url, result_desc)) for header in final_result[1]: #the error is generated here response = requests.get(header) if response['X-Frame-Options'] in ["DENY", "SAMEORIGIN"]: head = True notAccept = bool(head) else: notAccept = bool(False) But when I test, I get in the terminal the following errors: Internal Server Error: /search Traceback (most recent call last): File "C:\Python310\lib\site-packages\django\core\handlers\exception.py", line 55, in inner response = get_response(request) File "C:\Python310\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "C:\Users\user\Documents\AAprojects\Whelpsgroups1\searchEngine\search\views.py", line 29, in search for header in final_result[1]: IndexError: list index out of range [17/Sep/2022 23:28:40] "GET /search?csrfmiddlewaretoken=t57w6QZSzkgsKoNJWXrjotBRdKSNxBBxzfzPnUC6N7kXfs5pMyGWcjQUYcrT13Ds&search=moto HTTP/1.1" 500 88593 I don't understand why I also hope to rely on the support of the community. Thanks! -
"IntegrityError at authhentication/signup" even after a successful signup
models.py here, I created a model required by each user to signup from django.db import models # Create your models here. class Details(models.Model): username = models.CharField(max_length=100) fname = models.CharField(max_length=100) lname = models.CharField(max_length=100) email = models.EmailField() password = models.IntegerField() confirm_password = models.IntegerField() def __str__(self): return f"{self.fname} {self.lname}" views.py here, I defined my views for sign up and sign in from django.shortcuts import render,redirect from .models import Details from django.contrib import messages from django.contrib.auth import authenticate,login # Create your views here. signup view def signup(request): if request.method == "POST": username = request.POST.get("username") fname = request.POST.get("fname") lname = request.POST.get("lname") email = request.POST.get("email") password = request.POST.get("password") password2 = request.POST.get("password2") user = Details.objects.create(username=username,fname=fname,lname=lname,email=email,password=password,confirm_password=password2) messages.success(request,"Your account has been successfully created!") return render(request,'authentication/signin.html',) return render(request,'authentication/signup.html') signin view def signin(request): if request.method == "POST": username = request.POST.get("username") password = request.POST.get("password") user = authenticate(username=username,password=password) if user is not None: login(request, user) messages.success(request, "You have successfully logged in") name = Details.fname return render(request,'home.html',{'name':name}) else: messages.error(request,"Bad credentials!") return redirect('authentication:signin') return render(request,'authentication/signin.html') def signout(request): pass signin.html here, I have my created my signin form <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1>Sign in here</h1> {% for message in messages %} <div class="alert alert-{{message.tags}} alert-dismissible … -
How to preserve newlines when importing json via loaddata
I have an object that uses \r\n line breaks in a CharField. When I export using dumpdata it provides valid json: { "mykey": "example\r\nsentence\r\nhere" } However when I import again using loaddata the CharField is stripped of newlines. How do I preserve them? -
Static files only served when debug = True and does not when it is False in production for nginx ubuntu 22.04
I have followed the setup procedures here https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-22-04 and my Django app is running but whenever I turn debug = False it will not load my static files. Below is my nginx configuration: server { listen 80; server_name server_domain_or_IP; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/sammy/myprojectdir; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } and my settings.py: STATIC_URL = 'static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [os.path.join(BASE_DIR, 'my_site/static')] I have tried my best, researched a lot online, and followed many links but still fruitless. -
Complex queryset annotation
I am struggling with a pretty complex annotation of a QuerySet and I would really appreciate some help. Here are my models:- class Player(models.Model): group = models.ForeignKey(Group) class Transaction(models.Model): created = models.DateTimeField() amount = models.DecimalField(decimal_places=2, max_digits=10) player = models.ForeignKey(Player) Given a particular Group, I can get all the transactions for that Group using:- Transaction.objects.filter(player__group=group) But what I need is for each of those transactions to be annotated with the overall balance of the group at the time the transaction was created. So for each transaction, I need to sum all the transactions of the group whose created time was earlier than the transaction's created date. To do this, without ending up with tons of database calls, (I think) requires a complex queryset using things like Subquery and OuterRef but I can't quite figure out the exact logic. I tried something like this:- balance = queryset.annotate( balance=Sum( Case( When( date__lte=F("date"), then=F("amount"), ), default=0, output_field=DecimalField(), ) ) ).filter(pk=OuterRef("pk")) queryset.annotate( group_balance=Subquery(balance.values("balance"), output_field=DecimalField()) ) but I know that's not quite right. I feel like I'm close but it's driving me mad. -
{% providers_media_js %} causes: Error during template rendering, Site matching query does not exist
I'm trying to add facebook auth through django-allauth and everything is working fine when I run on localhost (except that I can't actually login because I have no SSL cert on localhost) when I push to Heroku, everything is fine except for my login page, where I get this error Error during template rendering In template /app/templates/main.html, error at line 2 Site matching query does not exist. my main.html: {% load socialaccount %} {% providers_media_js %} // error here <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <h1>Hello</h1> <a href="{% provider_login_url 'facebook' method='js_sdk' %}">Login with Facebook</a> </body> </html> my settings.py info: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'base.apps.BaseConfig', 'rest_framework', 'rest_framework.authtoken', 'corsheaders', 'dj_rest_auth', 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'dj_rest_auth.registration', 'allauth.socialaccount.providers.facebook', 'django_extensions', ] SITE_ID = 1 MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', "whitenoise.middleware.WhiteNoiseMiddleware", "corsheaders.middleware.CorsMiddleware", 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] AUTHENTICATION_BACKENDS = ( 'allauth.account.auth_backends.AuthenticationBackend', 'django.contrib.auth.backends.ModelBackend', ) SOCIALACCOUNT_PROVIDERS = \ {'facebook': {'METHOD': 'oauth2', 'SCOPE': ['email','public_profile', 'user_friends'], 'AUTH_PARAMS': {'auth_type': 'reauthenticate'}, 'FIELDS': [ 'id', 'email', 'name', 'first_name', 'last_name', 'verified', 'locale', 'timezone', 'link', 'gender', 'updated_time'], 'EXCHANGE_TOKEN': True, 'LOCALE_FUNC': lambda request: 'kr_KR', 'VERIFIED_EMAIL': False, 'VERSION': 'v2.4'}} #facebook SOCIAL_AUTH_FACEBOOK_KEY = '' # App ID here SOCIAL_AUTH_FACEBOOK_SECRET ='' #app …