Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
retrieving data from postgresql database into a dictionary in django
I am trying to return data that was retrieved from the database into a dictionary view.py from django.db import connection def custom_query(query): cursor = connection.cursor() cursor.execute(query) row = cursor.fetchall() return row when I try and change fetchall() to dictfetchall() it says 'psycopg2.extensions.cursor' object has no attribute 'dictfetchall' I have tried also to add an argument in the cursor method cursor_factory=psycopg2.extras.DictCursor it says cursor() got an unexpected keyword argument 'cursor_factory' -
Authentication credentials were not provided django-rest-auth
I have an application which I implemented django restframework and django reat-auth and jango framework jwt. I followed the instructions and every thing works fine in the browser. I now decided to test out the connection in postman and trying to get the logged in user's details which the endpoint is /rest-auth/user but i get the following error { "detail": "Authentication credentials were not provided." } and I decided to copy the returned Token and put it in the header of the user url as "Authorization": "Token ahagjbeghq7hbcvgqhvwqu08hevug.jwhhwiiwhw", "Content-Type": "application/json; charset=utf-8" after modifying the header with the returned token I expected it to display the user's details but instead I still got { "detail": "Authentication credentials were not provided." } but I can verify that the token is correct through the url provided by the restframework jwt /api-token-verify which retuns the token value back. this is my django rest authentication classes REST_FRAMEWORK = { 'DEFAULT_AUTHENTICATION_CLASSES': ( 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.BasicAuthentication', ), 'DEFAULT_PERMISSION_CLASSES': ( 'rest_framework.permissions.AllowAny', 'rest_framework.permissions.IsAuthenticatedOrReadOnly', ), } -
Docker: Nginx & Gunicorn/Django --- Welcome page accessible, but "Connection Reset" error on attempting to access application
For the past week or so I've been trying to move my project to Docker containers. This is my first time dealing with Docker, Gunicorn, and Nginx, so I'm struggling a bit. I've got my containers up, connected, and running, but I believe there's something wrong with my Nginx configuration. I can access the Nginx welcome page at http://172.19.0.4/. When I do, the log file is populated with: soundstat_NginxServer | 172.19.0.1 - - [29/May/2018:16:15:55 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" "-" (Why does it say 172.19.0.1 when I access the page via 172.19.0.4? I receive an 'Unable to Connect' / 'This site can't be reached' error when trying to access 172.19.0.1.) I have EXPOSE 8000 at the end of my Dockerfile (which builds the Gunicorn/Django image). Whenever I attempt to access my project at 0.0.0.0:8000/admin, for example, I receive a "The connection was reset" error—but I can access the welcome page just fine. Here are the relevant files: docker-compose.yml version: '3' services: mysql: container_name: ${MYSQL_CONTAINER} image: mysql:5.7 ports: - ${MYSQL_PORTS} environment: MYSQL_ROOT_PASSWORD: ${DB_ROOT} MYSQL_DATABASE: ${DB_NAME} MYSQL_USER: ${DB_USER} MYSQL_PASSWORD: ${DB_PASS} gunicorn: container_name: ${GUNICORN_CONTAINER} build: . volumes: - .:/soundstat env_file: .env links: - … -
django Update Quantity
I am creating a booking system and I have to update the quantity of the package. (if someone buys a ticket the quantity will go down) i am not sure how to do this as i am fairly new to python and django. Here are the 2 models ill be using for it class Bookings(models.Model): user = models.ForeignKey('users.Customer', verbose_name='Customer', on_delete=models.CASCADE, default=True, related_name='bookings') id = models.IntegerField(primary_key=True, unique=True, editable=False) BookingId = models.UUIDField(default=uuid.uuid4, editable=False) bookingDate = models.DateTimeField(default=timezone.now) bookingType = models.CharField(blank=False, max_length=50) bookingPayment = models.IntegerField('Payment') bookingDeposit = models.IntegerField('Payment') seatsChosen = models.IntegerField(default=0) Quantity = models.ForeignKey('packages.Packages', verbose_name='Packages', on_delete=models.CASCADE, default=True, related_name='bookings') class Packages(models.Model): id = models.CharField(primary_key=True, editable=False, unique=True, max_length=150) destination = models.CharField(max_length=200) hotelName = models.CharField(max_length=100) duration = models.CharField(max_length=100) price = models.IntegerField() quantity = models.IntegerField(default="53") departureDate = models.DateField(default=timezone.now) leavingTime = models.TimeField(default=timezone.now) View: def chooseSeats(request): form = ChooseSeats(request.POST) if request.method == "POST": if form.is_valid(): packageid = form.cleaned_data.get(Packages.id) quantity = form.cleaned_data.get(Packages.quantity) try: with transaction.atomic(): x = request.get(quantity) package = Packages.objects.get(packageid) package.quantity -= x package.update() package.save() except IntegrityError: raise Error form.save() else: form = ChooseSeats() return render(request, 'chooseseat.html', {'form': form}) the view is the part causing the error im trying to bring the package ID through to choose seats page so it wont update every quantity and only the quantity in … -
django ManyToMany relationship adding objects throws error
I've a UserAnalytics object which has a one-to-one relationship with an User. class UserAnalytics(models.Model): user = models.ForeignKey(User, related_name='analytics', on_delete=models.CASCADE, null=True) uptime = models.IntegerField(null=True) feeds_viewed = models.IntegerField(null=True) feeds_shared = models.IntegerField(null=True) I've a Feed object which has a ManyToMany relationship with the UserAnalytics object. class Feed(Base): headline = models.CharField(max_length=255) link = models.CharField(max_length=255, unique=True) summary = models.TextField() thumbnail = models.CharField(max_length=512, null=True) published_date = models.DateTimeField() views = models.IntegerField(default=0) shares = models.IntegerField(default=0) source = models.ForeignKey(Source, on_delete=models.CASCADE, null=True) reader = models.ManyToManyField(User, through='Bookmark') viewers = models.ManyToManyField(UserAnalytics) When I try to add a feed to a UserAnalytics, using this code, class ReadFeed(views.APIView): def get(self, request, **kwargs): try: user = User.objects.get(id=kwargs.get('user_id')) analytics = UserAnalytics.objects.get(id=user.id) except User.DoesNotExist: return Response({"Error": "User does not exist"}, status=status.HTTP_404_NOT_FOUND) try: feed = Feed.objects.get(id=kwargs.get('feed_id')) feed.views += 1 feed.viewers.add(analytics) feed.save() user.analytics.add(feed) user.analytics.save() return Response(FeedSerializer(feed).data, status=status.HTTP_200_OK) except Feed.DoesNotExist: return Response({"Error": "Feed does not exist"}, status=status.HTTP_404_NOT_FOUND) This the error that I get, TypeError: int() argument must be a string, a bytes-like object or a number, not 'RelatedManager' What am I doing wrong here? -
Change data of form in view before calling is_valid
I have a form: class DescriptorForm(forms.ModelForm): class Meta: model = Descriptor fields = ('project','name') def clean_name(self): name = self.cleaned_data['name'] project = self.cleaned_data['project'] if Descriptor.objects.filter(project=project, name__iexact=name).exists(): raise ValidationError("Descriptor with this name already exists") return name Only the field "name" is shown to the user, the value of "project" should be filled by the server. Since i have a validation for the name+project combination this has to happen befor the is_valid method is called. My view def save_descriptor_form(request, id, form, template_name): data = dict() project= Project.objects.get (id=id) if request.method == 'POST': form.fields['project']= project if form.is_valid(): form.save() Without form.fields['project']=project i get KeyError: 'project' which I guess is because the form tries to validate without any value in the project field. With form.fields['project']=project i get AttributeError: 'Project' object has no attribute 'disabled' How can i make this work?. I this the proper way and I just used the wrong command or should i approach this differently? -
Dynamically excluding field from Django ModelForm
I want to exclude, programatically, a field in my form. Currently I have this: class RandomForm(BaseForm): def __init__(self, *args, **kwargs): # This doesn't work if kwargs["instance"] is None: self._meta.exclude = ("active",) super(ServiceForm, self).__init__(*args, **kwargs) # This doesn't work either if kwargs["instance"] is None: self._meta.exclude = ("active",) class Meta: model = models.Service fields = (...some fields...) How can I exclude the active field only when a new model is being created? -
Losing foreign key value in Django REST serializer
I've simplified my code to make problem more clear. I have two related models in my Django REST project. In my models.py: class Project(Models.model): name = models.CharField(max_length=150) class Item(models.Model): project = models.ForeignKey(Project, blank=True, on_delete=models.CASCADE) data = models.TextField(blank=True, null=True) Then I create a serialiser: class ItemSerializer(serializers.ModelSerializer): class Meta: model = Item fields = ('id', 'project_id', "data") View set: class ItemViewSet(viewsets.ModelViewSet): queryset = Item.objects.all() serializer_class = ItemSerializer filter_backends = (DjangoFilterBackend,) filter_fields = ('project_id') Router: router.register(r'items', ItemViewSet) This implementation works fine for models without foreign keys. But when I post something like: { project_id: 1, data: "text" } (the project with id=1 exists) my ItemSerializer gets just { data: "text" } to validated_fields. The project_id field is completely lost during validation. How to configure Serializer or ViewSet to make it workable? -
How to Join two tables in Django
select * from article_article left join article_upvote ON article_article.id=article_upvote.article_id I want to write this query with Django ORM. How can I write this? Please help -
Using X-Sendfile to download file but memory leak on Chrome
I tried to use X-Sendfile with Apache on my Django project to download large file, it works on Firefox but not on Chrome. After I saw the dev tools, it crash when HttpResponse transfered to 788MB (shows "Aw, Snap!"): https://imgur.com/a/pY2IJEi I use ajax to GET file link created: $.ajax({ type: "GET", url: "{% url 'user-download' %}", dataType: "text", data: { name: filename, t: timestamp }, success: function(r) { console.log("DONE", r); var res = $.parseJSON(r); if (res != null && res.status === 413) { .... } else if (res != null && (res.status === 404 || res.status === 0)) { .... } else { url = "{% url 'user-download' %}?name=" + filename + "&t=" + timestamp var $btn_save = $($.parseHTML('<a class="btn btn-link" title="Save" href="' + url + '" target="_blank"><i class="fam-disk"></i></a>')) } }, }); and Python code as user-download views @csrf_exempt @etag(did_to_etag) def download(request): name = request.GET.get('filename') import os, math filepath = os.path.join(__DOWNLOAD_DIR__, name) ... other check and return ... from django.http import StreamingHttpResponse response = HttpResponse(content_type='application/force-download') response['X-Sendfile'] = filepath response['Content_Type'] = 'application/force-download' response['Content-Length'] = os.path.getsize(filepath) response['Content-Disposition'] = 'attachment; filename="%s"' % (name) return response Is there any better way to solve the response size too large problem or I write the wrong … -
Exception Value: 'NoneType' object has no attribute 'rfind'
My code throws me an exception but Googling hasnt helped me. I did an error check on it possibly could be it getting the wrong path, but it prints the correct one out to the console. Exception Value: 'NoneType' object has no attribute 'rfind' def user_directory_path(instance, filename): time_stamp = 'user_{0}/{1}'.format(instance.user, filename) createfolder = os.path.join('home', 'ttt', 'Desktop', 'GolemProject', 'Fileuploads', time_stamp,) print(createfolder) if not os.path.exists(createfolder): os.makedirs(createfolder) From the console: home/ttt/Desktop/GolemProject/Fileuploads/user_wqe/vbbfgsfdgfds.zip Internal Server Error: /callgolem/ Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/exception.py", line 35, in inner response = get_response(request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 128, in _get_response response = self.process_exception_by_middleware(e, request) File "/usr/local/lib/python3.5/dist-packages/django/core/handlers/base.py", line 126, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/ttt/Desktop/GolemProject/callgolem/views.py", line 65, in index instance.save() File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 729, in save force_update=force_update, update_fields=update_fields) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 759, in save_base updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 842, in _save_table result = self._do_insert(cls._base_manager, using, fields, update_pk, raw) File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 880, in _do_insert using=using, raw=raw) File "/usr/local/lib/python3.5/dist-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python3.5/dist-packages/django/db/models/query.py", line 1125, in _insert return query.get_compiler(using=using).execute_sql(return_id) File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1283, in execute_sql for sql, params in self.as_sql(): File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1236, in as_sql for obj in self.query.objs File "/usr/local/lib/python3.5/dist-packages/django/db/models/sql/compiler.py", line 1236, … -
Error en al insertar dato en formulario django validación
Estoy usando GenericIPAddressField este crea un atributo de tipo inet en postgres, El tipo inet tiene una dirección de host IPv4 o IPv6, y, opcionalmente, su subred, todo en un solo campo. Pero en el formulario al insertar una ip con subred genera el error: * " Introduzca una dirección IPv4 o IPv6 válida. "* ¿como puedo validar para que no aparezca ese tipo de error y me acepte lo que deseo sin que exista la necesidad de cambiar el tipo de dato en el modelo ? -
Django global variable for base.html
I'm currently working on a blog application in Django. I want to have a dropdown menu that is always displayed at every site of my Project. Therefore I need some kind of global variable, right? Any idea how to simply implement this? base.html: ... <body> <div class="page-header"> <form method="POST"> <label> <select name="Category"> {% for categorie in categories %} <option value="{{ categorie.title }}">{{ categorie.title }} {{ categorie.post_set.count }}</option> {% endfor %} </select> </label> </form> {% if user.is_authenticated %} <a href="{% url 'logout' %}" class="top-menu"><button type="button" class="btn btn-danger">Logout</button></a> models.py: # Categorys of Post Model class Category(models.Model): title = models.CharField(max_length=255, verbose_name="Title") class Meta: verbose_name = "Category" verbose_name_plural = "Categories" ordering = ['title'] def __str__(self): return self.title #Post Model class Post(models.Model): author = models.ForeignKey('auth.User', on_delete=models.CASCADE) title = models.CharField(max_length=200) text = models.TextField(max_length=10000) category = models.ForeignKey(Category, verbose_name="Category", on_delete=models.CASCADE, null=True) -
Refresh DIV element at set intervals
For a chat application within a Django project, I populate a sidebar with links for logged in users. The links open a pop-up for chat(similar to FB stlye).If I refresh the page any open pop-up is closed. I want to refresh only the sidebar to reflect if a user has logged out. This code refreshes the entire page and all open pop-up's close. $(function(){ $('#sidebar-name').on('scroll', function(){ scrolling = true; }); setTimeout(function() { location.reload() },3500); }); I use the code below to get the messages and refresh the message box function getMessages(){ if (!scrolling) { $.get('/chatpop/messages/', function(messages){ console.log(messages); $('#msg-list').html(messages); var chatlist = document.getElementById('msg-list-div'); chatlist.scrollTop = chatlist.scrollHeight; }); } var scrolling = false; } $(function(){ $('#msg-list-div').on('scroll', function(){ scrolling = true; }); refreshTimer = setInterval(getMessages, 10000); }); I also tried the following but not working.. $(function(){ $('#sidebar-name').on('scroll', function(){ scrolling = true; }); (function() { load(location.href +'#sidebar-name') },10000); }); I need to refresh only the sidebar in a way that does not close the already opened chat pop-up's. The HTML being used is.. <div class="chat-sidebar"> <div class="sidebar-name"> <!-- Pass username and display name to register popup --> {% for user in request.online_now %} {% if request.user != user %} <a href="javascript:register_popup('{{ user }}', '{{ … -
I wonder what wsgi to choose to deploy Django in Heroku
I know that most Django projects use gunicorn to deploy to Heroku. Actually I deployed it to Heroku using this and it works well, but occasionally I get a Request Timeout. I would like to use another wsgi middleware to improve this. To replace gunicorn, I found the middleware called waitness, and I want to know the difference between them. In addition, I would like to see if the Request Timeout problem also improves. -
Django unit tests for admin change view
I am trying to write tests for the admin page. Currently, I am writing the test for the change method under admin - class BaseTestAdmin(TestCase): subnet_model = SubnetModel app_name = "app_name" def setUp(self): User.objects.create_superuser(username='admin', password='tester', email='admin@admin.com') self.client.login(username='admin', password='tester') def test_subnet_change(self): obj = self.subnet_model(subnet="10.0.0.0/24", description="Sample Subnet") obj.full_clean() obj.save() response = self.client.get(reverse('admin:{0}_subnet_change'.format(self.app_name), args=[obj.pk]), follow=True) self.assertContains(response, 'ok') self.assertEqual(self.subnet_model.objects.get(pk=obj.pk).subnet, ip_network('10.0.0.0/24')) The test is passing, but I when I try to print(response.rendered_content) I get the template contents of the login page. I want to retrieve the template code for change view instead. How should I achieve that? -
Use Django with sqlite on Azure Web App
I am trying to deploy a Django Web Service on Azure web app. But I am unable to use sqlite database in my web service. Basically, I am unable to run python manage.py makemigrations and python manage.py migrate And when I call one of the APIs which uses one of the tables in the database I get a database not found error. Any ideas how to do it? -
how to cancel form w/o validation in django + bootstrap4
Hi i am using django + bootstrap4 to render forms. I have 'submit' and 'cancel' buttons on the forms. i am using ModelForm with Validators assigned to most of the form attributes. template file <form action="{% url 'actor-create' %}" method="post" class="w-25 mx-auto"> {% csrf_token %} {% bootstrap_form form layout="horizontal" %} <button class="btn btn-primary" type="submit"><i class="fas fa-plus"></i> Save</button> <button class="btn btn-primary" type="submit"><i class="fas fa-times"></i> Cancel</button> </form> in the view def actor_create(request): # if this is a POST request we need to process the form data if request.method == 'POST': print(request.POST) if "cancel" in request.POST: return HttpResponseRedirect('/') ..... rest of the code When cancel button is pressed validation of the form attributes prevents the form from submitting. so view functionality never gets executed. I want to know how to avoid validation when form is cancelled? Following Q&A has a JavaScript based solution, I preferably don't want to write such code for every form in my website. How to cancel form submission? -
Does Django creates Different database for every app in project ? if Yes then How to connect two app database and if No then how to interact with that
Does Django creates Different database for every app in project ? if Yes then Howto connect two app database and if No then how to interact with that? -
expected str, bytes or os.PathLike object, not NoneType
I got this code which is supposed to create a folder based on the logged in users name and save the file they upload inside that folder. My problem is that it throws this error code expected str, bytes or os.PathLike object, not NoneType My current code: def user_directory_path(instance, filename): time_stamp = 'user_{0}/{1}'.format(instance.user, filename) createfolder = os.path.join('C:/Users/MyUser/Desktop/Project/', 'Fileuploads/', time_stamp,) if not os.path.exists(createfolder): os.makedirs(createfolder) -
Django tables2 and filters search calls "NoReverseMatch"
My goal was to build a long table with few columns and a search option on top of it. I have found a nice combination of django-tables2 and django-forms, followed the tutorial and got stuck in final part where search is not functional. Maybe you could help me out. * if I get rid of this lines table is working, but search gives 405, if I leave them I get: NoReverseMatch at /warscrolls/ Reverse for 'scroll-detail' not found. 'scroll-detail' is not a valid view function or pattern name. tables.py class ScrollTable(tables.Table): id = tables.LinkColumn('scroll-detail', args=[A('pk')]) * name = tables.LinkColumn('scroll-detail', args=[A('pk')]) * army = tables.LinkColumn('scroll-detail', args=[A('pk')]) * key = tables.LinkColumn('scroll-detail', args=[A('pk')]) * class Meta: model = Scroll fields = ('id', 'name', 'army','key') attrs = {"class": "table-striped table-bordered"} empty_text = "There are no Warscrolls matching the search criteria..." forms.py class ScrollListFormHelper(FormHelper): form_id = 'scroll-search-form' form_class = 'form-inline' field_template = 'bootstrap3/layout/inline_field.html' field_class = 'col-xs-3' label_class = 'col-xs-3' form_show_errors = True help_text_inline = False html5_required = True layout = Layout( Fieldset( '<i class="fa fa-search"></i> Search Warscroll Records', InlineField('id'), InlineField('name'), InlineField('army'), InlineField('key'), ), FormActions( StrictButton( '<i class="fa fa-search"></i> Search', type='submit', css_class='btn-primary', style='margin-top:10px;') ) ) filters.py class ScrollListFilter(django_filters.FilterSet): class Meta: model = Scroll fields = ['id', … -
What is the correct format to get Django Header value when Header name contain `_` underscore
My CURL command:- curl -X POST \ http://localhost:8000/sendData/ \ -H 'authorization: Token b67d31c42d98b3c97b28c737629dca63ef5043fc' \ -H 'cache-control: no-cache' \ -H 'client_cdata: virat' \ -H 'clientdata: sachin' \ -H 'content-type: multipart/form-data; \ -H 'postman-token: ed70d17c-ecf6-66c7-619e-85eac7d62803' \ -F purchasID=23124212 \ -F purchaserAmount=4320' I tried to get Header Data using request.META['HTTP_CLIENTDATA'] I got the value sachin same as when i try to get request.META['HTTP_CLIENT_CDATA'] it not working, It's showing the *** KeyError error. What is the correct format to get Header value when header name contain _? Thanks in advance. -
LookupError: App 'promotions' doesn't have a 'KeywordPromotion' model when upgrading to django oscar 1.6
I have a django oscar shop that I'm attempting to upgrade to Oscar 1.6. My shop extends Oscar's promotions model (although at this stage, does little with it). It works fine if I remove the promotions app from the project, and it works fine in django 1.5. However when I try to start the app in Oscar 1.6, I get the following error. LookupError: App 'promotions' doesn't have a 'KeywordPromotion' model. It seems that none of Oscar's promotions models are being loaded at startup. There's a message in the release notes that says: The majority of the Oscar class imports now use dynamic loading, instead of direct imports, for better extensibility and customisability. Does anyone know if this, or otherwise is preventing the promotions model from loading? -
How to convert row query to querySet in django?
I use an qsl query for reporting. But I need to do it with querySet in django. Is there a way to convert it? Or else It is possible with querySet? here is my sql def get_query_string(self, sDate, eDate, param): return "SELECT 1 as id, to_char(u.created_at,'%s') AS timeValue, " \ "sum(CASE WHEN operation=0 THEN 1 ELSE 0 END ) AS blocked, " \ "sum(CASE WHEN operation=1 THEN 1 ELSE 0 END ) AS unBlocked " \ "from um_url u WHERE u.created_at " \ "BETWEEN '%s' AND '%s' " \ "GROUP BY to_char(u.created_at,'%s') " \ "ORDER BY to_char(u.created_at,'%s') ASC;" % (param, sDate, eDate, param, param) -
Django on AWS with mod_wsgi: cannot find module 'psycopg2'
I'm trying to deplay a Django application on an AWS using mod_wsgi. I keep on getting the error that my application can't find the module 'psycopg2' even after installing it using pipenv in my virtualenv. Traceback: [Tue May 29 12:21:23.156599 2018] [mpm_prefork:notice] [pid 29251] AH00173: SIGHUP received. Attempting to restart [Tue May 29 12:21:23.223824 2018] [http2:warn] [pid 29251] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in y our server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HT TP/2 protocol will be inactive. [Tue May 29 12:21:23.223849 2018] [http2:warn] [pid 29251] AH02951: mod_ssl does not seem to be enabled [Tue May 29 12:21:23.224447 2018] [lbmethod_heartbeat:notice] [pid 29251] AH02282: No slotmem from mod_heartmonitor [Tue May 29 12:21:23.226412 2018] [mpm_prefork:notice] [pid 29251] AH00163: Apache/2.4.33 (Amazon) mod_wsgi/4.6.4 Python/3.5 configured -- resuming normal operations [Tue May 29 12:21:23.226426 2018] [core:notice] [pid 29251] AH00094: Command line: '/usr/sbin/httpd' [Tue May 29 12:21:25.877151 2018] [wsgi:error] [pid 32339] [remote IP] mod_wsgi (pid=32339): Failed to exec Python script file '/var/www/html/myproject/frame work_mapping/framework_mapping/wsgi.py'. [Tue May 29 12:21:25.877223 2018] [wsgi:error] [pid …