Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
ModuleNotFoundError : tkinter in heroku
I have an application which is using tkinter package for file opening dialog functionality and the application is built on python Django. The application is running absolutely fine in local. But, after deploying in Heroku, I am getting the below error. ModuleNotFoundError at / No module named '_tkinter' Request Method: GET Request URL: http://compare-files.herokuapp.com/ Django Version: 1.11.20 Exception Type: ModuleNotFoundError Exception Value: No module named '_tkinter' Exception Location: /app/.heroku/python/lib/python3.7/tkinter/init.py in , line 36 Python Executable: /app/.heroku/python/bin/python Python Version: 3.7.3 Python Path: ['/app', '/app/.heroku/python/bin', '/app', '/app/.heroku/python/lib/python37.zip', '/app/.heroku/python/lib/python3.7', '/app/.heroku/python/lib/python3.7/lib-dynload', '/app/.heroku/python/lib/python3.7/site-packages'] Server time: Sun, 26 May 2019 14:20:26 +0000 from tkinter import Tk from tkinter.filedialog import askopenfilename Tk().withdraw() file1 = askopenfilename() print(file1) -
Elastic beanstalk is not responding with installed SSL
I have a Django app in AWS elastic beanstalk. Currently, I am trying to setup SSL in the environment. After setting up a below configuration both http and https are failing. I am following the below tutorial https://github.com/lucasdf/demo-lets-encrypt-elastic-beanstalk/blob/master/ssl.config SSL.conf : LoadModule wsgi_module modules/mod_wsgi.so WSGIPythonHome /opt/python/run/baselinenv WSGISocketPrefix run/wsgi WSGIRestrictEmbedded On Listen 443 <VirtualHost *:443> SSLEngine on SSLCertificateFile "/etc/letsencrypt/live/xxx/fullchain.pem" SSLCertificateKeyFile "/etc/letsencrypt/live/xxx/privkey.pem" Alias /static/ /opt/python/current/app/static/ <Directory /opt/python/current/app/static> Order allow,deny Allow from all </Directory> WSGIScriptAlias / /opt/python/current/app/xxx/wsgi/__init__.py <Directory /opt/python/current/app> Require all granted </Directory> WSGIDaemonProcess wsgi-ssl processes=1 threads=15 display-name=%{GROUP} \ python-path=/opt/python/current/app:/opt/python/run/venv/lib/python3.6/site-packages:/opt/python/run/venv/lib64/python3.6/site-packages \ home=/opt/python/current/app \ user=wsgi \ group=wsgi WSGIProcessGroup wsgi-ssl </VirtualHost> <VirtualHost *:80> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </VirtualHost> ``` -
Update input "value" attribute with data returned from ajax request...passing in [object, Object]. - Django/Python
I have a ajax script which takes a field from my django form and retrieves a price field - Working Fine I have a paypal form which I need to update the "amount" value with this retrieved value price. But when I pass it in it is returning as an object. Would really appreciate any help or better way to accomplish this. HTML: <h1>Pay using PayPal</h1><form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="amount" value="0" id="id_amount"> </form> <script> $("#id_membership_title").change(function () { var url = $("#regForm").attr("data-member-url"); var membership_title = $(this).val(); $.ajax({ url: url, data: { 'membership_title': membership_title }, success: function (data) { $("#id_amount").html(data); $("#id_price").html(data); } }); price = document.getElementById("id_amount"); price.setAttribute("value", $("id_amount")); }); View To Retrieve Price: def ajax_load_price(request): membership = request.GET.get('membership_title') mem_id = ClubMemberships.objects.filter(pk=membership) return render(request, 'load_price_value.html', {'mem_id': mem_id}) HTML to render price: {% for id in mem_id %} {{ id.price }} {% endfor %} -
How to render my view with additional option
I can't make my html render my form with additional option. So i need to make that in my html my order_form will be rendered with additional_option that in product. And then place it all in OrderItem. I don't understand what i should do I ve tryied to make queryset queryset=product.objects.get(pk = 6).add_option.all() with specific id but in only shows text 'QuerySet' My form class Order_form(forms.Form): add_option = forms.ModelMultipleChoiceField(widget = forms.CheckboxSelectMultiple, required = False) model 1 class OrderItem(models.Model): product = models.OneToOneField(product, on_delete=models.SET_NULL, null=True) additional_option = models.ManyToManyField(AdditionalOption) model 2 class product(models.Model): add_option = models.ManyToManyField(AdditionalOption, blank = True) -
Youtube song with link play on background
Hello guys my problem is this user will give me the link it will be youtube link and it will be a song. İn my project ı wanna play it on background users wont see the video only the sound. When ım going to that .html file it must play the song. -
Django/ How get sum of order - 'int' object is not iterable
I'm trying to withdraw the order amount using the method from the model, but I can't. Have error - 'int' object is not iterable models.py class OrderItem(models.Model): order = models.ForeignKey(Order, on_delete=models.PROTECT) product = models.ForeignKey(Product, on_delete=models.PROTECT) price = models.IntegerField() quantity = models.PositiveIntegerField(default=1) def get_total_price(self): return sum(self.get_price()) def get_price(self): return self.price * self.quantity def __str__(self): return str(self.order) get_price method it's work, but in get_total_price have error, what I'am doing wrong? order_success.html {% for item in order_item %} <tr> <td>{{item.quantity}}</td> <td>{{item.price}}</td> <td>{{item.get_price}}</td> <td>{{item.get_total_price}}</td> # doesn't work </tr> {% endfor %} can you help me write right the sum method, please. I think my method is wrong. -
Django revoke session key if logged in from another device/browser
i want to revoke the old session as soon as the user logs-in from another device but if i use session flush here i get logged out from all browsers. has smb a solution for this: middleware.py from django.contrib.sessions.models import Session # Session model stores the session data from .models import LoggedInUser class OneSessionPerUserMiddleware: # Called only once when the web server starts def __init__(self, get_response): self.get_response = get_response def __call__(self, request): if request.user.is_authenticated: session_key = request.session.session_key try: logged_in_user = request.user.logged_in_user stored_session_key = logged_in_user.session_key if stored_session_key != session_key: Session.objects.filter(session_key=stored_session_key).delete() logged_in_user.session_key = session_key logged_in_user.save() except LoggedInUser.DoesNotExist: LoggedInUser.objects.create(user=request.user, session_key=session_key) response = self.get_response(request) return response -
How to identify and save anonymous user choices in django?
I have a quiz app for students. Right now students have to first resister on the platform then they choose course and relevant quizzes appear before them. But what I want is : Students don't have to register first. They can choose course and then take one quiz then I will prompt them for a registration. What I want; when they register I can save data such as their course to a anonymous user (which they chose before registration) and link that to the account that will be created after they register. So how I can I know what course did they choose before registration and how to link it to the user after they register? Preferably through django rest framework as we an android app. -
How To Add MultipleChoiceField To Django Admin?
I have a CharField field in my model. I want to display it as a MultipleChoiceField widget in the Django admin site. models.py: class Product(models.Model): ... categories = models.CharField() ... I've created a custom form widget in forms.py: from django import forms CATEGORIES_LIST = [ ('for_him', 'For Him'), ('for_her', 'For Her'), ('for_kids', 'For Kids'), ] class Categories(forms.Form): categories = forms.MultipleChoiceField( required=False, widget=forms.CheckboxSelectMultiple, choices=CATEGORIES_LIST, ) Not quite sure what to do next. How do I connect this widget with Django Admin for my Product model? Thanks in advance for your help! -
why django username parameters passed to urls is connecting directly and how prevent it
i'm trying to access to a user profil if urls parameters is profile/username it work but i have a security problem because user is directly connected. How i can define in django user profil access depending if user is authenticated or not profil.html {% if user.is_authenticated %} <p>{{ user.username}}</p> <a href="">edit your profile</a> {% else %} <p>{{ user.username}}</p> <p>basic profile of user</p> {% endif%} views.py def profil(request,username): user=get_object_or_404(User, username=username) context = { 'user':user } return render(request, 'service/profil.html',context) -
How to append prefix to all url names when using include function - django
I want to include some django app's urls, in two different parent routes. The problem is, if I try to do this, then I will not be able to use reverse function properly for that app's urls. This is where I'm stuck. The following url configurations will result in creation of two different url sets, e.g: /api/v4/auth/{login, register, ...} /api/auth/{login, register, ...} app A (urls.py) from auth import views urlpatterns = [ url(r'^login/', views.login, name='login'), url(r'^register/', views.register, name='register'), ... ] main app (urls.py) from auth import urls as auth_urls urlpatterns = [ url(r'^api/v4/auth/', include(auth_urls)), url(r'^api/auth/', include(auth_urls)), ... ] Now, if I try to use reverse function like below: def get_login_url(): return reverse('login') I would probably get one of the possible outputs which I don't know how to control! I don't know if django supports appending some kind of prefix to names of the urls that are being included or is there any tricks to hack around it or not! -
Django method return only last price, but need all
I have a method in which the formula for calculating the amount, depending on the quantity of goods, is carried out, but I only have the last amount returned, what am I doing wrong? I use for in my template models.py class OrderItem(models.Model): order = models.ForeignKey(Order, on_delete=models.PROTECT) product = models.ForeignKey(Product, on_delete=models.PROTECT) price = models.IntegerField() quantity = models.PositiveIntegerField(default=1) def get_price(self): return self.price * self.quantity def __str__(self): return str(self.order) order_success.html {% for item in order_item %} <tr> <td><img src="{{item.product.image.url}}" alt="Image - {{item.product.image}}"></td> <td><a href="{% url 'shop:product_show' item.product.slug %}" target="_blank">{{item.product}}</a></td> <td>{{item.product.vendor_code}}</td> <td>{{item.quantity}}</td> <td>{{item.price}}</td> <td>{{item.get_price}}</td> # call method </tr> {% endfor %} Example in django shell order_item = OrderItem.objects.select_related().filter(order=pk) for item in order_item: print(item.price, item.quantity) # price - 1200, 1800, quantity - 3, 2 In template return only 3600. But need 2400 and 3600. Help me please :) -
Why is not showing ValidationError?
I just started learning Django and have a problem with ValidationError which is not displaying in my browser. Views.py > from django.shortcuts import render from .forms import ProductForm, RawProductForm from .models import Product > > def product_create_view(request): > form = ProductForm(request.POST or None) > if form.is_valid(): > form.save() > form = ProductForm() > context = { > 'form': form > } > return render(request, "products/product_create.html", context) forms.py def class_title(self, *args, **kwargs): title = self.cleaned_data.get('title') if "abc" in title: return title else: raise forms.ValidationError("This is not a valid title") template.html {% extends 'base.html' %} {% block content %} <form action="." method="POST">{% csrf_token %} {{ form.as_p }} <input type="submit" value="Save" /> </form> {% endblock %} -
Django filtering the Q problem when is empty
I have a problem filtering the data and showing the result in a table... In my template I have some inputs that I send input values with ajax and then i get the value using request.POST.get() in my views. The problem appears when some fields are empty I receive an error "Cannot use None as a query value" I want to do something like this but i cannot find a solution ex. when the request.POST.get is empty that Q to be ignored Can anyone help me? Thanks and sorry for my english This is my code in my views.py def api_pacienti(request): de_la = request.POST.get('de_la', default=1920) pana_la = request.POST.get('pana_la', default=datetime.datetime.now().year) localitate = request.POST.get('localitate') judet = request.POST.get('judet') stare_civila = request.POST.get('stare_civila') categorie = request.POST.get('categorie') decedat = request.POST.get('decedat') iesit = request.POST.get('iesit') raport_pacient = Pacient.objects.filter( Q(data_creare_pacient__year__gte=de_la) & Q(data_creare_pacient__year__lte=pana_la) & Q(data_iesire__isnull=iesit) & Q(data_deces__isnull=iesit) & Q(adresa_pacient__judet__nume_judet=judet) & Q(adresa_pacient__localitate__nume_localitate=localitate) & Q(categorie=categorie) & Q(stare_civila=stare_civila) & Q(medic=request.user.medic) ) serializer = PacientSerializer(raport_pacient, many=True) return JsonResponse(serializer.data, safe=False) -
Django allow only one user session in total
I currently try to implement a policy to my application that only one user session at a time is allowed, if a user trys to log-in from another device the old sessions gets killed. But for some resone i get the following error and i can't find the mistake myself :( : RelatedObjectDoesNotExist at / User has no logged_in_user. My project contains two apps, the actually app and a "accounts" app that contains all informations shown here. signals.py # Signals that fires when a user logs in and logs out from django.contrib.auth import user_logged_in, user_logged_out from django.dispatch import receiver from .models import LoggedInUser @receiver(user_logged_in) def on_user_logged_in(sender, request, **kwargs): LoggedInUser.objects.get_or_create(user=kwargs.get('user')) @receiver(user_logged_out) def on_user_logged_out(sender, **kwargs): LoggedInUser.objects.filter(user=kwargs.get('user')).delete() models.py # Model to store the list of logged in users class LoggedInUser(models.Model): user = models.OneToOneField(User, related_name='logged_in_user', on_delete=models.CASCADE) session_key = models.CharField(max_length=32, null=True, blank=True) def __str__(self): return self.user my User Model is at the same at the same location as this sippet middleware.py #Session model stores the session data from django.contrib.sessions.models import Session class OneSessionPerUserMiddleware: # Called only once when the web server starts def __init__(self, get_response): self.get_response = get_response def __call__(self, request): # Code to be executed for each request before # the view (and later … -
Django use otp(One Time Password) instead of db password
I am using django-rest-framework to create login for a web app(frontend is in React), but I need to use only otp for login, no password. The otp is send to users phone number. I am using a custom user model. I just cannot figure out how to override the built in login view. I am also trying to use jwt token auth using djangorestframework-simplejwt. Please help me write this. I am trying something like this in views.py import json import urllib.request import urllib.parse from random import randrange from django.contrib.auth.views import LoginView from rest_framework.response import Response from rest_framework_simplejwt.authentication import JWTAuthentication from backend.settings import TL_API_KEY, TL_SENDER, TL_MSG_FORMAT class class OTP_JWTAuthentication(JWTAuthentication): """ Custom otp and jwt auth. """ def genrate_otp(self): return randrange(10000, 99999, 1) def send_otp(self, phone, otp): data = urllib.parse.urlencode({'apikey': TL_API_KEY, 'numbers': phone, 'message': TL_MSG_FORMAT+otp, 'sender': TL_SENDER}) data = data.encode('utf-8') request = urllib.request.Request("https://api.textlocal.in/send/?") f = urllib.request.urlopen(request, data) fr = f.read() j = json.loads(fr) return Response(j) def authenticate(self, request): header = self.get_header(request) if header is None: return None raw_token = self.get_raw_token(header) if raw_token is None: return None validated_token = self.get_validated_token(raw_token) user = self.get_user(validated_token) otp = self.genrate_otp() try: send_otp_resp = self.send_otp(user.phone, otp) except Exception as e: print(e) return self.get_user(validated_token), None models.py from django.db import … -
Django why the pagination is not working?
Sorry because of the dumb question. I am reading a tutorial from book called build django 2 web application. and I get to the pagination topic but I can't get why it does not working even when I am copy-pasting carefully. {% if is_paginated %} <nav> <ul class="pagination"> <li class="page-item"> <a href="{% url 'core:MovieList'%}?page=1" class="page- link">First</a> </li> {% if page_obj.has_previous %} <li class="page-item"> <a href="{% url 'core:MovieList' %}?page={{page_obj.previous_page_number}}" class="page-link">{{page_obj.previous_page_number}}</a> </li> {% endif %} <li class="page-item active"> <a href="{% url 'core:MovieList' %}?page={{page_obj.number}}" class="page-link">{{page_obj.number}}</a> </li> {% if page_obj.has_next %} <li class="page-item"> <a href="{% url 'core:MovieList' %}?page={{page_obj.next_page_number}}" class="page-link">{{page_obj.next_page_number}}</a> </li> {% endif %} <li class="page-item"> <a href="{% url 'core:MovieList' %}?page={{paginator.num_pages}}" class="page-link">Last</a> </li> </ul> </nav> {% endif %} -
Dockerizing Django application: ModuleNotFoundError: No module named 'X"
I've been trying to follow this guide to Dockerize a project: Deploy and Run Django in Dokcer Container This is the base file structure: WFMBCM |-WFMBCM | |-__init__.py | |-__pycache__ | |-setting.py | |-url.py | |-wsgi.py | |-WFMBCM_App |-WFMBCM_db |-manage.py |-Dockerfile |-requirements.txt |-runWFMBCM.sh Dockerfile: FROM python:3.7 ADD WFMBCM /usr/src/app ADD WFMBCM_App /usr/src/app ADD WFMBCM_db /usr/src/app ADD manage.py /usr/src/app WORKDIR /usr/src/app COPY requirements.txt ./ RUN pip install --no-cache-dir -r requirements.txt EXPOSE 8000 CMD exec gunicorn wfmbcm.wsgi:application --bind 0.0.0.0:8000 --workers 3 requirements.txt: Django==2.2.1 gunicorn==19.9.0 runWFMBCM.sh: cd /home/admin/WFMBCM echo -e "\033[0;34mGo to WFMBCM directory.\n \033[0;37m" echo -e "\033[0;34mRemove old WFMBCM container\n \033[0;37m" docker rm -v wfmbcm_container echo -e "\033[0;34m\nBuild WFMBCM Docker image.\n \033[0;37m" sudo docker build -t wfmbcm . echo -e "\033[0;34m\nRun WFMBCM Docker image.\n \033[0;37m" sudo docker run --name wfmbcm_container -p 8000:8000 -i -t wfmbcm echo -e "\033[0;34m\n\nWFMBCM run-script ended!.\n \033[0;37m" When I run runWFMBCM.sh I get the following output: Go to WFMBCM directory. Remove old WFMBCM container Error response from daemon: No such container: wfmbcm_container Build WFMBCM Docker image. Sending build context to Docker daemon 265.2kB Step 1/10 : FROM python:3.7 ---> cc971a68c3e4 Step 2/10 : ADD WFMBCM /usr/src/app ---> Using cache ---> 302346d017e2 Step 3/10 : ADD WFMBCM_App /usr/src/app ---> … -
How to save external API's data in a django model?
I am pulling in some JSON data from a external API. { "id": 1, "body": "example json" }, { "id": 2, "body": "example json" } my User model: class User(models.Model): body = models.CharField(max_length=200) how i can save the json response into my model ? -
Django group by and then serialize
Given a simplified model Student with two fields: name and grade. Currently I have a Viewset that uses a simple serializer and return all students. It is possible that the same student has more than 1 grade and I would like to group all the grades of the same student, sort them and then use the serializer. My desired output is not a list of Students but a list of lists where each inner list is a single student and his sorted grades. I read about annotated but didn't manage to make it work... (I am using django 1.8) -
Django don't show first image in template
i'm new to Django and i need to show all images inside different folders in the html file. In views.py I have something like this: template = loader.get_template('index.html') context = { 'images': imm, } return HttpResponse(template.render(context, request)) imm is a variable that contains path of some images. In the template I have: <div class="row"> {{ images }} {% for image in images %} <div class="column"> <img src="{{ image }}" style="width:100%" > {{ image }} </div> {% endfor %} </div> In here the first image is not showed while the others are ok. It is not a problem of the image itself because i tried to change the order of the images in images list. {{ image }} returns the right path of the image but when i see the code through the browser the first image has path "". {{ images }} is ['/path/000000000115.jpg', '/path/000000000139.jpg', '/path/000000000140.jpg', '/path/000000000632.jpg', '/path/000000000724.jpg', '/path/000000000776.jpg', '/path/000000000785.jpg']. I'm not understanding what is wrong. Thanks in advance. -
how to implement ajax in django
here the add category form is inside the another add customer form.When i click the add new category button it pops up a form to add the category title and after adding title and submitting the form i want to place this category inside the category field of the add_customer form without page refreshing.I tried like this to do that but it is not working .it is asking me to enter all the field of add_customer form.How can i solve this ? views.py def ajax_add_category(request): # if request.method == 'POST': # category_form = AddCategoryForm(request.POST or None) # if category_form.is_valid(): # category = category_form.save(commit=False) # category.save() # return redirect('pos:add_product') # else: # category_form = AddCategoryForm() # return render(request,'pos/add_product.html',{'form':category_form}) if request.method == 'POST': title = request.POST['title'] Category.objects.create(title=title) return redirect('pos:add_product') urls.py path('add-category/', views.ajax_add_category, name='add-category'), template <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#item-category-modal">Add New Category</button> <div class="modal" id="item-category-modal"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Add new category</h4> <button type="button" class="close" data-dismiss="modal">&times;</button> </div> <div class="modal-body"> <form method="POST" data-url="{% url 'pos:add-category' %}" id="category-ajax-form"> {% csrf_token %} <p><label for="id_title">Title:</label> <input type="text" name="title" class="form-control required" placeholder="Category Title" maxlength="200" required id="id_title"></p> <button class="btn btn-primary mt-30">Add Category</button> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> </div> script <script type='text/javascript'> … -
Rendering data from django in vis.js (javascript)
I am trying to display some data in django-template with javascript library vis.js. Here is my views.py function where I get the data and create Json for vis.js: @login_required def get_nodes(request): nodes = [] pk = request.session["pk"] query = Device.objects.filter(report__pk=pk) for id, device in zip(range(len(query)), query): id += 1 if id == 1: nodes.append({"id": id, "shape": "image", "image": "{% static 'logos/Router.png' %}", "label": "Default gateway"}) else: nodes.append({"id": id, "shape": "image", "image": "{% static 'logos/VM.png' %}", "label": f"VM{id}"}) return JsonResponse({"nodes": nodes}) This is the output of the function: {'nodes': [ {'id': 1, 'shape': 'image', 'image': "{% static 'logos/Router.png' %}", 'label': 'Default gateway'}, {'id': 2, 'shape': 'image', 'image': "{% static 'logos/VM.png' %}", 'label': 'VM2'}, {'id': 3, 'shape': 'image', 'image': "{% static 'logos/VM.png' %}", 'label': 'VM3'}, {'id': 4, 'shape': 'image', 'image': "{% static 'logos/VM.png' %}", 'label': 'VM4'} ]} This is my jquery request where I call get_nodes function to get and render data: $.get("{% url 'get-nodes' %}", function (result) { var nodes = new vis.DataSet(result.nodes); var options = {}; console.log(result.nodes); options.manipulation = { addNode: addNode, editNode: editNode, deleteNode: deleteNode, addEdge: addEdge, editEdge: editEdge, deleteEdge: deleteEdge }; var data = { nodes: nodes, }; var container = document.getElementById('mynetwork'); var network = new vis.Network(container, data, … -
Trying to display any number that is entered into a url, using Django 1.1
I'm currently learning regex patterns, using DJango 1.1. More specifically, I am trying to display whatever number is entered into the url using the '\d+' pattern. I'm brand new to DJango, so I hope that description wasn't too vague. Any help would be greatly appreciated. My urls.py url pattern is: url(r'^(?P<number>\d+)$', views.show) My views.py method is: def show(request, number): return HttpResponse("placeholder to display blog number: {number}") I don't quite understand what i'm missing. If I enter the number 20 into my url: localhost:0000/20, I'm expecting to see an output of: placeholder to display number: 20 But instead, I get an output of: placeholder to display number: {number} -
Django project getting confused between mysl and sqlite
I am not really sure how to phrase this question properly as all my searches so far have bared no fruit. Basically, I have a django project that was running fine on my local PC. I have since spent around a week trying to deploy it using a DigitalOcean droplet (Ubuntu 18.04 Server). I have created a MySQL instance on this server and have connected SQL Workbench to it and that works fine. I have also created a virtual environment on the server and have created a new project on there with the aim of migrating my existing project files to it once its running properly. The problem now is that I am able to create models on this project, makemigrations and migrate everything (I know all of this is working because I can see the tables and data populating on Workbench). I then created a superuser, however whenever I try to log into /admin/ I get the following error: no such table: auth_user Request Method: POST Request URL: http://128.xxx.xx.xx/admin/login/?next=/admin/ Django Version: 2.2.1 Exception Type: OperationalError Exception Value: no such table: auth_user Exception Location: /opt/django_app/venv/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py in execute, line 383 Python Executable: /opt/django_app/venv/bin/python3 Python Version: 3.6.7 Python Path: ['/opt/django_app/leneisang', '/opt/django_app/venv/bin', '/usr/lib/python36.zip', …