Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django - Authenticate returns None despite AUTHENTICATION_BACKENDS
I try to make a login using a LoginView class. I just can't login. It always says that my password is wrong but it isn't (I checked it with check_password()). I already set AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend'] in my settings.py. Here's my clean function in my custom AuthenticationForm: def clean(self): cleaned_data = self.cleaned_data username = cleaned_data.get("username") password = cleaned_data.get("password") user = authenticate(username=username, password=password) print(user) print(username) print(password) try: us = User.objects.get(username=username) print(us) print(us.check_password(password)) # This returns True!!! except ObjectDoesNotExist: pass if user is not None: if not user.is_active: raise forms.ValidationError("Dieser Account ist deaktiviert. Du kannst ihn über deine E-Mail aktivieren.") else: raise forms.ValidationError("Falsches Passwort") return cleaned_data -
Issue formulating django query between two tables
I've read at length about django queries. But, despite my efforts to trying django forward queries and backwards queries I just cannot get what I want. i wrote a forward query: ATUFS = TSFH.objects.filter(FKToUser=request.user).values('sB','sE') this returns: {'sB': datetime.datetime(2019, 5, 21, 18, 14, 2, 691185, tzinfo=<UTC>), 'sE': datetime.datetime(2019, 5, 21, 18, 16, 2, 532731, tzinfo=<UTC>)} But for this query I need also make a query that ensures TSF.FKToT a FK to another table T matches the local variable in my script ed = request.GET.get('d', ''). So essentially with this clause Im trying to achieve T.dNm = ed . Im just confused how to achieve this in my django forward query. i wrote a backward query: ATFUS = TSF.objects.filter(FKToTld__dNm='123.123.13.1').values('sB','sE ') This returns an error, that sB, and sE are not available to return the values for, because they're not in the TSF table. models.py class T(models.Model): dNm = models.CharField(verbose_name="",max_length=40) FKToUser = models.ForeignKey('auth.user', default=None, on_delete=models.PROTECT) class TSFH(models.Model): sB = models.DateTimeField(null=True) sE = models.DateTimeField(null=True) FKToUser = models.ForeignKey(User,default=None, on_delete=models.PROTECT) class TSF(models.Model): httpResponse = models.IntegerField() FKToT = models.ForeignKey('T', on_delete=models.PROTECT) FKToTSFH = models.ForeignKey('TSFH', on_delete=models.PROTECT, null=True) In regular SQL Im simply trying to achieve SELECT sB, sE FROM TSF, TSFH,T where TSFH.id=TSF.FKToTSFH_id and T.id=tsf.FKToT_id; How can I achieve … -
how to distribute surplus load of user traffic to google app engine from google compute VM ? running django with apache
I am running django on google VM instance using apache and mod wsgi... i however am unsure of the concurrent requests that my app shall receive from the users and would like to know if i can transfer the surplus load of the VM to the App engine automatically to prevent the server from crashing. I am unable to find any solution expect running kubernetes cluster or docket containers to effectively manage the load. but in need to be free of this hassle and send off the excess load to GAE. -
Long celery task causes MySQL timeout in Django - options?
I have a celery task which takes about 6 hours. At the end of it, Django (or possibly Celery) raises an exception "MySQL server has gone away". After doing some reading, it appears that this is a known issue with long tasks. I don't (think I have) control over pinging or otherwise mid-task; but the exception is raised after the call which takes time has finished (but still within the task function). Is there a call I can make within the function to re-establish the connection? (I have run this task "locally" with the same RDS MySQL DB and not had the issue, but I am getting it when running on an AWS instance.) -
Problem with python manage.py runserver command
The problem that i have is when i use python manage.py runserver or any other command with manage.py I have problem which says FATAL: password authentication failed for user "admin" Here is a picture from Power-Shell to see it . Someone give some advice, video clip or any tutorial to fix this problem. And one more thing to say that my DATABASES in settings.py file is configure with the correct ENGINE: 'ENGINE': 'django.db.backends.postgresql_psycopg2', -
How to filter INSIDE foreign key set?
There are two models class Question(models.Model): text = models.TextField() class Vote(models.Model): cas_id = models.IntegerField() question = models.ForeignKey(Question, on_delete=models.CASCADE, related_name='votes') I want to get ALL questions. Every question's votes set should include only votes with cas_id=123. Some question's votes set may be empty. SQL query looks like: with user_votes as ( select * from votes where cas_id = 123 ) select * from question q left join user_votes uv on q.id = uv.question_id; How can I do it via django-ORM in one query? I tried following. .filter(votes__cas_id=123) excludes extra rows. 2 queries and some code work OK. -
how to connect django form with the popup window?
i have made my views.py with a form which is able to render on the edit.html file, but i want to make that form pop up on a different page. i have tried this :----- my views.py def editButton(request,event_id=37000): time = timezone.now() status =False if request.method == 'POST': form = EditForm(request.POST) if form.is_valid(): name = request.POST.get('website_name') link = request.POST.get('link') prom = request.POST.get('promotion_status') part = request.POST.get('partner_status') ....... return redirect('admin-panel/event_list') else: form = EditForm() return render(request , 'admin_panel/edit.html',{'form':form}) my details.html where is actually want to popup my form: <html> <a href="{% url 'admin-panel/edit' event_id=37000 %}" data-toggle="modal" href="#editModal">Edit</a> {% include "admin_panel/edit.html" %} </html> my edit.html <div class="modal hide" id="contactModal"> <form class="well" method="post"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h3>Editing Contact</h3> </div> <div class="modal-body"> {% csrf_token %} {{form.as_p}} </div> <div class="modal-footer"> <input class="btn btn-primary" type="submit" value="Save" /> <input name="cancel" class="btn" type="submit" value="Cancel"/> </div> </form> </div> my url.py urlpatterns =[ path('',views.admin_home,name = 'home'), path('edit/<int:event_id>',views.editButton,name='edit'), tracebacks: File "C:\Users\J A X\Anaconda3\envs\madeenv\lib\site-packages\django \core\handlers\exception.py" in inner 34. response = get_response(request) File "C:\Users\J A X\Anaconda3\envs\madeenv\lib\site-packages\django\core\handlers\base.py" in _get_response 156. response = self.process_exception_by_middleware(e, request) File "C:\Users\J A X\Anaconda3\envs\madeenv\lib\site-packages\django\core\handlers\base.py" in _get_response 154. response = response.render() File "C:\Users\J A X\Anaconda3\envs\madeenv\lib\site-packages\django\template\response.py" in render 106. self.content = self.rendered_content File "C:\Users\J A X\Anaconda3\envs\madeenv\lib\site-packages\rest_framework\response.py" in rendered_content 72. ret … -
Django file validation with custom validator doesn't work as I expected
I'm trying to make a form with some data and a file that needs to be uploaded. I want to limit the file size to 5MB and I can't seem to figure out how to do it. I've tried using a validators.py file and run .validate() and .run_validators() but I didn't make it work. I will show you some code. views.py from django.shortcuts import render from .models import Oferta, CV from django.contrib import messages # Create your views here. def incarcareoferta(req): context = { 'title': "Incarcare oferta de munca | Best DAVNIC73" } if req.method == 'POST': try: COR = req.POST['COR'] denumireMeserie = req.POST['denumireMeserie'] locuri = req.POST['numarLocuri'] agentEconomic = req.POST['agentEconomic'] adresa = req.POST['adresa'] dataExpirare = req.POST['expirareOferta'] experientaSolicitata = req.POST['experienta'] studiiSolicitate = req.POST['studii'] judet = req.POST['judet'] telefon = req.POST['telefon'] emailContact = req.POST['email'] cerere = Oferta(solicitant=req.user, cor=COR, denumireMeserie=denumireMeserie, locuri=locuri, agentEconomic=agentEconomic, adresa=adresa, dataExpirare=dataExpirare, experientaSolicitata=experientaSolicitata, studiiSolicitate=studiiSolicitate, judet=judet, telefon=telefon, emailContact=emailContact) cerere.save() except: messages.error(req, 'Nu ai completat corect campurile sau unul din ele este liber!') return render(req, "../templates/pagini/incarcare-oferta-de-munca.html", context) def incarcarecv(req): context = { 'title': "Incarcare CV | Best DAVNIC73" } if req.method == 'POST': try: nume = req.POST['nume'] prenume = req.POST['prenume'] telefon = req.POST['telefon'] email = req.POST['email'] cv = req.FILES['CV'] try: cv_upload = CV( solicitant=req.user, … -
How can i create different storage for different users of a web application
I want to create a Web application which I can sell to different business and I want to store their data separately in different tables according to their business names how can I do that? For example, I created a library management system and I want that user after login saves his data and the data that is saved in different tables get saved separately according to the user and not get mixed with other users data. -
Load/Project multiple shapefile in GeoDjango
I have 3 three shapefiles and would like to upload all of them and project the result in GeoDjango admin. a) state.shp (for the shape of a state) b) boundary.shp (to identify a specific portion in the state.shp) c) beat.shp (to further sub divide the region obtained from boundary.shp file) What I want to do is the following: Uploading state.shp gives the following result. Uploading boundary.shp gives the following result: Please note new operations are performed on results obtained by previous operations. And similarly any other shapefile file which is uploaded should be projected. After following the official documentation I can project single shapefile in GeoDjango admin. My question is How can I display result of multiple shapefile in GeoDjango? -
How can I use a different object manager for related models?
I have a couple of classes: class Person(models.Model): address = models.ForeignKey(Address, on_delete=models.CASCADE) class Address(LiveModel): address = models.CharField(max_length=512) some_manager = SomeManager() some_other_object_manager = OtherManager() class Meta: base_manager_name = 'some_other_object_manager' Because I set some_manager, the default manager used is SomeManager which is good. BUT if I am querying a Person, I want it to use Address's OtherManager manager for querying and I thought that by setting base_manager_name, I would be able to achieve this (https://docs.djangoproject.com/en/2.2/topics/db/managers/#using-managers-for-related-object-access). Unfortunately this does not work. Any ideas? Particularly I am trying to achieve this in the admin, if that makes a difference. -
How to Solve "AES key must be either 16, 24, or 32 bytes long"
I am trying to make a College project where i am trying implement a payment gateway to my website. The payment gateway I am using is Paytm (India). They have already provided me with the checksum.py file. But when i try to pass merchant ID and order id, I end up with the error. Here's the traceback:- Environment: Request Method: POST Request URL: http://127.0.0.1:8000/orders/create/ Django Version: 2.2 Python Version: 3.7.3 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'crispy_forms', 'social_django', 'cart.apps.CartConfig', 'payment.apps.PaymentConfig', 'orders.apps.OrdersConfig', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'products', 'drf_paytm', 'drfaddons', 'feedback.apps.FeedbackConfig', 'users.apps.UsersConfig', 'shop.apps.ShopConfig'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware'] Traceback: File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/django/core/handlers/exception.py" in inner 34. response = get_response(request) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 115. response = self.process_exception_by_middleware(e, request) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/django/core/handlers/base.py" in _get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view 21. return view_func(request, *args, **kwargs) File "/Users/shyambalakrishnan/Dev/trydjango/src/orders/views.py" in order_create 40. param_dict['CHECKSUMHASH'] = Checksum.generate_checksum_by_str(param_dict, MERCHANT_KEY) File "/Users/shyambalakrishnan/Dev/trydjango/src/payTm/Checksum.py" in generate_checksum_by_str 52. return __encode__(hash_string, IV, merchant_key) File "/Users/shyambalakrishnan/Dev/trydjango/src/payTm/Checksum.py" in __encode__ 102. c = AES.new(key.encode('utf-8'), AES.MODE_CBC, iv.encode('utf-8')) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/Crypto/Cipher/AES.py" in new 95. return AESCipher(key, *args, **kwargs) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/Crypto/Cipher/AES.py" in __init__ 59. blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs) File "/Users/shyambalakrishnan/Dev/trydjango/lib/python3.7/site-packages/Crypto/Cipher/blockalgo.py" in __init__ 141. self._cipher = factory.new(key, *args, **kwargs) Exception Type: ValueError at /orders/create/ Exception Value: … -
give a bytes to reportlab.lib.utils.ImageReader
I have read that you can use a bytes like object to reportlab.lib.utils.ImageReader(). If I read in a file path it works fine, but I want to use a byte like object instead that way I can save the plot I want in memory, and not have to constantly be saving updated plots on the drive. This is where I found the code to convert the image into a string https://www.programcreek.com/2013/09/convert-image-to-string-in-python/ This is an example of how to use BytesIO as input for ImageReader() How to draw image from raw bytes using ReportLab? This class is used to make a plot and pass in a save it to memory with BytesIO(). string is the value I'm going to pass later #imports import PyPDF2 from io import BytesIO from reportlab.lib import utils from reportlab.lib.pagesizes import landscape, letter from reportlab.platypus import (Image, SimpleDocTemplate, Paragraph, Spacer) from reportlab.lib.styles import getSampleStyleSheet from reportlab.lib.units import inch, mm import datetime import os import csv import io import base64 import urllib from django.contrib import admin from django.forms import model_to_dict from django.http import HttpResponse from django.urls import path from django.views.decorators.csrf import csrf_protect from django.utils.decorators import method_decorator from reporting import models, functions, functions2 import matplotlib matplotlib.use('agg') from matplotlib import … -
Repeated form data to Django form
Consider a basic Django form: from django import forms class TestForm(forms.Form): first_name = forms.CharField(max_length=50) last_name = forms.CharField(max_length=50) When you pass this form request.POST, as in TestForm(request.POST), it receives the QueryDict instance from the requests's form(s): from django.http.request import QueryDict qd = QueryDict(mutable=True) qd["first_name"] = "Brad" qd["last_name"] = "Solomon" TestForm(qd).is_valid() # True But now what I'd like to do is handle multiple row-like repetitions of these same two fields: <form method="POST"> <input type="text" name="first_name"> <input type="text" name="last_name"> <br> <input type="text" name="first_name"> <input type="text" name="last_name"> <input type="submit" value="OK"> </form> I.e. What's the proper way to iterate over each of these cleaned and validated (first_name, last_name) pairs? If I pass the whole thing to a TestForm, then .cleaned_data only takes the last-seen pair: >>> qd = QueryDict(mutable=True) ... qd.setlist("first_name", ["Brad", "Joe"]) ... qd.setlist("last_name", ["Solomon", "Smith"]) >>> form = TestForm(qd) >>> form.is_valid() True >>> form.cleaned_data {'first_name': 'Joe', 'last_name': 'Smith'} (For what it's worth, it does make sense that only the last value is shown because this mimics QueryDict behavior. However, I'd like to access all values rather than just the last-seen.) -
How to save fields from APIs into objects
I've built APIs for stores weekly reports. Then I've realized that I have an issue that is the reports are showing on my front-end but are not being stored in the database. Do I have to redevelop all the APIs after implementing models for reports? or is there another way to go around it? -
rounding image borders with css is not working when nested
EDIT: This must be some other issue with django and how it refreshes the CSS. I have made several changes to the css it now and see no changes when I reload the page. It does have some .scss files along with it, I have changed those too and still see no changes. I am doing a {% load staticfiles %} which maybe isn't pulling the right files? I mean it is the site works, but its not picking up changes some how. I wanted to round the edges of an image within a specific div. Thought this is how I did it: /* 13.0 Service CSS */ .single-service-area { position: relative; z-index: 1; text-align: center; } .single-service-area img { border-radius: 50%; } .single-service-area .service-icon { background-color: #e7f2fd; width: 145px; height: 110px; font-size: 42px; color: #303030; text-align: center; line-height: 110px; border-radius: 80px 200px 200px 362px; margin: 0 auto 30px; -webkit-transition-duration: 500ms; -o-transition-duration: 500ms; transition-duration: 500ms; } .single-service-area h5 { font-size: 22px; display: block; margin-bottom: 15px; -webkit-transition-duration: 300ms; -o-transition-duration: 300ms; transition-duration: 300ms; font-weight: 600; } .single-service-area:focus .service-icon, .single-service-area:hover .service-icon { background-color: #1583e9; color: #ffffff; -webkit-box-shadow: 0 6px 50px 8px rgba(21, 131, 233, 0.15); box-shadow: 0 6px 50px 8px rgba(21, 131, 233, … -
Django: Can I create new object with just a django form and models?
Can I use ModelForm with initial data from User related model/ data? I mean with just 1 button click it will auto-generate(create) a new editable object(ForeignKey object) for me. So I don't need to make/access CreateView URL for this app model. Can anyone give me some approach code for views.py and forms.py? -
Constantly make API calls and update the page content based on the results
I'm trying to create a page on which I have a text/image popping up whenever there is a new entry in the database. For example, I want to display "username just registered" whenever a new user registered on my website, without needing to refresh the page in order to see the updates. Pretty much an auto-updating page. I'm using Django for the backend of the website and I really don't have any idea on how to get the page to auto-update nor have found any useful information on the internet. @login_required def recent_updates(request): last_user = Profiles.objects.latest('id').username context = { 'last_registered': last_user } return render(request, 'main/updates.html', context) I expect that whenever someone is registered on my page, the current text to be replaced with the new one. So if the last registered user was Bob, then on my page there will be: Bob just registered. But if John will register after Bob, the page will update to: John just registered. Not: Bob just registered. John just registered. -
how can i redirect to loop over multiple variables in django html
i want to go for different page based on value of i ,i know the syntax is incorrect but i need some suggestions for doing the same thing in an alternate way i am new in stack overflow please forgive if my question is stupid {% for document,i in details , flag reversed %} <tr> {% if i %} <td><li><a href="{{ document.docfile.url}}">{{ document.docfile}}</a></li> </td> {% else %} <td><li><a href="./{{ whole }}/{{ document.docfile}}">{{ document.docfile}}</a></li> </td> {% endif %} <td>{{ document.DateOfUpload}}</td> <td>{{ document.emailid}}</td> <tr> {% endfor %} if it is a file then the url should look something like ./media/filelocation or else if it is a directory then it should add the previous path -
django.contrib.registration.password_validation.UserAttributeSimilarityValidator. Error while saving the user
community, I was creating a new user by the custom form with a custom author model inheriting default user model. I encountered this error while I was saving the user in the database. Here are my all relevant files. blograms/settings.py """ Django settings for blograms project. Generated by 'django-admin startproject' using Django 2.2.1. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ import os from decouple import config # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'phonenumber_field', 'widget_tweaks', 'blog.apps.BlogConfig', 'user.apps.UserConfig' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'blograms.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')] , 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'blograms.wsgi.application' # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { 'default': … -
Populate a Django form field with choices from database (but not from a model)
I'd like to populate a form dropdown with data from database. Those data don't come directly from a model but from a raw query. This is working when the database is available and the migrations are already generated. Otherwise, generating the migrations (python manage.py makemigrations myapp) fails because Django evaluates _all_departments() which is not able to find the appropriate table. def _all_departments() -> List[Tuple[str, str]]: from django.db import connection with connection.cursor() as cursor: cursor.execute("select distinct department from crm_mytable order by department") return [(row[0], row[0]) for row in cursor.fetchall()] class MyForm(forms.Form): department = forms.CharField( widget=forms.SelectMultiple(choices=_all_departments())) I naively tried to update manually the choices on __init__ without success (choices are always empty): class MyForm(forms.Form): def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['department'].widget.choices = _all_departments() department = forms.CharField( widget=forms.SelectMultiple(choices=[])) What would be the way to properly fill on-demand the choices? -
How can I do to serialize a queryset with foreign fields?
I have a problem, I have two tables class Car(models.Model): brand = models.ForeignKey(Brand, on_delete=models.CASCADE) year = models.IntegerField(null=False, default=None) begin = models.DateTimeField(default=None, blank=True) class Brand(models.Model): name = models.CharField(max_length=64, default=None) Then, I tried to serialize using this : car_query = Car.objects.filter(year=1984) car_json = serializers.serialize('json', car) car = json.loads(car_json) It works but I have just the id of the entry in the table Brand. What I would like to have is the name of the Brand inside the variable car. I thought to try this : car_query = Car.objects.filter(year=1984).values('year', 'begin', 'brand__name') In this case I have a valuesqueryset and then when I try this : car_json = serializers.serialize('json', car_query) car = json.loads(car_json) I got this : {AttributeError}'dict' object has no attribute '_meta' because car_query is not a queryset but valuesqueryset that is the problem. So I try this car_json = json.dumps(car_query) but I have some datetime and it does not work so I decide to try this : json.dumps(car_query, sort_keys=True, indent=1, cls=DjangoJSONEncoder) but it does not work. It is strange because when I use serializers.serialize the datetime are in the good format but when I use json.loads I have some datetime. I precise my goal is just to have at the end a … -
questio about django views loop not working in html
I have created loop in views.py file then through dictionary . I have connected that loop in html file in django project. And it is not working. views def count(request): data= request.GET['fulltextarea'] text=data.split() counted_text=len(text) worddictionary={} for word in text: if word in worddictionary: worddictionary[word] += 1 else: worddictionary[word] = 1 return render(request,'count.html',{'fulltextarea':data, 'len':counted_text,'worddictionary': worddictionary}) Error occuring in html ' Counted Your text {{fulltextarea}} Words count Total word = {{len}} Number of each word {% for word, value in worddictionary %} {{ word }} = {{ value }} {% endfor %} - List item ' -
Can my server hard drive ran out of space if I fetch files from another server in Django to serve them as an httpresponse?
I have a server where I'm running a backend in django. I'm requesting files to another server from my backend, and serving them as an http response. My question is, can my server ran out of space after doing this multiple times. I don't have any idea if the files are getting cache or stored in the server after executing this code. I'm doing something like this: fun serve_files(): file = request('files_url') httpResponse(file) -
How to run Django function in Pycharm?
I have some internal utilities I want to develop for my Django project. These are utilities that I need to run mostly in my DEV environment, not in production. I want to be able to call these from my PyDev IDE or Terminal. Is there a way to call functionality in my Django project without creating a view and using a URL to access it? I've done several Google searches, but nothing is coming up.