Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Rendering html page not working
I'm trying to build a basic website using this tutorial http://www.oliverelliott.org/article/computing/script_airapp/ and I've managed to create a homepage where users will input their own figures, but when I try to submit to get to the results page it does not work. def formview(request): if request.method == 'POST': form = MyCalculator(request.POST) if form.is_valid(): parents = form.cleaned_data['parents'] jobs = form.cleaned_data['jobs'] grants_bursaries_scholarships = form.cleaned_data['grants_bursaries_scholarships'] student_loan = form.cleaned_data['student_loan'] other_income = form.cleaned_data['other_income'] rent = form.cleaned_data['rent'] travel = form.cleaned_data['travel'] bills = form.cleaned_data['bills'] other_outcome = form.cleaned_data['other_outcome'] if ( Calculator.objects.filter(parents=parents).exists() and Calculator.objects.filter(jobs=jobs).exists() and Calculator.objects.filter(grants_bursaries_scholarships=grants_bursaries_scholarships).exists() and Calculator.objects.filter(student_loan=student_loan).exists() and Calculator.objects.filter(other_income=other_income).exists() and Calculator.objects.filter(rent=rent).exists() and \ Calculator.objects.filter(travel=travel).exists() and Calculator.objects.filter(bills=bills).exists() and Calculator.objects.filter(other_outcome=other_outcome).exists()): myparents = Calculator.objects.get(parents=parents).get_parents myjobs = Calculator.objects.get(jobs=jobs).get_jobs mygrants_bursaries_scholarship = Calculator.objects.get(grants_bursaries_scholarships=grants_bursaries_scholarships).get_grants mystudent_loan = Calculator.objects.get(student_loan=student_loan).get_studentloan myother_income = Calculator.objects.get(other_income=other_income).get_otherincome myrent = Calculator.objects.get(rent=rent).get_rent mytravel = Calculator.objects.get(travel=travel).get_travel mybills = Calculator.objects.get(bills=bills).get_bills myother_outcome = Calculator.objects.get(other_outcome=other_outcome).get_otheroutcome mytotal_income = total_income(myparents, myjobs, mygrants_bursaries_scholarship, mystudent_loan, myother_income) myfixed_outcome = fixed_outcome(myrent, mytravel, mybills, myother_outcome) myvariable_outcome = variable_outcomes(mytotal_income, myfixed_outcome) myfood = food(myvariable_outcome) mysocialising = socialising(myvariable_outcome) return render(request, 'Noteable_Budgeting/out.html', {'food1':myfood}, {'socialising1': mysocialising}) else: return HttpResponseRedirect('Noteable_Budgeting/fail/') else: form = MyCalculator() return render(request, 'Noteable_Budgeting/calculator_list.html', {'form':form}) I cant get to the Noteable_Budgeting/out.html page. -
Filter objects in admin
I have models Group and Membership. In admin page I want to show members of group who has specific role. How to make it? By default admin right now show me all members of group. models.py: class Group(models.Model): members = models.ManyToManyField(User, through='Membership',) class Membership (models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE,) project = models.ForeignKey(Project, on_delete=models.CASCADE) role = models.CharField(max_length=20, choices=ROLE_CHOICES,) admin.py: class MembershipInline(admin.TabularInline): model = Membership form = MembershipAdminForm extra = 1 max_num = 1 class MembershipAdmin(admin.ModelAdmin): inlines = (MembershipInline,) admin.site.register(Group, MembershipAdmin) -
How to use enum in Django with special characters
I am using enum34 package like described here. Here is the example used in article: from common.utils import ChoiceEnum class StudentTypes(ChoiceEnum): freshman = 0 sophomore = 1 junior = 2 senior = 3 # within your models.Model class... student_type = models.CharField(max_length=1, choices=StudentTypes.choices()) However, in my enum field I would like to have use : (such as 16:9). Is there a way to do this? -
Pass value into {{ form.Product_ID }} in HTML Django
i use the {{ form.Product_PId }} to make this field is there anyway to pass this value {{ Product.PId }} where the PId is a primary key from another database and be like this <input id="id_Product_ID" min="0" name="Product_ID" type="number" value="{{Product.PId}}" required=""> so that the end result would be like <input id="id_Product_ID" min="0" name="Product_ID" type="number" value="1" required=""> **to sum up the question is there a way to pass {{ Product.PId }} into {{ form.Product_PId }} so that the {{ Product.PId }} value could turn into usable number taken from another database** reference forms.py class PlaceOrder(forms.ModelForm): class Meta: model = Order fields = ["Product_ID","HowMany","DateSubmit",] HTML {% for Product in Display_Product %} <form method="post" action="" id="CartInput"> {% csrf_token %} <div> {{ CartForm.Product_ID }} {{ CartForm.HowMany }} {{ CartForm.DateSubmit }} </div> <div> <input name="Cart{{ Product.PId }}" type="submit" value="Add to Cart"> </div> </form> {% endfor %} views.py class Catalogue(generic.ListView, ModelFormMixin): template_name = 'Shop/Catalogue.html' model = models.Order form_class = forms.PlaceOrder def get(self, request, *args, **kwargs): Display_Product = Product.objects.all() now = datetime.datetime.now() *** tried this one but failed, it just pass in the string {{Product.PId}} and not turn into number *** form = PlaceOrder(initial= {'Product_ID': "{{Product.PId}}"}) context = { 'form': form, 'date': now, 'Display_Product': Display_Product } return … -
Django: generate a CSV file and store it into FileField
In my Django View file, I need to generate a CSV file from a list of tuples and store the CSV file into the FileField of my model. class Bill(models.Model): billId = models.IntegerField() bill = models.FileField(upload_to='bills') I searched on this site, and found some posts such as Django - how to create a file and save it to a model's FileField?, but the solutions can help me. I need the CSV file to be stored in 'media/bills/' fold, and I hope the CSV file can be deleted together with the Bill object in the database. I tried the following codes; path = join(settings.MEDIA_ROOT, 'bills', 'output.csv') print path f = open(path, 'w+b') f.truncate() csvWriter = csv.writer(f) csvWriter.writerow(('A', 'B', 'C')) for r in rs: print r csvWriter.writerow(convert(r)) bill = Bill() bill.billId = 14 bill.bill.save('output.csv', File(f)) bill.save() Thanks -
How can I create pdf file from easy_pdf in django in new window?
In my view I return my content to pdf file return render_to_pdf_response(request, 'lease/pdf_lease_extension.html', {'data': data}) my html template is rendered into pdf file based on easy pdf {% extends "easy_pdf/base.html" %} Right now when I generate pdf it always generates in same browser window. How I can open pdf in different new windows each time? -
second drop down box is not updating depending on value selected in first drop down box django
I have two drop down boxes in my django form, The first drop down box contains the makes of cars (audi,BMW) , the second drop down box contains the different models eg audi A1. I am trying to dynamically update the second drop down box depending on what the user selects in the first drop down box. I am trying to use jquery and ajax to do this, the problem I am having is passing the kwargs to my second drop down box. view def chose_car_make_model(request): if 'car' in request.GET: car_id = request.GET['car'] car_model_id = CarModel.objects.filter(id=car_id) form = ChoseCarMakeModelForm(request.POST,ids=car_model_ids) return render( request, template_name = 'form.html', dictionary = { 'form':form, } ) else: if request.method == "POST": form = ChoseCarMakeModelForm(request.POST) if form.is_valid(): car_model = form.cleaned_data['car_model'] car_make = form.cleaned_data['car_make'] car = CarOwner( car_model = car_model, car_make = car_make owner = request.User ) # Go to the next form in the process. return redirect('view_car') #return render(request, 'riskregister/menus/riskregister_index.html') # Initial form else: form = ChoseCarMakeModelForm() return render( request, template_name = 'form.html', dictionary = { 'form':form, } ) forms.py class ChoseCarMakeModelForm(forms.Form): car_makes = forms.ModelChoiceField( queryset=CarMake.objects.all().order_by('name'), label = "Make:", widget = Select(attrs={'class': 'span6 small-margin-top small-margin-bottom'}), empty_label = "Select a make of car", required=True ) car_model = … -
Python/django error: 'myapp' is not a registered namespace
I am facing a very unusual problem. I've registered the namespace myapp using app_name in my main project's urls.py file like this: app_name = 'myapp' I'm writing a view where the user registers and is redirected to the homepage. However, when I'm using the redirect function in myapp's views.py file like this: return redirect('myapp: index') I'm getting the following error after clicking the registration form's submit button: NoReverseMatch at / 'myapp' is not a registered namespace I tired looking for a solution but to no avail. Help please :) -
Django create new record instead of updating
I have the following model class FooBar(models.Model): FOOBAR_ID = models.AutoField(primary_key=True) foo = models.CharField(max_length=255) bar = models.CharField(max_length=255) Moreover, I have created a form that allows me to edit existing instances of FooBar. I would like to update the existing record when foo is changed, but create a new record when bar is changed. I figured a good way to go would be to override the save method, as it would avoid having to do extra queries on the database, which I have done by adding the following to my FooBar model. __original_bar = None def __init__(self, *args, **kwargs): super(FooBar, self).__init__(*args, **kwargs) self.__original_bar = self.bar def save(self, force_insert=False, Force_update=False, *args, **kwargs): if self.bar != self.__original_bar: super(FooBar, self).save(force_insert=True, force_update=False, *args, **kwargs) self.__original_bar= self.bar else: super(FooBar, self).save(force_insert=False, force_update=True, *args, **kwargs) When I update foo everything works fine, but when I update bar the following error is displayed: Key ("FOOBAR_ID")=(2) already exists. I am apparently entirely wrong on what force_insert does. How can I force it to create a new record in save? -
FATAL: password authentication failed for user "root" postgresql
i dont speak E well. I use postgresql for django (format heroku) and have error FATAL: password authentication failed for user "root". i changed pg_hba.conf but not success **On terminal** ` "Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line utility.execute() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv self.execute(*args, **cmd_options) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute output = self.handle(*args, **options) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/core/management/commands/makemigrations.py", line 109, in handle loader.check_consistent_history(connection) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 276, in check_consistent_history applied = recorder.applied_migrations() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 65, in applied_migrations self.ensure_schema() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/migrations/recorder.py", line 52, in ensure_schema if self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()): File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 233, in cursor cursor = self.make_cursor(self._cursor()) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 204, in _cursor self.ensure_connection() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection self.connect() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection self.connect() File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 171, in connect self.connection = self.get_new_connection(conn_params) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection connection = Database.connect(**conn_params) File "/home/jet/Desktop/DJango/chatbot/local/lib/python2.7/site-packages/psycopg2/__init__.py", line 164, in connect conn = _connect(dsn, connection_factory=connection_factory, async=async) django.db.utils.OperationalError: FATAL: password authentication failed for user "root" "` pg_hba.conf # Database administrative login by Unix domain socket local all postgres md5 # TYPE … -
(DJANGO - NginX + Unicorn) Deployment not properly working
I'm trying to put my django app online on a VPS. I tried following several different tutorials but I could not get it to work... WHAT I'VE ACHIEVED ALREADY : I got DJANGO's DevServ running on my VPS and I was able to browse my app using the VPS' IP address (the static files didn't correctly show up, error 404 104, and I only saw the HTML content without background/css or anything else). I got NGINX running on my VPS and I was able to browse to its' default homepage (gunicorn was running at the time but the requests didn't get properly forwarded from NGINX to GUNICORN I believe). I got GUNICORN running my app on my VPS with the command below. Here's how I launch GUNICORN : gunicorn MySite.wsgi:application [2017-03-12 08:54:47 +0000] [1054] [INFO] Starting gunicorn 19.7.0 [2017-03-12 08:54:47 +0000] [1054] [INFO] Listening at: http://127.0.0.1:8000 (1054) [2017-03-12 08:54:47 +0000] [1054] [INFO] Using worker: sync [2017-03-12 08:54:47 +0000] [1059] [INFO] Booting worker with pid: 1059 And here is my NGINX configuration file which I named to match my domain name without the ".eu" (even though right now I'm trying to get it to work with the actual IP address). I … -
Ckeditor box margin is causing overflow in Django admin
I downloaded the latest version of CKEditor and added to my admin view using THIS guide. Everything went straightforward but the textbox in admin site is not aligned right: I guess it is a CSS problem. When I changed the margin of .cke_reset from the inspect window it sort of becomes as I wanted: One comment in the page linked above looks related to this problem but it did not make any difference. I'm not expert in CSS or Django at all, and cannot be sure about the source of the problem. Any insight will be helpful. Note: I prefer not to use django-ckeditor package. -
How to manually make field in HTML? Django
in forms.py class PlaceOrder(forms.ModelForm): class Meta: model = Order fields = ["Product_ID","HowMany","DateSubmit",] to call a form i usually use {{ Form }} that will render the form automatically but is it possible to make it manually? for example i want the form to be exactly like this <input id="Product_ID" type="hidden" value="{{ Product.PId }}" > <input id="HowMany" type="text"> <input id="DateSubmit" type="hidden" value="{{ date }}" > i have tried wrapping them in {% for field in form %} but it gave the wrong output Sorry if this is confusing but i don't really know how to explain it, i am still new to Django -
How can I create a button for a django admin action?
I have a django admin action say "refresh", I want to add a refresh button for each row in the admin list view. I can create button using format_html but how can I invoke "refresh" action when it is pressed? -
Key Error in celery task
[2017-03-12 19:24:00,005: ERROR/MainProcess] Received unregistered task of type u'auto'. The message has been ignored and discarded. Did you remember to import the module containing this task? Or maybe you're using relative imports? Please see http://docs.celeryq.org/en/latest/internals/protocol.html for more information. The full contents of the message body was: '[[], {}, {"chord": null, "callbacks": null, "errbacks": null, "chain": null}]' (77b) Traceback (most recent call last): File "/Library/Python/2.7/site-packages/celery/worker/consumer/consumer.py", line 559, in on_task_received strategy = strategies[type_] KeyError: u'auto' -
Need Assistane in converting django model admin save method to Django Rest Framework
I need assistance in converting below save_model method on Django Rest Framework I have this method on my earlier django model admin Existing ModelAdmin class JobCategoryAdmin(admin.ModelAdmin): exclude = ('remote_addr',) list_display = ['job_category','updated_by','updated_at','created_by','created_at','remote_addr',] save_as = True def save_model(self, request, obj, form, change): if change: #When update obj.updated_by = request.user obj.updated_at = datetime.now() obj.remote_addr = request.META['REMOTE_ADDR'] else: #When Create obj.created_by = request.user obj.created_at = datetime.now() obj.updated_by = request.user obj.remote_addr = request.META['REMOTE_ADDR'] obj.save() I need to apply this on my DRF method. Currently I am doing like this. Serializer class JobCategorySerializer(serializers.ModelSerializer): class Meta: model = JobCategory fields = ('job_category', ) def create(self,validated_data): obj = JobCategory.objects.create(**validated_data) obj.created_by = self.context['request'].user obj.updated_by = self.context['request'].user obj.remote_addr = self.context['request'].META['REMOTE_ADDR'] obj.save() return obj def update(self,instance,validated_data): obj = instance obj.job_category = validated_data.get('job_category', obj.job_category) obj.updated_by = self.context['request'].user obj.remote_addr = self.context['request'].META['REMOTE_ADDR'] obj.save() return obj Here I am not comfortable with update because I need to pass all the data once again which I do not do in my existing modelAdmin method of save_model. Example ob_category field when i update from X to Y I do not want to call this in my update method. When it is one field it is still acceptable, but if I need to do for a model … -
To do list in django: Saving entry in database by pressing enter with the keyboard
I've got a simple to do list. When I am entering a task, I don't want to open a form and save the task like I used to do. I've added a text box and have added an Add task button near to it. But for the moment, this doesn't do anything. I am trying to work out how can I add the task by simply pushing button(Add task) and in the same time by pressing the enter button. views.py def add_item(request, project_id, list_id): project = get_object_or_404(Project, pk=project_id) projects_items = project.item_set.all() item.project = project item.save() return render (request,"todolist/all_items.html", {'project': project}) In my html file, I've added the button this way... template.html <form action="{% url 'todolist:add_item' project.id item.id %}" method="post" style="display: inline" enctype="multipart/form-data"> {% csrf_token %} <input name="item" value="{{project}}" placeholder="Add things need to do ..." type="text" class = "form-control"> </input> </div> <button type="submit" class="btn btn-primary "> <span class="glyphicon glyphicon-plus"></span>&nbsp;Item </button> </form> -
Generate a unique key after refresh Django Admin form
I'm using Django Admin capabilities to add to a model a randomly generated password. However, doing refresh to the admin's form page or after clicking "Save and add another" this random password doesn't change. How do i force Django to re-generate a fresh password? def generate_rand(): random_bytes = urandom(64) return b64encode(random_bytes).decode('utf-8') class SubClient(models.Model): client = models.ForeignKey(Client, models.SET_NULL, blank=True, null=True, verbose_name=_('Organization name'),) name = models.CharField(max_length=150, verbose_name=_('End-Client name'),) db_password = models.CharField(max_length=255, default=generate_rand()) -
Django1.10 automatic logout
I have used included codes as shown below for automatic logout after 5 minute. but i am getting error File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", li ne 82, in load_middleware mw_instance = middleware(handler) TypeError: this constructor takes no arguments my code In settings.py SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer' In middleware.py from datetime import datetime, timedelta from django.conf import settings from django.contrib import auth class AutoLogout: def process_request(self, request): if not request.user.is_authenticated() : #Can't log out if not logged in return try: if datetime.now() - request.session['last_touch'] > timedelta( 0, settings.AUTO_LOGOUT_DELAY * 60, 0): auth.logout(request) del request.session['last_touch'] return except KeyError: pass request.session['last_touch'] = datetime.now() In settings.py: MIDDLEWARE_CLASSES = [ ......................... 'app_name.middleware.AutoLogout', ] Auto logout delay in minutes AUTO_LOGOUT_DELAY = 5 #equivalent to 5 minutes -
Django REST or simple Django for REST API
I would like to know if it is possible to build a REST Api using only Django (Django REST). I have following code in my views.py using only Django (without REST) from django.http import HttpResponse, JsonResponse def get_something(request, object = None): dummyDict = {'Debug':object} return JsonResponse(dummyDict) ulrs.py url(r'^(?P<object>\w{1,50})$', views.get-something, name = "get-something"), Can this work as REST API? I tried testing using curl and I get following answer from my django server: HTTP/1.0 200 OK Date: Server: X-Frame-Options: Content-Type: application/json {"Debug": daodoaw} -
UnicodeDecodeError with Python2.7, ImportError: no module named html.entities with Python 3.4
The problem is this: my project on hosting does not work as it should. What we have: two environments with the same set of modules - one on python 2.7, another on 3.4. project site (link to github): https://github.com/Sibiryakanton/site_NL If index.wsgi connects the path to django in 2.7, the site is displayed, but there are no css styles. Link: http://j-star.ru/ Also, I can not give the python command manage.py migrate - it produces an error: UnicodeDecodeError: 'ascii' codec can not decode byte 0xd0 in position 0: ordinal not in range (128). If I connect django from the environment with 3.4, the migration is fine, but the error is ImportError: no module named html.entities. I understand, this is due to BeautifulSoup4 and opening py-files "pythons" of the wrong versions. Correct, if I made a mistake. Actually, the question: what should I do? Just in case, I attached the code index.wsgi: import os, sys Sys.path.append ('/ home / c / cc54094 / django / public_html / site_NL') Sys.path.append ('/ home / c / cc54094 / virtualenv-1.11.6 / env-2 / lib / python2.7 / site-packages /') Os.environ ['DJANGO_SETTINGS_MODULE'] = 'project_nl.settings' Import django Django.setup () Import django.core.handlers.wsgi Application = django.core.handlers.wsgi.WSGIHandler () -
Django Web Application Architecture
I am currently planning the development of a large scale Django web application to make it easier to conduct systematic reviews in software engineering. For those who are unaware, a systematic review aims to examine and interpret all of the literature around a topic. It consists of two main stages: Title (& Abstract) Screening Full-text screening During the first stage, all of the articles are screened by 2 humans and classed as included or excluded based on the articles title or abstract. Then, if the article is marked as included it's full text is reviewed by 2 humans and again classed as either included or excluded. In my web application each customer, dependent on subscription type, will be able to conduct a number of systematic reviews. For each systematic review, they will be able to add two users. Each user can only be involved in the systemic reviews of a single customer. Each systematic review will consist of several thousand references (ranging from 1,000 to 20,000). Each reference will have a number of different attributes (20) and a PDF document associated with each. To reduce the burden of screening, machine learning (in Python) will be used to semi-automate queries. General … -
Invalid Endblock tag in django
I am receiving an error message when I go to one of my pages in my Django project, as it is saying that the End-block tag is invalid (asks whether I remembered to register or load). The error looks like this: My code for this template - (login.html) - is below: {% extends "learning_logs/base.html" %} {% block content %} <p><a href="{% url 'learning_logs:topic' topic.id %}">{{ topic }}</a></p> <p>Add a new entry:</p> <form action="{% url 'learning_logs:new_entry' topic.id %}" method="post"> {% csrf_token %} {{ form.as_p }} <button name="submit">add entry</button> </form> {% endblock content %} I am very confused, and I am wondering whether anyone knows what the problem is? Thanks Milo -
Tastypie ApiKeyAuthentication with ajax
I have an issue: Resource: class EntityResource(ModelResource): class Meta: queryset = Entity.objects.all() resource_name = 'entity' allowed_methods = ['get', 'patch', 'put', 'post', 'option'] authorization = Authorization() authentication = ApiKeyAuthentication() requests work good: requests.get('http://localhost:8000/api/v1/entity', headers={"Authorization": "ApiKey apiuser:648e7c06e795d5fcdf8744173ddeef04381f671f"}) <Response [200]> and now, I want use an ajax request ot add new entity: $.ajax({ url: 'http://localhost:8000/api/v1/entity/', type: 'POST', contentType: 'application/json', beforeSend: function(jqXHR, settings) { // Pull the token out of the DOM. jqXHR.setRequestHeader('X-CSRFToken', tok = $('input[name=csrfmiddlewaretoken]').val()); jqXHR.setRequestHeader('Authorization', 'ApiKey apiuser:648e7c06e795d5fcdf8744173ddeef04381f671f'); }, data: data, dataType: 'json', processData: false }); But I get POST http://localhost:8000/api/v1/calculator/ 401 (Unauthorized) every time UPD: I am install and configure django-cors-headers to avoid No 'Access-Control-Allow-Origin' header is present -
Setting up ElastiCache Redis with Elastic BeanStalk + Django
Another stackoverflow answer says you need to set up a elasticache.config file to create Redis servers with ElastiCache automatically. However, can I just create a Redis instance on AWS (Elasticache) and add its endpoint into Django settings? Eg, with Django-redis: CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://<REDIS AWS ENDPOINT AND PORT HERE>", "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } } } I suspect the above could cause trouble with multiple beanstalk server instances. Given this, I am tempted to use MemCache and not Redis, given that there is a Django package written explicitly for interfacing with AWS Elasticache for Memcache: django-elasticache. Thanks, Andy.