Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Use function both as view and as a celery task
I use Django 2.2.12 and Celery 4.4.7 I have some functions (e.g.: downloadpictures) that need to be both used as a view and as a scheduled recurring task. What is the best way to set it up ? Below code generates the following error message : NameError: name 'downloadpictures' is not defined downloadapp/views.py def downloadpictures(request=None): xxx xxx downloadapp/tasks.py from downloadapp import downloadpictures @shared_task def downloadpicturesregular(): downloadpictures() celery_tasks.py app.conf.beat_schedule = { 'downloadpictures_regular': { 'task': 'downloadapp.tasks.downloadpicturesregular', 'schedule': crontab(hour=18, minute=40, day_of_week='thu,sun'), }, }, -
How to format current time in django views?
I'm unable to figure out that how to format present time in django views. I just want to show year-month-date .Can you guys tell me how to do this ? Right now i'm trying in a following way. from django.utils import timezone print('date :',timezone.now()) and it returns : date : 2020-12-31 18:34:29.309006+00:00 Desire output is : date : 2020-12-31 -
insert not working ,it redirect to view without saving the data
def insert_(request): if request.method=='GET': form=ClientServicesForm() return render(request,"ClientServices/insert.html",{'form':form}) else: form=ClientServicesForm(request.POST) if form.is_valid(): form.save() return redirect('/clientservices/') I am trying to save data from a form but it is not saving to database ,it is rendering insert.html peroperly ,while saving it does not save database but without saving redirect to view -
BootstrapError: Parameter "form" should contain a valid Django Form
I keep getting the above error (in the title) for my DeleteView. Strangely my UpdateView, UpdateObject form and update_object template are identical to my DeleteView, DeleteObject form and delete_object template respectively. I'm not sure why bootstrap is giving me an error for this form and not my update form? Here are the files: forms.py: from django import forms from . import models from django.forms import ModelForm class CreateBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) def __init__(self,*args,**kwargs): super().__init__(*args,**kwargs) class UpdateBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) class DeleteBouquetForm(ModelForm): class Meta: model = models.Bouquet exclude = ('price',) ` views.py: class UpdateBouquet(UpdateView): model = models.Bouquet form_class = forms.UpdateBouquetForm template_name = 'products/update_bouquet.html' success_url = reverse_lazy('products:shop') def form_valid(self,form): self.object = form.save(commit=False) result = 0 for flower in self.object.flower.all(): result += flower.price self.object.price = result self.object.save() return super().form_valid(form) class DeleteBouquet(DeleteView): model = models.Bouquet form_class = forms.DeleteBouquetForm template_name = 'products/delete_bouquet.html' success_url = reverse_lazy('products:shop') products/update_bouquet.html: {% extends 'site_base.html' %} {% load bootstrap3 %} {% block content_block %} <form method="post"> {% csrf_token %} {% bootstrap_form form %} <input type="submit" class="btn btn-outline-success" value="Save bouquet and continue shopping"> </form> <h6><a href="{% url 'products:detail_bouquet' pk=bouquet.pk %}">Back to bouquet</a></h6> {% endblock %} products/delete_bouquet.html: {% extends 'site_base.html' %} {% load … -
django.template.exceptions.TemplateSyntaxError: Could not parse some characters: |{{b.count}}||rangef
I'm trying to loop in a Django template by using a custom filter, but for some reason I receive this error: django.template.exceptions.TemplateSyntaxError: Could not parse some characters: |{{b.count}}||rangef myfilters.py @register.filter(name='rangef') def rangef(number): return range(number) index.html <div class="container"> {% for i in {{b.count}}|rangef %} <p>Some text</p> {% endfor %} </div> Important to mention that b.count is an Integer field. Appreciate your help! -
Django: NameError User_id is not defined attempting to query user's account page
After deleting the "blog post", i would like to return back to the accounts page which is account:view. However i faced the following error that tells me that user_id is not defined. This is a NameError, as seen in the traceback. I tried to add in the line user_id = kwargs.get("user_id")above the account = Account.objects.get(pk=user_id) as I did in the accounts.views.py but it ended up returning another error. Can someone advise how I should define the user_id in this view, and perhaps how i should define the account as well in other for me to correctly return to the user's account page. Many thanks! Traceback: Traceback (most recent call last): File "/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view return view_func(request, *args, **kwargs) File "HomeFeed/views.py", line 147, in delete_blog_view account = Account.objects.get(pk=user_id) NameError: name 'user_id' is not defined In HomeFeed App: views.py @login_required def delete_blog_view(request,slug): context = {} account = Account.objects.get(pk=user_id) blog_post = get_object_or_404(BlogPost, slug=slug) blog_post.delete() return redirect(request.META.get('HTTP_REFERER', 'account:view', kwargs={'user_id': account.pk })) In 'account' App: urls.py: path('<user_id>/', account_view, name="view"), views.py def account_view(request, *args, … -
Django redirect from one view to another WITH PARAMETERS
User submits form of Checkout in my e-commerce website, now I want him to redirect to index function directly. def checkout(request): if request.method == "GET": return render(request, 'shop/checkout.html') else: # ... DO SOME WORK ... response = redirect(index) return response Above code snippet works fine, But when I do response = redirect(index,msg="Order has been placed"). I get error Note that my Index Function has parameter msg defined. def index(request, msg=False): -
How do distinguish between multiple forms submitted in one form in Django?
I have multiple forms of the same base class like this: class DatabaseForm(forms.Form): active = forms.BooleanField(required=False) # Determines, if username and password is required username = forms.CharField(label="Username", required=False) password = forms.CharField(label="Password", required=False) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['active'].label = self.label def clean(self): cleaned_data = super(DatabaseForm, self).clean() active = cleaned_data.get("ative") username = cleaned_data.get("username") password = cleaned_data.get("password") if active and not (username and password): raise forms.ValidationError("Please fill in the required database configuration") return cleaned_data class MySQLForm(DatabaseForm): label = "MySQL" class PostgreSQLForm(DatabaseForm): label = "PostgreSQL" class SqliteForm(DatabaseForm): label = "Sqlite3" So only if the user chooses a database, he must fill in the username and password for it. In my template, the form looks like this: <form action="." method="post"> {% csrf_token %} {{ mysql_form }} {{ postgres_form }} {{ sqlite_form }} <a id="database-submit-btn" href="#submit" class="btn btn-success submit-button">Submit</a> </form> Problem: When the user chooses a database by selecting the 'active' field, the 'active' fields of the other databases get set to True. It seems like I can't distinguish between the multiple fields, as they have the same key in the POST request (but I'm not sure that's the whole problem): 'username': ['mysql test', 'postgres test', 'sqlite test'], 'password': ['mysql password', 'postgres password', 'sqlite … -
how do I create the best relationships for my models
I need help - i am trying to connect my client model to my admin,senior employee- for my program i am want my admin and my senior to be able to add a new client and see all of the clients in the database but the employee will only see the clients they added into the database - i also want my admin and senior employee to be able to change the employee assigned to my client - excuse the mistakes i am still new to coding class CustomUser(AbstractUser): user_type_data=((1,"Admin"),(2,"senioremployee"),(3,"employee")) user_type=models.CharField(default=1,choices=user_type_data,max_length=20) class admin(models.Model): id = models.AutoField(primary_key=True) admin=models.OneToOneField(CustomUser, on_delete=models.CASCADE) Dob = models.DateField() Nationality = models.TextField() Address = models.TextField() Postcode = models.TextField() Telephone = models.TextField() Wage = models.TextField() Passportnumber = models.TextField() passportexpirydate = models.DateField() gender = models.CharField(max_length=255) profile_pic = models.FileField() kinname = models.TextField() kinrelation = models.TextField() kinaddress = models.TextField() kinphonenumber = models.TextField() kinemail = models.TextField() profile_pic = models.FileField() created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateTimeField(auto_now_add=True) objects = models.Manager() class senioremployee(models.Model): id = models.AutoField(primary_key=True) admin=models.OneToOneField(CustomUser, on_delete=models.CASCADE) Dob = models.DateField() Nationality = models.TextField() Address = models.TextField() Postcode = models.TextField() Telephone = models.TextField() Wage = models.TextField() Passportnumber = models.TextField() passportexpirydate = models.DateField() gender = models.CharField(max_length=255) profile_pic = models.FileField() kinname = models.TextField() kinrelation = models.TextField() kinaddress = models.TextField() kinphonenumber = models.TextField() … -
how to configure urls for news_details ? i want to go to news_details page when linked is clicked?
enter image description here enter image description here enter image description here enter image description here enter image description here -
Setting up apache virtual hosts for two django websites on windows server
I am trying to setup two django websites on a windows server platform with Apache. I am able to run both sites individually via apache successfully. But now running them together via virtual hosts seems to be tricky. Here is my attempt on configuration of both httpd file and wsgi files- Apache httpd config - LoadFile "c:/python/python39.dll" LoadModule wsgi_module "c:/python/lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win_amd64.pyd" WSGIPythonHome "c:/python" #Virtual host for first site <VirtualHost *:80> WSGIScriptAlias / "C:/doctormainfolder/doctorwebsite/doctorwebsite/wsgi.py" ServerName doctor.com <Directory "C:/doctormainfolder/doctorwebsite/doctorwebsite/"> <Files wsgi.py> Require all granted </Files> </Directory> Alias /static "C:/doctormainfolder/doctorwebsite/static/" <Directory "C:/doctormainfolder/doctorwebsite/static/"> Require all granted </Directory> ScriptInterpreterSource Registry </VirtualHost> #Virtual host for second site <VirtualHost *:80> WSGIScriptAlias / “C:/betamainfolder/betawebsite/betawebsite/wsgi.py" ServerName beta.com <Directory "C:/betamainfolder/betawebsite/betawebsite/"> <Files wsgi.py> Require all granted </Files> </Directory> Alias /static “C:/betamainfolder/betawebsite/static/" <Directory “C:/betamainfolder/betawebsite/static/"> Require all granted </Directory> ScriptInterpreterSource Registry </VirtualHost> Here are wsgi file details for first website import os import os import sys path = 'C:/doctormainfolder/doctorwebsite' if path not in sys.path: sys.path.append(path) from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'doctorwebsite.settings') application = get_wsgi_application() Here are wsgi files details for second website - import os import sys path = 'C:/betamainfolder/betawebsite' if path not in sys.path: sys.path.append(path) from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'betawebsite.settings') application = get_wsgi_application() -
Celery/Django: shared_task tasks disappeared or not registering from task registry when starting a worker
When booting up a worker, it lists all of the registered shared_tasks that can be consumed by the worker. When adding "proper" code to one of the shared_tasks (rather than test code) all of sudden the tasks were not registering. -
How do you assign number to a view in html
HTML <div class="tabcontainer" id="tabcon" style="background-color: aquamarine"> <ul id="navigation1"> <li class="tabli" id="button1"><button class="tabs">tab 1</button></li> <ul id="navigation2"> <li id="tabli"> <button onclick="newTab()" class="addbut" style="text-align: center"> + </button> </li> </ul> </ul> </div> Firstly how do you give different tab view. For example if you want one thing open in one tab and another in a different tab. Would you use JavaScript to hide and show different elements or I there a way using Django you can implement tabs. and another problem I'm facing is that I've designed these tabs that are each meant to display a different view, and the name of the tab is assigned dynamically, when a user inputs what they want the tab to be called. but can also change to. My first thought is to use a loop but this means you can't go back and change a value. so how could I assign each tab view with a value. Sorry if this is a beginner question to ask I'm quite new to this. -
How to host django on iis
I am trying to host my django website on IIS webserver. I have python 3.9 (64bits), django 3.1.4 and wfastcgi 3.0.0. I also have djangorestframework. I have tried everything but this error is coming. HTTP Error 500.0 - Internal Server Error An unknown FastCGI error occurred web.config <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.web> <customErrors mode="Off" /> </system.web> <system.webServer> <httpErrors errorMode="Detailed" /> <handlers> <add name="Python FastCGI" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\users\administrator\appdata\local\programs\python\python39\python.exe|c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" /> </handlers> </system.webServer> <appSettings> <!-- Required settings --> <add key="WSGI_HANDLER" value="Website.wsgi.application" /> <add key="PYTHONPATH" value="D:\Users\Manas\Projects\Cecrets\Web" /> <add key="WSGI_LOG" value="D:\Users\Manas\Projects\Cecrets\Web\wfastcgi.log"/> <!-- Optional settings --> <add key="DJANGO_SETTINGS_MODULE" value="Website.settings" /> </appSettings> </configuration> Please help me!!! -
Do I need any webdevelopment/webdesign background before learning Django?
I am about to start learning Django and while I have experience with Python and SQL I have no experience with web development or websites in general. I have been searching for advice online on which are the requirements or knowledge I need before start learning Django and develop my first website. The answers always suggest to learn Python but there is almost nothing on what level of webdevelopment/webdesign I need to have to best understand Django. Can anyone help me on that? Furthermore, is Django all I need to learn for the back-end or is there anything else I should learn? Sorry for not being super specific on the issue and thanks in advance. -
Django returns another message when the form is validated
I want to validate the mobile field but when I do clean_mob and return the message it turns out completely different I want to give it back 'Cannot be 1 character' but return 'This field cannot be null.' How can it be rectified and what prevents it? Thanks in advance This is my code views.py --> from django.shortcuts import render, HttpResponse from .forms import SignUpForm from django.http import HttpResponseRedirect from django.shortcuts import redirect from django.contrib.auth.forms import authenticate from django.contrib.auth import login def home(request): if request.method=="POST": form = SignUpForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') password = form.cleaned_data.get('password1') user = authenticate(username=username, password=password) login(request, user) return redirect('/') else: form = SignUpForm() return render(request, 'home/home.html', {'form': form}) def about(request): return render (request, 'home/about.html') forms.py ---> from django import forms from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.contrib.auth.forms import UserCreationForm from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django.utils.translation import ugettext as _ User = get_user_model() class SignUpForm(UserCreationForm): username = forms.CharField(max_length=30, widget=forms.TextInput(attrs={'placeholder': 'სახელი'})) email = forms.EmailField(max_length=200, widget=forms.TextInput(attrs={'placeholder': 'მაილი'})) def __init__(self, *args, **kwargs): super(SignUpForm, self).__init__(*args, **kwargs) self.fields['password1'].widget.attrs['placeholder'] ="პაროლი" self.fields['password2'].widget.attrs['placeholder'] ="გაიმეორეთ პაროლი" self.fields['mob'].widget.attrs['placeholder'] ="ტელეფონი" for field_name, field in self.fields.items(): field.widget.attrs['class'] = 'inp' for k, field in self.fields.items(): if 'required' in field.error_messages: field.error_messages['required'] = … -
Token authentication not working django rest framework
I am using token authentication for my current project but I have one problem, I can not authenticate a use for the life of me. To test my authentication I created a superuser and then the command python manage.py drf_create_token test1. And then created this view: class HelloView(APIView): permission_classes = (IsAuthenticated) def get(self, request): content = {'message': 'Hello, World!'} return Response(content) In my setting.py file I have: INSTALLED_APPS = [ ... # ... 'rest_framework', 'rest_framework.authtoken', 'backend', 'frontend' ] REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': [ 'rest_framework.authentication.TokenAuthentication', ], } And when I test my API I keep geting: { "detail": "Authentication credentials were not provided." } What am I missing here? can anyone tell me? Thank you in advance. -
Post hit/views count are not showing
I am going through a Django tutorial. In my Blog App, i am trying to count the views/hit counts in the blog post. views.py def detail_view(request,id): data = get_object_or_404(BlogPost,pk=id) count_hit = True if request.method == 'POST': comment_form = CommentForm(data=request.POST) if comment_form.is_valid() else: comment_form = CommentForm() context = {'data':data,'count_hit':count_hit} return render(request, 'mains/blog_post_detail.html', context ) urls.py path('hitcount/', include(('hitcount.urls', 'hitcount'), namespace='hitcount')), blog_post_detail.html <a>Title : {{ data.post_title }}</a> <p>Views: {% get_hit_count for data %}</p> models.py class BlogPost(models.Model): post_creater = models.ForeignKey(User,default='',null=True,on_delete = models.CASCADE) post_title = models.CharField(max_length=500,default='') date_added = models.DateTimeField(auto_now_add=True,null=True) hit_count_generic = GenericRelation(HitCount,object_id_field='object_pk',related_query_name='hit_count_generic_relation') def __str__(self): return self.post_title The Problem I have put the hit/views count in blog_post_detail.html. BUT when i open post in browser , It shows ---Views:0. What i have tried 1). I have applied all the migrations. 2). I have inserted the hitcount app in INSTALLED_APPS in settings.py Help me in this ! I will really appreciate your Help. Thank You In advance. -
Celery : Parallel tasks with a custom log format for each task
I'm new to Celery and trying to parallelize multiple instances of the following task : tasks.py @app.task() def scrap_launcher(user_email): from myapp import scrap_user extra = {'user_email':user_email} # ---- I want to display the user_email for each log ---- logger = logging.getLogger(__name__) syslog = logging.StreamHandler() formatter = logging.Formatter('%(asctime)s | %(user_email)s | %(levelname)s : %(message)s') syslog.setFormatter(formatter) logger.setLevel(logging.INFO) logger.addHandler(syslog) logger = logging.LoggerAdapter(logger, extra) # ---- Running the script for 1 user ---- scrap_user.run(user_email,logger) No surprises, when I run res = group(scrap_launcher.s(user_email) for user_email in list_users_email) res.delay() it creates multiple loggers and I get an insane number of duplicates logs. Where should I set up the Logger to get unique logs with a custom format for each user ? -
How to implement a notification queue for users?
Let's say I have users who create events of different time periods(max: 7days), and I have to send notifications to users when their event has ended. In between the time of each event, a user can cancel that event. To accomplish this I had the following implementation in mind: Mimic a priority queue using a database: Put the events in a database indexed and sorted by end time of events and erase events on deletion by the user or when it becomes the topmost event and current time is greater than its end time. This would mean I would have to poll the database every time to check for completed events. Considering that, I am not sure whether this is the right way to do this. So my question is are there any better methods or better, existing technologies that help to accomplish this sort of behavior? PS: Currently my backend is in django, so technologies easily integratable with django would be preferred. -
How to delete collection automatically in mongodb with pymongo ? (Django doesn't delete mongodb collection)
I have Django app which creates collections in MongoDB automatically. But when I tried to integrate the delete functionality, collections that are created with delete functionality are not deleted. Collections that are automatically created are edited successfully. This method is called in another file, with all parameters. An interesting thing to note is when I manually tried to delete via python shell it worked. I won't be deleting the collections which are not required anymore. import pymongo from .databaseconnection import retrndb #credentials from another file all admin rights are given mydb = retrndb() class Delete(): def DeleteData(postid,name): PostID = postid tbl = name + 'Database' liketbl = PostID + 'Likes' likecol = mydb[liketbl] pcol = mydb[tbl] col = mydb['fpost'] post = {"post_id":PostID} ppost = {"PostID":PostID} result1 = mydb.commentcol.drop() #this doesn't work result2 = mydb.likecol.drop() #this doesn't work print(result1,'\n',result2) #returns none for both try: col.delete_one(post) #this works pcol.delete_one(ppost) #this works return False except Exception as e: return e Any solutions, I have been trying to solve this thing for a week. Should I change the database engine as Django doesn't support NoSQL natively. Although I have written whole custom scripts that do CRUD using pymongo. -
Django filtering model on datetime with interger and datetime
I try to make a query to select all the object that where modified since a specified time This time is now - max_schedule_delay where max_schedule_delay is a data from the object (see code sample below). I try multiple thing .. but here I am. Maybe you will be able to help me find a way. Environment python 2.7 django 1.11 database : Posgresql Sample code from django.db import models class MyObject(models.Model): # last modification date mtime = models.DateTimeField(auto_now=True, db_index=True, null=True) # maximum delay before rescheduling in seconds max_schedule_delay = models.IntegerField(null=True) What I want to achieve select * from MyObject where (mtime + max_schedule_delay > now) from django.db.models import F, ExpressionWrapper,, TimeField, DateTimeField from django.db.models.functions import Cast import datetime now = datetime.datetime.now() MyObject.objects.filter(max_schedule_delay__lte=now - F("mtime")) # here max_schedule_delay is a integer, so this query is not possible # I try to split this query in two, but still not wotking MyObject.objects.annotate(threshold=ExpressionWrapper(now - F("max_schedule_delay"), output_field=DateTimeField())).filter(mtime__gte=F("threshold")) MyObject.objects.annotate(as_date=Cast("max_schedule_delay", TimeField())) Any help is welcome, Thanks ! -
Django: How to manipulate data in the value of django form field name like form_field[]
How I manypulate dynamic form field like <input type="text" name="field_name[]" value=""/> in django framework. How to save , fetch data or search field_name[]; And do you have resources like how to deal with it. My full code: https://codepen.io/naowal/pen/poEaKBe -
CRUD Operation Not Updating One Field
I am trying to add a new column to my User form called stakeholder_quadrant, but I am running into weird scenarios. 1) when I create a new item, it does not actually save the value that i enter in this field, and 2) when I go to update an item, the form pops up with stakeholder_group&stakeholder_quadrant concatenated within the stakeholder_group field and nothing in the stakeholder_quadrant field (e.g. RobD instead of stakeholder_group = Rob and stakeholder_quadrant = D). I believe the issue is within my javascript portion... I went through this and re-created every line where there is stakeholder_group mentioned for my new stakeholder_quadrant field, but when I do that my forms don't work at all. Any idea what's causing these errors? models class Stakeholder(models.Model): employee = models.CharField(max_length=200) stakeholder_group = models.CharField(max_length=200) description = models.CharField(max_length=200) stakeholder_quadrant = models.CharField(max_length=200) def __str__(self): return self.stakeholder views class CrudView(TemplateView): template_name = 'polls/stakeholders.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['users'] = Stakeholder.objects.all() return context class CreateCrudUser(View): def get(self, request): employee = request.GET.get('employee', None) description = request.GET.get('description', None) stakeholder_group = request.GET.get('stakeholder_group', None) stakeholder_quadrant = request.GET.get('stakeholder_quadrant', None) obj = Stakeholder.objects.create( employee = employee, description = description, stakeholder_group = stakeholder_group, stakeholder_quadrant = stakeholder_quadrant ) user = {'id':obj.id,'employee':obj.employee,'description':obj.description,'stakeholder_group':obj.stakeholder_group,'stakeholder_quadrant':obj.stakeholder_quadrant} data = … -
Nginx unit not working with django (ModuleNotFoundError: No module named 'encodings')
I keep getting: ModuleNotFoundError: No module named 'encodings' in the unit error logs when trying to add new configuration. Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings' 2020/12/31 19:51:50 [notice] 13294#13294 process 13297 exited with code 0 2020/12/31 19:51:50 [info] 15500#15500 discovery started 2020/12/31 19:51:50 [notice] 15500#15500 module: java 11.0.8 "/usr/lib/unit/modules/java11.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: perl 5.26.1 "/usr/lib/unit/modules/perl.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: php 7.2.24-0ubuntu0.18.04.6 "/usr/lib/unit/modules/php.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: python 2.7.17 "/usr/lib/unit/modules/python2.7.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: python 3.6.9 "/usr/lib/unit/modules/python3.6.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: python 3.7.5 "/usr/lib/unit/modules/python3.7.unit.so" 2020/12/31 19:51:50 [notice] 15500#15500 module: ruby 2.5.1 "/usr/lib/unit/modules/ruby.unit.so" 2020/12/31 19:51:50 [info] 15499#15499 controller started 2020/12/31 19:51:50 [notice] 15499#15499 process 15500 exited with code 0 2020/12/31 19:51:50 [info] 15514#15514 router started 2020/12/31 19:51:50 [info] 15514#15514 OpenSSL 1.1.1 11 Sep 2018, 1010100f 2020/12/31 19:52:40 [info] 15597#15597 "example_python" application started 2020/12/31 19:52:40 [info] 15602#15602 "example_python" application started 2020/12/31 19:54:20 [info] 15766#15766 "example_python" application started 2020/12/31 19:54:20 [info] 15767#15767 "example_python" application started 2020/12/31 19:54:20 [notice] 15499#15499 process 15597 exited with code 0 2020/12/31 19:54:20 [notice] 15499#15499 process 15602 exited with code 0 2020/12/31 19:57:49 [info] 16117#16117 "django" application started Fatal Python error: Py_Initialize: Unable to get …