Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
I was trying to run the uwsgi and supervisor but it's not working properly
Here is the configuration file for supervisor command=/home/ubuntu/.local/bin/uwsgi --ini /home/ubuntu/socialtalks/config/uwsgi.ini directory=/home/ubuntu/socialtalks startsecs=0 autostart=true autorestart=true stderr_logfile=/var/log/socialtalks.err.log stdout_logfile=/var/log/socialtalks.out.log When i reloaded this file using sudo service supervisor reload It's reloading and running. Here is the out put. sudo supervisorctl status socialtalks socialtalks RUNNING pid 8639, uptime 0:00:00 But, it's not starting the server on boot and when i checked the log file it's shwoing errors. Here is error log. *** Starting uWSGI 2.0.19.1 (64bit) on [Wed Jul 28 01:52:32 2021] *** compiled with version: 7.5.0 on 02 January 2021 08:22:31 os: Linux-5.4.0-1054-aws #57~18.04.1-Ubuntu SMP Thu Jul 15 03:21:36 UTC 2021 nodename: ip-172-31-2-189 machine: x86_64 clock source: unix detected number of CPU cores: 1 current working directory: /home/ubuntu/socialtalks detected binary path: /home/ubuntu/.local/bin/uwsgi !!! no internal routing support, rebuild with pcre support !!! setgid() to 33 setuid() to 33 chdir() to /home/ubuntu/socialtalks your processes number limit is 3800 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) error removing unix socket, unlink(): Operation not permitted [core/socket.c line 198] bind(): Address already in use [core/socket.c line 230] [uWSGI] getting INI configuration from /home/ubuntu/socialtalks/config/uwsgi.ini open("./python37_plugin.so"): No such file … -
Python Request inside Django View stop request when client gets disconnected
I have an DRF API in which a client will call then once called it will pass the data from client to another server (using request package) and returns to client the response of the other server. In short, I am an API in the middle to sync them. Now, I need to terminate the request to other server (the one that is using request package) from my DRF API once the client got disconnected to my DRF API. Note. I need to terminate it because the data sending from the client is need to be map by the id being returned from the other server, and the client needs to save the id they received. In case your wondering why my API exist, the client can just sent the request over to the other server directly. Because the other server is a legacy server and it runs SOAP so my API is converting the JSON payloads to SOAP payload then from SOAP payload to JSON payload. -
How to refresh view.py in Django when clicking form checkbox and passing checkbox boolean?
Hello I'm trying to refresh my webpage when clicking a form checkbox and passing the checkbox boolean to the view.py. I'm trying to accomplish this using Ajax, but this is the first time using Ajax and I honestly have no idea if its working correctly. HTML and AJAX: <script type="text/javascript"> $("check_legend").click(function(){ var form_data = $("form_legend").serialize(); $.ajax({ url: '{% url 'post_form_api' %}', type: "POST", dataType: "json", data: form_data, cache: false }).done(function(data) { if (data.result === true){ alert(data.message); } }); }); </script> <div class="row"> <div class="col-sm-10"> {{ map|safe }} </div> <div class="col-sm-2"> <form method="post" id="form_legend"> <h3><span style="color: #e8c4b4;">Places</span></h3> <div class="form-check"> <input type="checkbox" class="form-check-input" id="check_legend" name="cities"> <label class="form-check-label" for="check_legend">Cities</label> </div> </form> </div> </div> This is in my url.py if it's of any use: path('api/post_form/', post_form_api, name="post_form_api") and my view.py goes as follows for the ajax response: from django.views.decorators.csrf import csrf_exempt @csrf_exempt def post_form_api(request): data = {} if request.method == "POST" and request.POST.get('cities', None) is not None: form_field1 = request.POST.get('cities') # save the form data and indicate success data['result'] = True data['message'] = "Form saved successfully" ... if request.is_ajax(): return JsonResponse(data) else: return HttpResponseBadRequest() In a different part of the view.py where I get give values to the webpage I handle the POST request … -
Using Git?? : how to update my Django website I deployed by DigitalOcean
my gorgeous friends on the Internet. A week ago, I deployed my first Django website on the Internet. Now, I have made some updates in the local environment (I cloned the website from GitHub and did coding in VSCode). Once I deployed it a week ago, the environment was Django, Postgresql, Nginx, Gunicorn, and DigitalOcean as a VPS. I am wondering that all I have to do is to command 'git pull' or 'git clone' here (I put a picture of the terminal. If just commanding 'git pull', let me know I am correct. Thanks for your time. -
Override the third party view for end-point
I am using Django-rest-framework-social-oauth2 , convert-token endpoint. This endpoints returns json as following { "access_token": "************", "token_type": "Bearer", "expires_in": 36000, "refresh_token": "************", "scope": "read write" } Now I want to add user id or deta of user model(like name ,email,etc,,) to this json. So I want to override the this view,maybe class ConvertTokenView in this code. How can I do this?? class ConvertTokenView(CsrfExemptMixin, OAuthLibMixin, APIView): """ Implements an endpoint to convert a provider token to an access token The endpoint is used in the following flows: * Authorization code * Client credentials """ server_class = SocialTokenServer validator_class = oauth2_settings.OAUTH2_VALIDATOR_CLASS oauthlib_backend_class = KeepRequestCore permission_classes = (permissions.AllowAny,) def post(self, request, *args, **kwargs): # Use the rest framework `.data` to fake the post body of the django request. mutable_data = request.data.copy() request._request.POST = request._request.POST.copy() for key, value in mutable_data.items(): request._request.POST[key] = value url, headers, body, status = self.create_token_response(request._request) response = Response(data=json.loads(body), status=status) for k, v in headers.items(): response[k] = v return response -
Ajax GET request returns current HTML page
Hi Im building Django first project. I use ajax to update product when user inputs keyword This is my HTML: <form id="productform" method="GET">{% csrf_token %} <label>Producto:</label> <div class="input-group"> <span class="input-group-label"><i class="fi-magnifying-glass"></i></span> <input type="text" class="input-group-field" placeholder="Buscar.." id="keyprod" name="keyprod"> </div> </form> When submitting form this is my JS: $("#productform").submit(function (e) { e.preventDefault(); var keyprod = $("#keyprod").val(); $.ajax({ type: 'GET', url: "ajax_get_products", data: {"keyprod": keyprod}, success: function (response) { var sel = $("#productselect"); sel.empty(); console.log(response) for (var p in response) { sel.append('<option value="' + response[p]["id"] + '">' + response[p]["full_name"] + '</option>'); } }, error: function (response) { console.log(response) } }) }) This is my urls file: app_name = "sales_app" urlpatterns = [ path( 'sales/register/', views.LoadCurrentSaleInfo.as_view(), name='sale-register', ), path( 'sales/register/<str:new>', views.LoadCurrentSaleInfo.as_view(), name='sale-register', ), path('sales/register/ajax_get_products', ajax_get_products, name="ajax_get_products"), ] And finally this is the code in my view: def ajax_get_products(request): print("Im in ajax request") --> This is never shown if request.is_ajax and request.method == "GET": keyprod = request.GET.get("keyprod", None) products = Product.objects.search_key_word(keyprod, 'name') serializer = ProductSerializer(products, many=True) return JsonResponse(serializer.data, safe=False, status=200) return JsonResponse({}, status=400) When I print the response in the console in my JS method, the current html page in which the form is being submitted is printed. What am I doing wrong any ideas? … -
I want to fetch all subcategories based on my parent ID category. Using Django/Vuejs. More info bellow
I'm trying to fetch subcategories from api, based on PAREND ID, using Vue and Django So, I have 2 categories: Phone Brands Phone Models Example: Category: Sony, id:1 Related subcategory: XZ3, XZ2, XZ... Category: Samsung, id:2 Related subcategory: S10, S9, S8... So when the user click on 'Sony, id:1' category(), I want all data based on that Category(parent)ID to be displayed on the screen(inside component). What is happening now, when I pass ID from parent to child component, response returns only 1 objects, that matches ID which I get from parent ID. Like, Sony(parent category) have ID:1, XZ3 (child category)have ID:1 too, so it show only matched ID inside component, nothing else DJANGO views.py: from rest_framework import serializers from . models import Specs, Models, Brands from django.shortcuts import render from rest_framework.decorators import api_view from rest_framework.response import Response from . serializers import ModelsSerializer, SpecsSerializer, BrandsSerializer # Create your views here. @api_view(['GET']) def BrandsView(request): brand = Brands.objects.all() serializer = BrandsSerializer(brand, many=True) return Response(serializer.data) @api_view(['GET']) def ModelsView(request, pk): model = Models.objects.get(pk=pk) serializer = ModelsSerializer(model, many=False) return Response(serializer.data) @api_view(['GET']) def SpecsView(request, pk): specs = Specs.objects.get(pk=pk) serializer = SpecsSerializer(specs, many=False) return Response(serializer.data) urls.py: from django.urls import path from . import views urlpatterns = [ path('', … -
Django log errors and traceback in file in production environment
I'm quite new working with logging in django, I'm making a production deployment (DEBUG=False) of an app but I'm not allowed to use any error tracker like Sentry to catch possible problems, so I was wondering if it's possible to log the traceback or part of it in production environment to a file using a logger. I made something like this in my production settings: import logging.config # Clear prev config LOGGING_CONFIG = None # Get loglevel from env LOGLEVEL = os.getenv('DJANGO_LOGLEVEL', 'debug').upper() logging.config.dictConfig( { 'version': 1, 'disable_existing_loggers': False, 'filters': { 'require_debug_false': { '()': 'django.utils.log.RequireDebugFalse', }, 'require_debug_true': { '()': 'django.utils.log.RequireDebugTrue', }, }, 'handlers': { 'console': { 'level': 'INFO', 'filters': ['require_debug_false'], 'class': 'logging.StreamHandler', }, 'file': { 'level': 'DEBUG', 'class': 'logging.FileHandler', 'filename': 'debug.log', }, }, 'loggers': { "": { "level": "ERROR", "handlers": ["console", "file"], }, 'django': { 'handlers': ['console', 'file'], 'level': 'DEBUG', 'propagate': True, }, 'django.request': { 'handlers': ['console', 'file'], 'propagate': True, 'level': 'ERROR', }, } } ) But the only thing I got on debug.log is: Internal Server Error: /job/create/ Internal Server Error: /job/create/ Internal Server Error: /job/create/ Logs to file without any other information, I would like to have some meaningful information in debug.log to have a clue where can … -
How use brackets django apps?
Heey, I have a problem, probably very simple and i have one ask. How i can use a '{{ }}' in other my apps? for example: enter code here def show_profile_info(request) new_user = Profile.objecs.all().order_by('-id')[:1] context = { 'new_user': new_user return render(request, 'urprofile.html' context) This views is in in app with name "Profile" In Profile this is easy, but i dont have idea how i can do this is "Post" app or other Anyone can give me a small hint? -
Django user groups selector
I'm new in Django and I'm facing this problem. I have created a custom user model and afther that I'm not able to set the user groups in the create/change form of the admin panel. This is my user class class User(AbstractUser): class UserRole(models.TextChoices): ADMIN = "ADMIN", "Administrador" MANAGER = "MANAGER", "Manager" HUNTER = "HUNTER", "Hunter" NONE = "NONE", "Sin especificar" # override first_name = models.CharField(_('first name'), max_length=150, blank=False) last_name = models.CharField(_('last name'), max_length=150, blank=False) email = models.EmailField(_('email address'), blank=False) # new fields role = models.CharField( max_length=50, choices=UserRole.choices, default=UserRole.NONE, verbose_name="Rol" ) And this is my users admin class in admin.py class UserAdmin(admin.ModelAdmin): list_display = ('username', 'first_name', 'last_name') search_fields = ('username', 'first_name', 'last_name') fieldsets = ( ("Datos personales", {'fields': ('username', 'first_name', 'last_name', 'email')}), ('Permisos', {'fields': ('role', 'is_active', 'is_superuser', 'is_staff', 'groups')}), ) And this is what I'm getting enter image description here Instead of this, that is what I want to get enter image description here I need someone to light my way, thanks! -
Deploying through Heroku button failed
I tried to deploy all three of them on Heroku but failed at doing it with storefront. Deploying other two was successful but when installing nodejs packages it failed. At the end of the build log it mentioned the model's key? Should be unique but I am not quite sure. The store core when opened with dashboard looked prepopulated already without me hitting populatedb command as mentioned in their docs. Is this fact related to my store front deployment failure? -
Django redirect after successful login is not working in production with Nginx
So I have a project that works fine in localhost and all redirects work after a successful login but in production (Ubuntu 18.04 digitalocean + Nginx and Gunicorn) the page just redirects me again to the homepage which is the login page. Here is my project config file for Nginx server { listen 80; server_name ip_addres; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/user/project; } location /static/admin { alias /home/user/project/projectenv/lib/python3.6/site-packages/django/contrib/admin/static/admin; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } and this is proxy params that is included proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffers 32 4k; -
Django fcm gives InvalidRegistration
I'm currently trying to use django-fcm to push notifications but I'm having a problem. I followed many configs but I'm always having a problem connecting to firebase, I'm getting the following error {'multicast_ids': [5220972250677554440], 'success': 0, 'failure': 1, 'canonical_ids': 0, 'results': [{'error': 'InvalidRegistration'}], 'topic_message_id': None} my FCM config in settings.py FCM_DJANGO_SETTINGS = { "FCM_SERVER_KEY": USER_FCM_KEY , "ONE_DEVICE_PER_USER": False, "DELETE_INACTIVE_DEVICES": False, } And my test code is from fcm_django.models import FCMDevice from django.contrib.auth import get_user_model device = FCMDevice() device.device_id = "Device ID" device.registration_id = "Device registration id" device.type = "Android" device.name = "Can be anything" device.user = get_user_model().objects.all().first() device.save() device.send_message(title="Title", body="Message", data={"test": "test"}) My API_KEY is valid I tried generating it again many times from firebase console > cloud messaging Please do you know what might be going wrong ? thanks. -
Case When then column name Django
I need to add a column to my query and change the value based on a condition for example if buy = True then column value should be amount column otherwise it should be price column * amount column I'm trying this but doesn't work: OrderBook.objects.filter(Q(user_id=self.owner.pk), Q(is_open=True)).annotate( locked_value=Case( When(condition1,then=Value(F("amount"))), When(condition2, then=Value(F("amount") * F("price")), default=Value(F("amount")), output_field=models.DecimalField() ) ) i keep getting this error: Error binding parameter 1 - probably unsupported type. -
Build a persistent elasticsearch index in Docker?
I am using Docker for my Django Project where I use Elastic search. I can create an elastic search index successfully with docker-compose exec web python3 manage.py search_index --rebuild but as soon as I close the elastic search terminal and run docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.13.4 again, to start elastic search, aftwerwards the index is gone. How can I make the index persistent? -
Deleting currently viewed data after button click - Django
When the user clicks an html button, I call a django view function. This function should delete the data that the user is currently viewing and redirect them to a new page, but it seems to be deleting the entire database, not just specific data. I have tried filtering and using self.pk, but it does not seem to work. I render out my data using a url which is assigned to a class based view, I then have a function associated with the button to delete. Can someone please help me with my problem? My code is down bellow. URL: path('donations/<int:pk>/', views.DonationDetail.as_view(), name='donation-detail'), Class Based View (To get the data and render it out): class DonationDetail(DetailView): model = Donation queryset = Donation.objects.all() template_name = 'acceptdonation.html Function to delete data: def acceptdonation(request): deleteitem = DonationDetail.queryset() deleteitem.delete() #seems to delete the entire database return redirect('/dashboard/') return render(request, 'acceptdonation.html', ) -
django-rest-framework-simplejwt validate parameter inside the token
I use django-rest-framework-simplejwt to authentification. In each request I need to check tokens if some variable is valid (if create_time < last change password i will refuse connection). Whats the best way to do it in django? I think the best solution is to create new class with validation, but I have no idea what it should include? I have 3 candidates 'USER_AUTHENTICATION_RULE': 'rest_framework_simplejwt.authentication.default_user_authentication_rule', 'AUTH_TOKEN_CLASSES': ('rest_framework_simplejwt.tokens.AccessToken',), 'DEFAULT_AUTHENTICATION_CLASSES':('rest_framework_simplejwt.authentication.JWTAuthentication',) -
Django Equivalent to SQL SCORE(1) when using contains
I am trying to rewrite this raw SQL query as Django: SELECT SCORE(1), * FROM article WHERE CONTAINS(synopsis, 'something', 1) > 0 ORDER BY 1 DESC With the model setup, it is quite simple really (synopsis is a models.CharField) article.filter(synopsis__icontains=query) But I cannot find how to pull out some kind of best match ordering from the Django query. I've also noted that the actual SQL query generated by Django does not use CONTAINS, it uses LIKE. It is important to maintain the ordering of results returned based on the SCORE result of CONTAINS. However, I cannot find a Django equivalent to SCORE. Is there a Django equivalent to the SQL SCORE? -
Django Telegram bot not responding on Heroku
I deployed my bot to Heroku but it is not responding I have a doubt regarding the Procfile, thi is what I currently have: web: python3 bot.py web: gunicorn tlgrmbot.wsgi This is what I see in the logs: 2021-07-27T21:25:56.080317+00:00 heroku[web.1]: Starting process with command `gunicorn tlgrmbot.wsgi` 2021-07-27T21:26:00.590684+00:00 heroku[web.1]: State changed from starting to up 2021-07-27T21:26:00.092958+00:00 app[web.1]: [2021-07-27 21:26:00 +0000] [4] [INFO] Starting gunicorn 20.1.0 2021-07-27T21:26:00.093896+00:00 app[web.1]: [2021-07-27 21:26:00 +0000] [4] [INFO] Listening at: http://0.0.0.0:54428 (4) 2021-07-27T21:26:00.094088+00:00 app[web.1]: [2021-07-27 21:26:00 +0000] [4] [INFO] Using worker: sync 2021-07-27T21:26:00.106699+00:00 app[web.1]: [2021-07-27 21:26:00 +0000] [9] [INFO] Booting worker with pid: 9 2021-07-27T21:26:00.157630+00:00 app[web.1]: [2021-07-27 21:26:00 +0000] [10] [INFO] Booting worker with pid: 10 2021-07-27T21:25:59.000000+00:00 app[api]: Build succeeded 2021-07-27T21:26:06.266840+00:00 app[web.1]: 10.43.228.207 - - [27/Jul/2021:21:26:06 +0000] "POST / HTTP/1.1" 200 10697 "-" "-" 2021-07-27T21:26:06.267235+00:00 heroku[router]: at=info method=POST path="/" host=tlgrmbotgym.herokuapp.com request_id=a7b1fd84-93d2-4fdb-88cd-941dd581b4c1 fwd="91.108.6.98" dyno=web.1 connect=0ms service=37ms status=200 bytes=10924 protocol=https and this is how I setup the webhook in bot.py mode = os.environ.get("MODE", "polling") if mode == 'webhook': # enable webhook updater.start_webhook(listen="0.0.0.0", port=PORT, url_path=TOKEN) updater.bot.setWebhook('https://tlgrmbotgym.herokuapp.com/'+TOKEN) else: # enable polling updater.start_polling() updater.idle() -
My data from my model is not showing up on my webpage through templates
I am trying to show the data on the webpage but I am not able to figure out why the data is not populated on the webpage my model is this class Staff(models.Model): staffid = models.BigAutoField(primary_key=True) firstname = models.CharField(max_length=20) lastname = models.CharField(max_length=20) phonenumber = models.CharField(max_length=15, unique=True) def __str__(self): return self.firstname def staff_name(self): return "{} {}".format(self.firstname, self.lastname) def get_absolute_url(self): # new return reverse('staffdetail', args=[str(self.staffid)]) my views for this is class StaffListView(ListView): model = Staff template_name = 'staffview.html' and the template is {% extends 'base.html' %} {% block content %} <p><a href="{% url 'staffnew' %}">Add a new Staff member</a></p> {% if staff %} There are {{ staff|length }} records: {% for s in staff %} <div class="client-entry"> <p><a href="{% url 'staffdetail'%}">{{ s.staffid }}</a></p> </div> {% endfor %} {% else %} There are no staff in the system {% endif %} {% endblock content %} The output on the web page just gives me the else statement. I checked in Django admin and found that there is data in the staff table. Not sure what I am doing wrong. Any help would be appreciated. -
Having trouble to get the total price of the basket's items (Django)
So I'm trying to get the total amount of the basket but having trouble doing so. Am I calling it wrong? I'm new so... Html(here is the way i calling it): <p>Total:{{basket.get_basket_total}}</p> models: class Products(models.Model): products_name = models.CharField(max_length=30) pub_date = models.DateTimeField(auto_now=True) price = models.DecimalField(max_digits=5, decimal_places=2) note = models.CharField(max_length=200) inventory = models.IntegerField(default=1) product_pic = models.ImageField(upload_to ='images/', default='images/broken/broken.png') def __str__(self): if (self.inventory<=0): return self.products_name + ' (Out of Stock)' return self.products_name class Basket(models.Model): products = models.ForeignKey(Products, on_delete=models.SET_NULL, null=True, blank=True) pub_date = models.DateTimeField(auto_now=True) amount = models.IntegerField(default=1) def __str__(self): return str(self.products) @property def get_total(self): total = self.products.price * self.amount return total @property def get_cart_total(self): basket_items = self.basket_set.all() total = sum([item.get_total for item in basket_items]) return total -
Cannot send Django sampling to XRAY on aws
I have a EC2 instance, with XRAY daemon installed in it. Also, policy AWSXRayDaemonWriteAccess is attached to the role. Simple Django application deployed to EC2, with default xray configuration. In the application logs I see: File "/usr/local/lib/python3.9/site-packages/botocore/httpsession.py", line 352, in send raise EndpointConnectionError(endpoint_url=request.url, error=e) botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "http://127.0.0.1:2000/GetSamplingRules" I have the following configurations in django app: XRAY_RECORDER = { 'AWS_XRAY_CONTEXT_MISSING': 'LOG_ERROR', 'AWS_XRAY_TRACING_NAME': 'My application', 'PLUGINS': ('EC2Plugin', 'ECSPlugin'), } Why the application fails to connect to Xray daemon? -
Django get access to foreign key of current object in views.py
I have three models: Class Collection(models.Model): var_1 = ..... var_2 = .... Class Titles(models.Model): var_a = models.ForeignKey(Collection, related_name="has_titles", on_delete=models.CASCADE) var_b = ... Class OtherObject(models.Model): var_x = models.ForeignKey(Collection, related_name="has_other_object", on_delete=models.CASCADE) var_y = ... In views.py I use CBV DetailView with a form in it (using then formMixin or MultipleFormsMixin, but this is not the point). So basically each Title is linked to a Collection by a ForeignKey and each OtherObject is linked to a Collection by a ForeignKey as well. So, when the user is in a detail page of Title model, he has the posibility to fill in a form to add a OtherObject, that will then be displayed on the Collection detailView that is linked to the Title. In other words, what I want is var_x = var_a of current Title : if form.is_valid(): new_other_object = form.save(commit=False) new_other_object.var_x = HERE I WANT TO GET var_a OF CURRENT OBJECT new_fact.save() So, as Title has a ForeignKey containing the ID to Collection it belongs to, I tried to use things such as self.get_object(). I read things such as using self.get_object().var_a could work but with all the different solutions I tried I got errors, mainly the error mentionning that object must be … -
using (post) request from frontend to trigger Django script on backend
Pretty new to Django (and fullstack), thanks for help! Objective: My basic need is to be able to have React (or any frontend) communicate/trigger a django script from within frontend, (and eventually get the results back into frontend after the script runs). I have created the following code to create this utility, if you have a totally different way to achieve this objective, feel free to inform me regardless of code below. Approach: I THINK I need to structure the view in views.py to trigger when it receives a post/get request and then send the data to the source of the request. I tried using @require_POST by importing django.views.decorators.http. From my understanding this means it will ONLY except post requests, and run if the trigger is a post request. When I post to the url I get a 404 error, but when I comment out @require_POST and throw in a return HttpResponse the website loads fine. I also have a working django restapi via restapi_framework (which I need for other purposes) and I have made successful get requests to it. I am happy to use this part of the app/views if it'll help me. (parts of) my Code: I am … -
Django Haystack and Whoosh: How do I store the whoosh index created on Amazon S3?
I'm a newbie trying to build a website and have deployed it onto heroku. I have incorporated a search function using Django haystack and whoosh. I noticed that my search function fails because heroku wipes the search indexes created during its daily dynos restart. With that being said, I'm looking for ways to save the search index on amazon s3 such that the search index will be preserved beyond 24 hours. Is anyone familiar with this and is able to guide me through the process? Thank you very much for your help!!