Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
form.save() deletes all user data on one form field
I am trying to build a profile edit view in my Django app. However, I noticed a strange behavior. After editing the program field for my user model. After saving the form in the view using form.save() all my user data gets deleted. Meaning my username, first name, last name,.... all gets set to null. Below is my EditProfileForm: class EditProfileForm(UserChangeForm): username = forms.CharField( max_length=255, min_length=1, required=False, validators=[username_regex], widget=forms.TextInput( attrs={ "placeholder": "Username", "class": "form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ) ) first_name = forms.CharField( max_length=255, min_length=1, required=False, validators=[alphanumeric], widget=forms.TextInput( attrs={ "placeholder": "First name", "class": "form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ) ) last_name = forms.CharField( max_length=255, min_length=1, required=False, validators=[alphanumeric], widget=forms.TextInput( attrs={ "placeholder": "Last name", "class": "form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ) ) university = forms.ChoiceField( label='University', required=False, choices = UNIVERSITY_CHOICES, widget=MySelect( attrs={ "class":"form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ), ) email = forms.EmailField( required=False, widget=forms.EmailInput( attrs={ "placeholder": "Email", "class": "form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ) ) bio = forms.CharField( required=False, widget=forms.Textarea( attrs={ "placeholder":"Enter something about yourself", "class": "form-control mt-3", "rows":"5", } ) ) program = forms.CharField( required=False, widget=forms.TextInput( attrs={ "placeholder":"What are you studying?", "class": "form-control border-top-0 border-left-0 border-right-0 rounded-0 mb-2", } ) ) … -
How do I access a dictionary key in a contex variable that gets passed from a ListView to a template?
I want to access a dictionary key in a context variable that gets passed from a ListView to a template. Here is my views.py file: class ListJobListingsView(generic.ListView): template_name = 'employers/list_joblistings.html' model = JobListing context_object_name = 'joblistings_list' def get_queryset(self): object_list = JobListing.objects.filter(admin_approved=True).order_by('job_title')[:5] category = self.request.GET.get("category", None) job_title = self.request.GET.get("job_title", None) if category and not job_title: object_list = self.model.objects.filter() #TODO: make the query based on foreign key if job_title and not category: object_list = self.model.objects.filter(name__contains=job_title) if job_title and category: object_list = self.model.objects.filter(name__contains=job_title) #TODO: make the query based on foreign key return object_list def get_context_data(self, **kwargs): # Call the base implementation first to get a context context = super().get_context_data(**kwargs) # Add in a QuerySet of all the category choice context['categories'] = Category_JobListing._meta.get_field("category").choices return context Note how I have added the context['categories'] to my context in the get_context_data method. In my list_joblistings.html template, I have: {% if joblistings_list %} <form method="get" action="{% url 'employers:list_joblistings' %}"> <p>Filter by category:</p> <select name="category"> {% for key, value in joblistings_list.categories.items %} <option value="{{ key }}"> {{ value }} </option> {% endfor %} </select> <p>Search by job title: <input type="text" name="job_title"/></p> <p><input type="submit" name="Submit" value="submit"/></p> </form> <p> joblistings_list.categories.items = {{ joblistings_list.categories.items }} </p> <p> joblistings_list = {{ joblistings_list }} … -
Do you need a build tool for Django Application to use GitHub Actions?
I am new to Django/Github actions and wanted to know, if you need a build tool like PyBuilder/Setuptools/etc. to have a CI Pipeline with Github actions for a Python Django app, or is a virtual environment and pip enough? -
Gunicorn/GEvent + Django: Do I need some sort of pool?
I'm reading a few guides on setting Django up with Gevent and Gunicorn and everyone seems to touch on considering a pool like psyco_gevent. It's unclear to me if this is a requirement, so I wanted to get a definitive answer on this. If I'm running gunicorn like so with no other gevent usage: gunicorn --workers=4 --log-level=debug --timeout=90 --worker-class=gevent myapp.wsgi Do I need something like psyco_gevent? -
Django Authentication fails
I try to create the login page for my application but I can't authenticate the user no matter what I try for a week now. Here is my code: views.py from django.shortcuts import render, HttpResponseRedirect from django.urls import reverse from django.contrib.auth import login, logout, authenticate from django.db import IntegrityError from .models import User def login_view(request): if request.method == "POST": username = request.POST["username"] password = request.POST["password"] user = authenticate(request, username=username, password=password) if user is not None: login(request, user) return HttpResponseRedirect(reverse("index")) else: return render(request, "login.html", {"message": f"{user}"}) return HttpResponseRedirect(reverse("login")) else: return render(request, "login.html") models.py from django.db import models from django.contrib.auth.models import AbstractUser class User(AbstractUser): pass urls.py from django.urls import path from .views import index, login_view, register urlpatterns = [ path("", index, name="index"), path("login", login_view, name="login"), path("register", register, name="register") ] login.html {% extends "layout.html" %} {% block title %}Login{% endblock %} {% block content %} <div class="fluid-container"> <h3 id="header">Login</h3> {% if message %} <h4>{{ message }}</h4> {% endif %} <form method="post" class="form" action="{% url 'login' %}">{% csrf_token %} <div class="form-group"> <input class="form-control" type="text" name="username" placeholder="Username" /> </div> <div class="form-group"> <input class="form-control" type="password" name="password" placeholder="Password" /> </div> <div class="form-group"> <input class="btn btn-primary" type="submit" value="Login" /> </div> </form> <p>Don't have an account? <a href="{% url … -
Django 'method' object is not subscriptable
I have a problem with django, I get name from Html index page and after that ı want to request data. And after ı want to reach that data with gettin html name. from flask import Flask,render_template,request import requests api_key = "35c1fbfe2a35fd3aaf075e7394bf8855" url = "http://data.fixer.io/api/latest?access_key="+api_key app = Flask(__name__) @app.route("/" , methods = ["GET","POST"]) def index(): if request.method == "POST": firstCurrency = request.form.get("firstCurrency") # EURO secondCurrency = request.form.get("secondCurrency") # TRY amount = request.form.get("amount") #20 response = requests.get(url) #app.logger.info(response) infos = response.json firstValue = infos["rates"][firstCurrency] secondValue = infos["rates"][secondCurrency] result = (secondValue / firstValue) * float(amount) currencyInfo = dict() currencyInfo["firstCurrency"] = firstCurrency currencyInfo["secondCurrency"] = secondCurrency currencyInfo["amount"] = amount currencyInfo["result"] = result #app.logger.info(infos) return render_template("index.html",info = currencyInfo) else: return render_template("index.html") if __name__ == "__main__": app.run(debug = True) ı have a problem with firstValue = infos["rates"][firstCurrency] this line, why ? -
Conditional Django form validation
For a Django project, I have a customized User model: class User(AbstractUser): username = None email = models.EmailField(_('e-mail address'), unique=True) first_name = models.CharField(_('first name'), max_length=150, blank=False) last_name = models.CharField(_('last name'), max_length=150, blank=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['first_name', 'last_name'] objects = UserManager() def __str__(self): return self.email I'm creating a new user registration form: class UserRegistrationForm(forms.ModelForm): auto_password = forms.BooleanField(label=_('Generate password and send by mail'), required=False, initial=True) password = forms.CharField(label=_('Password'), widget=forms.PasswordInput) password2 = forms.CharField(label=_('Repeat password'), widget=forms.PasswordInput) class Meta: model = User fields = ('email', 'first_name', 'last_name', 'is_staff', 'is_superuser') def clean_password2(self): cd = self.cleaned_data if cd['password'] != cd['password2']: raise forms.ValidationError(_("Passwords don't match.")) return cd['password2'] My form has a auto_password boolean field. When this checkbox is set, the password and password2 fields must not be checked, as their content (or the absence of content) has no importance. On the opposite, when the auto_password checkbox is unset, the password and password2 must be checked. Is there a way to optionnally disable the Django form checks whenever needed? Thanks for the help. -
Django + Gunicorn + Gevent RecursionError
I'm running into a RecursionError with Django + Gunicorn + Gevent. My understanding is that my Gevent monkeyPatch is being called too late. Where should I call from gevent import monkey monkey.patch_all() If I'm running my django server with the following command? gunicorn --workers=4 --log-level=debug --timeout=90 --worker-class=gevent myapp.wsgi -
Django role permissions - available_permissions aren't automatically assigned to Group
I'm trying to use django-role-permissions but it doesn't assign available_permissions to Group nor to User. from rolepermissions.roles import AbstractUserRole class PERMISSIONS: CAN_SEE_ALL_INVOICES = 'can_see_all_invoices' CAN_SEE_OWN_INVOICES = 'can_see_own_invoices' class Admin(AbstractUserRole): verbose_name = 'Admin' available_permissions = { PERMISSIONS.CAN_SEE_ALL_INVOICES:True, } class Broker(AbstractUserRole): verbose_name = 'Maklér' available_permissions = { PERMISSIONS.CAN_SEE_ALL_INVOICES: False, PERMISSIONS.CAN_SEE_OWN_INVOICES: True, } After sync_roles I checked the admin and also tried to programmatically check the permission for the user that has Broker role and they doesn't have the permission. How is that possible? -
Flutter and Python - Smoothest way to combine as frontend and backend
for more complex applications written in Flutter, I would like to use Python as a backend. There is the pub.dev package starflut that looks promising but does not seem to have many applications. On the other hand, there seem to be attempts, to connect them via Python web - frameworks like flask (I) or flask (II) or Django. Since all of those options require some effort to be handled, I would like to know, what your choice and experiences with those attempts are. Best regards -
Why am I getting this error when I run my django project?
So I'm currently working on a Django project that has 2 models (Route and Address). The user can create a route using a route form and then add addresses that belong to the route they created using an address form. I have made a one-to-many relationship between the Route and Address models by adding the route's primary key as the address's foreign key. After successfully adding addresses that have a route_name as their foreign key, I want to print out on an HTML page all the addresses that have a common route_name so I did in by using a ListView in views.py that passes the route_name of addresses into the URL. and in urls.py I added a path that also has route_name of addresses as a parameter that is expected in the path. I have tried to do this in another part of my project where I view all the routes that were created by a user by passing the user's username and comparing it to Route's user and it worked. I will copy and paste all the pages for you to be able to see, I am having a problem with the RouteAddressListView that is in the bottom of … -
Error - (django-taggit) - 'post_list_by_tag' with arguments '('',)' not found
studying django, can't find a solution. added tags and the site gives an error studying django, can't find a solution. added tags and the site gives an error list.html <p class="tags"> Tags: {% for tag in post.tags.all %} <a href="{% url 'blog:post_list_by_tag' tag.slug %}"> {{ tag.name }} </a> {% if not forloop.last %}, {% endif %} {% endfor %} </p> ``` urls.py from django.urls import path from . import views app_name = 'blog' urlpatterns = [ # post views path('', views.post_list, name='post_list'), # path('', views.PostListView.as_view(), name='post_list'), path('<int:year>/<int:month>/<int:day>/<slug:post>/',views.post_detail,name='post_detail'), path('<int:post_id>/share/', views.post_share, name='post_share'), path('tag/<slug:tag_slug>/', views.post_list, name='post_list_by_tag'), ] -
Django how do i filter the difference between two filtered objects?
How do i get the difference between feedback and feedback2 ? here is my views.py. feedback = TrEmployeeSuppliersFeedbackQuestionsSubmittedRecords.objects.filter( fmCustomerID__company_name__in=company.values_list('fmCustomerID__company_name')).filter( fmCustomerEmployeeSupplierID__in=employee.values_list('id')).filter(id=id) feedback2 = TrEmployeeSuppliersFeedbackQuestionsSubmittedRecords.objects.filter( fmCustomerID__company_name__in=company.values_list('fmCustomerID__company_name')).filter( fmCustomerEmployeeSupplierID__in=employee.values_list('id')) nosubmit = TrEmployeeSuppliersFeedbackQuestionsSubmittedRecords.objects.\ filter(Q(dateSubmitted__in = feedback.values_list('dateSubmitted')) & Q(dateSubmitted__in = feedback2.values_list('dateSubmitted'))) -
Problem with ajax, does not show error block
Problem with ajax. I get json with views.py and how can I split it into success and error blocks? Right now there is always only one success block in my js file and I have to start the error block somehow. file views.py: def advert(request): if request.method == "POST": form = TestForm(request.POST) if(form.is_valid()): message={ 'status' : True, 'message': request.POST['number'], } else: message={ 'status' : False, 'message': "Error", } return JsonResponse(message) return render(request,'market/new_date.html',{'form':TestForm(request.POST)}) file valid.js: $('#form').submit(function() { // catch the form's submit event $.ajax({ // create an AJAX call... data: $(this).serialize(), // get the form data type: $(this).attr('method'), // GET or POST url: $(this).attr('action'), // the file to call success: function(data) { // on success.. console.log(data.message) }, error: function(data) { console.log('error') } }); return false; }); -
Django/Nginx - Static files not found
I'm trying to deploy a very simple Django app that uses VueJS with Webpack-Loader using Django-Webpack-Loader. I can run my app in local without any problem using manage.py runserver and npm run serve. Now i'm trying to deploy this simple app to DigitalOcean using Gunicorn and Nginx. The problem is that while i can see the standard templates being rendered by django, my Vue files are not loading and i only get a lot of errors, it loooks like the static folders are not being retrievede although i have a static directory: GET http://URL/static/vue/js/chunk-vendors.js net::ERR_ABORTED 404 (Not Found) GET http://URL/static/vue/js/index.js net::ERR_ABORTED 404 (Not Found) The full code of the application is HERE, it's not mine, i'm just running a simple example to get started. My static directory is located on django_vue_mpa>static Can anyone help me on this? I made sure to build my frontend for production using npm run build and i collected my static files using manage.py collectstatic, but i still get the error. Any kind of advice is appreciated. -
Django Reverse for 'setrefresh' not found. 'setrefresh' is not a valid view function or pattern name
I have a web page and on this webpage I have a button. I am trying to get it so that when the user clicks this button it will call an API endpoints and update the database model I have created. Please let me know if you need more info, I'm completely lost at the moment. sets.html {% block content %} <div class="background card"> <div class="card-body"> <button class="btn" id="setRefresh" style="border: 1px solid #555555; color: #555555" onclick="location.href={% url 'setrefresh' %}"><i class="fas fa-sync"></i></button> </div> </div> {% endblock%} views.py def sets(request): return render(request, "main/sets.html", {"Sets": Set.objects.all}) def setrefresh(request): try: response = requests.request("GET", "https://api.scryfall.com/sets") data = response.json() data = data["data"] for entry in data: s = Set() s.scry_id = entry["id"] s.code = entry["code"] s.name = entry["name"] s.set_type = entry["set_type"] s.release_date = entry["released_at"] s.card_count = entry["card_count"] s.digital_only = entry["digital"] s.foil_only = entry["foil_only"] s.nonfoil_only = entry["nonfoil_only"] s.icon = entry["icon_svg_uri"] s.status = 0 s.save() return HttpResponse("ok") except Exception: return HttpResponseBadRequest() urls.py urlpatterns = [ path('', views.dashboard, name="dashboard"), path('sets', views.sets, name="sets"), path('cards', views.cards, name="cards"), url(r'^setrefresh/', views.setrefresh, name='setrefresh'), ] -
Bootstrap Modal popup and Django
I'm new to django/bootstrap and currently i'm practising by using an html/css/js template which i downloaded from the internet. I rendered the template with django successfully by following a tutorial. Now i want to configure Login/Register to learn Django authentication. Now when i press Login/Register button (picture1) a popup is displayed. I tried to render loginregister page. <li class="list-inline-item list_s"><a href="{% url 'loginregister' %}" class="btn flaticon-user" data-toggle="modal" data-target=".bd-example-modal-lg"> <span class="dn-lg">Login/Register</span> I've created a views.py file, configured the urls.py file and created an html file in order to display my page and not the popup but unsuccessfully the popup is always displayed. I've configured the following: index.html file <!-- Responsive Menu Structure--> <!--Note: declare the Menu style in the data-menu-style="horizontal" (options: horizontal, vertical, accordion) --> <ul id="respMenu" class="ace-responsive-menu text-right" data-menu-style="horizontal"> <li> <a href="#"><span class="title">Manage Property</span></a> </li> <li> <a href="#"><span class="title">Blog</span></a> </li> <li class="last"> <a href="{% url 'contact' %}"><span class="title">Contact</span></a> </li> <li class="list-inline-item list_s"><a href="{% url 'loginregister' %}" class="btn flaticon-user" data-toggle="modal" data-target=".bd-example-modal-lg"> <span class="dn-lg">Login/Register</span></a></li> <li class="list-inline-item add_listing"><a href="#"><span class="flaticon-plus"></span><span class="dn-lg"> Create Listing</span></a></li> </ul> </nav> </div> </header> <!-- Main Header Nav Ends --> <!-- Login/Register Starts --> <!-- Modal --> <div class="sign_up_modal modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-lg" role="document"> <div … -
changing models.integerfield() using ajax
it doesn't work even when i put a number for testing in front of device.degree in views.py. its my input and submit button : <div class="col-log-7 px-5 pt-7"> <p>Rooms tempreture:</p> <input type="number" placeholder="degree"> <button type=submit text="submit degree" onclick=update_degree()> </div> ajax : function update_degree() { if (window.XMLHttpRequest) { // code for modern browsers xhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("POST", "degree", true); xhttp.send(); }; urls.py : path('degree',views.degree_views,name='degree'), views.py : @csrf_exempt def degree_views(request): device = Device.objects.get(id=1) device.degree = 10 device.save() return HttpResponse() can anyone tell me what should i do ? -
Django migrate showing Operations to perform instead of performing migration in Django v3.1
I had started to upgrade an old web application from django v2.7 to django v3.1 for my academic purpose. manage.py migrate. Then it showed some successful migration. Then I created a super user by manage.py createsuperuser and tried to login to admin. But after entering the successful credential, it showed an 500 server error. I found that admin migration not yet performed. Then I tried manage.py migrate admin,Then the output like this Operations to perform: Apply all migrations: admin Running migrations: No migrations to apply. I tried many result mentioned in different blogs and forums, but did not work. So I am wondering whether it is applicable to django v3.1. Could anyone help me. -
Django: Pass arguments from other form to submit button
I'm building a simple Django app that lets users track stuff for specific days: It records entries with a name and a date using the upper form. <form action="" method="post" style="margin-bottom: 1cm;"> {% csrf_token %} <div class="form-group"> {{ form.entry_name.label_tag }} <div class="input-group"> <input type="text" class="form-control" id="{{ form.entry_name.id_for_label }}" name="{{ form.entry_name.html_name }}" aria-label="new entry field"> {{ form.entry_date }} <div class="input-group-append"> <button type="submit" class="btn btn-primary">Add</button> </div> </div> <small id="{{ form.entry_name.id_for_label }}Help" class="form-text text-muted">This can be anything you want to track: An activity, food, how you slept, stress level, etc.</small> </div> </form> Below the form, there are quick add buttons that let users quickly add a new entry with a specific name. In addition, I'd like to use the date selected in the form above. I.e., if a user sets a date in the upper form but then clicks one of the suggested buttons, it should still use the selected date for adding the new entry. This is what the code for the suggested buttons currently looks like: {% if entry_counts and entry_dict|length > 0 %} <div class="card" style="margin-bottom: 1cm;"> <div class="card-body"> <div class="card-title">Suggested entries</div> {% for name, count in entry_counts.items %} <form method="post" action="{% url 'app:add_entry_with_date' name form.entry_date.value %}" style="display: inline-block;"> {% … -
Django - Selenium - How to brake connection after one iteration of task?
I have simple Django app with integrated Selenium websrcraping. Purpose of app - to fetch images from Reddit and save URLs in database. Task is performed in intervals. My problem is following: First iteration of webscrapping task goes well, but all next are raising error. I am assume that is because previous connection is not aborted. I am using driver.quit() command, but it doesn't seem to work, apparently example of errors in console: urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x00000289D7ADF8B0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=62138): Max retries exceeded with url: /session/6a45df20c47126554c5ef365df554676/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000022678CE5D90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')) scrapping script: from selenium import webdriver from selenium.webdriver.chrome.options import Options from .models import Post from datetime import datetime from apscheduler.schedulers.background import BackgroundScheduler url2 = 'https://www.reddit.com/r/memes/new/' chrome_driver_path = 'C:/Dev/memescraper/memescraper/static/chromedriver' chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument(" - incognito") webdriver = webdriver.Chrome( executable_path=chrome_driver_path, options=chrome_options ) driver = webdriver def fetch_reddit(): driver.get(url2) meme = driver.find_elements_by_css_selector('[alt="Post image"]') memes = list() for m in meme: memes.append(m.get_attribute("src")) print(m.get_attribute("src")) driver.quit() for m in range(len(memes)): image = … -
Setting Django Allauth as ForeignKey
I'm building an online e-commerce using Django. I want to have my user to log in using social media ( like Facebook and Google). I'm already done doing this using Django Allauth. But the problem is, how can I make it to be foreignkey when placing an order ? Here is my code so far , views.py from django.db import models from django.contrib.auth import get_user_model from products.models import Products User = get_user_model() class Cart(models.Model): user = models.ForeignKey(User, on_delete = models.CASCADE, verbose_name = 'Customer') item = models.ForeignKey(Products, on_delete = models.CASCADE, verbose_name = 'Item') quantity = models.IntegerField(default=1) created = models.DateTimeField(auto_now_add=True) def __str__(self): return f'{self.quantity} of {self.item.title}' def get_total(self): return self.item.price * self.quantity class Meta: db_table = 'cart' class Order(models.Model): orderitems = models.ManyToManyField(Cart) user = models.ForeignKey(User, on_delete=models.CASCADE) ordered = models.BooleanField(default=False) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.user.username def get_totals(self): total = 0 for order_item in self.orderitems.all(): total += order_item.get_total() return total It gives me an error when adding items to cart. So how can I do this that wetehr the user is using the default django authentication or their 3rd party accoutn like facebook and google, it will work. -
Add cropper js to django template
I am new to web development. I am trying to learn django. I have managed to come so far. I want my user to upload picture and also be able to crop the picture while uploading. I dont have any problem with img uploading but the results i found for croping is too advanced for me i dont know how to implement them. I have found below example made in django but still couldnt understand the way it works to be able to add to my own project. Any help is appreciated. Please explain to me like i am 5. I am very new to Jquery, css and everything except python. Thanks https://github.com/adriancarayol/django-cropperjs -
nginx serve both django static files and react static files
Im recently trying to impement nginx to link up my django based backend and react based frontend. Here is my nginx config file: upstream api { server backend:8000; } server { listen 8080; location /api/ { uwsgi_pass backend:8000; include /etc/nginx/uwsgi_params; } location /admin/ { uwsgi_pass backend:8000; include /etc/nginx/uwsgi_params; } # ignore cache frontend location ~* (service-worker\.js)$ { add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; expires off; proxy_no_cache 1; } location / { root /var/www/frontend; try_files $uri /index.html; } location /static { alias /vol/static; } location /static/rest_framework/ { alias /vol/static; } } However, the issue is that my manage.py collect static will place the django static files into /vol/static however, my react build is in /var/www/frontend/ therefore when I try accessing the default / url, it returns a blank page. However, if i remove the location /static { alias /vol/static; } location /static/rest_framework/ { alias /vol/static; } It will serve my my django admin page without any css. How do i resolve this easily without putting both static files in the same directory? -
Heroku: R15 Error Memory quota vastly exceeded when loading large files
So I am new at deploying Heroku applications. I have built a django application that basically reads from a Machine Learning model (1.3GB). This model is stored as a variable via the pickle.load function: model = pickle.load(url_path) I need this model to be accessed frequently in the application. For example, each user has a the possibility to do a prediction over some stocks. When he uses the prediction functionality we will do basic operations on this ML model. After deploying the django application via Heroku, I receive the Heroku: R15 Error Memory quota vastly exceeded, that corresponds in time with the 'model=pickle.load(url_path)' operation. I believe it is expected since the model that will be stored as variable is 1.31GB and the dyno used has 512MB. I would need a way to use this variable frequently (maybe through a third party or anything else) without having to upgrade to Advanced/Enterprise dynos. This would be really appreciated. Kind regards, Marvin