Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Copying only non-relation attributes django/python
I am copying a model object to another, but I want that it doesn’t copy the relations For example, assume you have a model like class Dish(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=500) category = models.ForeignKey(Category, on_delete=models.CASCADE, default=1) def __str__(self): return self.name Then I do my_dish = Dish.objects.get(pk=dish.id) serializer = Dish_Serializer(my_dish) my_new_object = serializer.data I want my_new_object to include only those attributes that are not relations, in this case, name and description How do I do that without accessing name and description directly Thanks in advance Rafael -
Change Django Default Language
I've been developing a web application in English, and now I want to change the default language to German. I tried changing the language code and adding the locale directory with all the translations, but Django still shows everything in English. I also want all my table names to be in German along with the content in the templates. I also tried Locale Middleware and also this repo for a custom middleware but it still doesn't work. Not to mention, Django changes the default language of the admin panel, but my field and table names remain English. MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'language.DefaultLanguageMiddleware', # 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] LANGUAGE_CODE = 'de' TIME_ZONE = 'UTC' USE_I18N = True USE_TZ = True LOCALE_PATH = ( os.path.join(BASE_DIR, 'locale') ) Here is my locale directory: This is how I use translation in my templates: {% load i18n static %} {% translate "Single User" %} This is how I have defined my models: from django.utils.translation import gettext_lazy as _ class Facility(models.Model): name = models.CharField(_('Name'), max_length=100, null=True, blank=True) class Meta: verbose_name_plural = _('Facilities') -
getting data from the backend django models
I am working on a project pastly the i used sql querys, but change in the django models the models i used are for the members table class Members(models.Model): name = models.CharField(max_length = 50) address = models.CharField(max_length = 50) phoneNo = models.CharField(unique=True, max_length = 50) created = models.DateTimeField(auto_now_add=True) update = models.DateTimeField(auto_now=True) def __str__(self): return self.name for the bills table salesPerson = models.ForeignKey(User, on_delete = models.SET_NULL, null=True) purchasedPerson = models.ForeignKey(Members, on_delete = models.SET_NULL, null=True) cash = models.BooleanField(default=True) totalAmount = models.IntegerField() advance = models.IntegerField(null=True, blank=True) remarks = models.CharField(max_length = 200, null=True, blank=True) created = models.DateTimeField(auto_now_add=True) update = models.DateTimeField(auto_now=True) class Meta: ordering = ['-update', '-created'] i am having a query that is credits = Bills.objects.all().filter(cash = False).values ('purchasedPerson').annotate( cnt = Count('purchasedPerson'), debit = Sum( 'totalAmount' ), credit = Sum( 'advance' ), balance = Sum( 'totalAmount' ) - Sum( 'advance' ) ).order_by ('purchasedPerson') getting the output as [{'purchasedPerson': 1, 'cnt': 2, 'debit': 23392, 'credit': 100, 'balance': 23292}, {'purchasedPerson': 2, 'cnt': 1, 'debit': 1280, 'credit': 0, 'balance': 1280}] but i need in the out put name, address and phone number also how can i get those -
Notifications for an app React Django using GraphQL
I am working on an app React Django using GraphQL. I heard about websocket with subscriptions but I cannot use that with graphene. What I want it something really simple I mean send a signal from the server to the clients if there is a new comment. Do you have any ideas how can I do to implement that ? Thank you very much ! -
Docke Preparing editable metadata (pyproject.toml) did not run successfully
Working on a fairly simple django task. It works as expected. I am trying to build and run a docker. It is the Dockerfile: FROM python:3.10 ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=off \ POETRY_NO_INTERACTION=1 \ POETRY_NO_ANSI=1 \ APP_PATH="/usr/src" WORKDIR $APP_PATH RUN pip install poetry COPY poetry.lock pyproject.toml ./ # --no-dev is depricated (--only main) RUN poetry install --no-root --only main # Copy in source code. COPY . . # Install ourselves; all dependencies should be there already. RUN pip install --no-input --no-color --no-deps -e . EXPOSE 8000 It fails in RUN pip install -e . line! It is also pyproject.toml : [tool.poetry] name = "dj-task" version = "0.1.0" description = "" readme = "README.md" packages = [{include = "dj_task"}] [tool.poetry.dependencies] python = "^3.10" Django = "^4.1.3" requests = "^2.28.1" Pillow = "^9.3.0" mimetype = "^0.1.5" pandas = "^1.5.2" celery = "^5.2.7" django-redis = "^5.2.0" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" The final error is Preparing editable metadata (pyproject.toml): started Preparing editable metadata (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error × Preparing editable metadata (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [20 lines of output] Traceback (most recent call last): ...... File "/tmp/pip-build-env-wgrjgnli/overlay/lib/python3.10/site-packages/poetry/core/masonry/utils/package_include.py", line 66, in check_elements … -
How can I return a context from views.py in different html files in Django?
So, I have a method called 'room' in my views.py file. I can only access this room on my room.html page as I'm returning it there but I would like to use this data on my index page as well. How can I do that? Advance Thanks. Views.py def room(request): rooms = Rooms.objects.all() photos = RoomImage.objects.all() context = {'rooms':rooms, 'photos':photos} return render(request, 'hotelbook/room.html', context) -
wrong path instead of the actual file is being saved to backend in Django
Been really struggling with this I have a Vue front end with a HTML form <form id="postForm" method="POST" action=""> <div class="mediaButtons horizontal mb10"> <div class="mediaButton"> <input type="file" name="" id="postImages" accept="image/jpg, image/png, image/jpeg, image/tiff, image/webp, image/bmp, image/svg" @change="handleImages" multiple maxFileSize="50000" /> <div class="buttonImage"> <img class="buttonImg" src="../assets/img/pic.png" /> </div> </div> </div> <fieldset class="postButtons mt20" v-if="catChosen"> <button class="topBtn" type="button" name="addPost" @click="submitPost"> Post </button> <button class="canBtn" type="button" name="addPost" @click="store.hideAddaPost" > Cancel </button> </fieldset> </form> The function to handle the images and display them is this: import { ref } from "vue"; const fields = ref({ previews: [], images: [], }); function handleImages(event) { var input = event.target; var count = input.files.length; function isFileImage(file) { return file && file["type"].split("/")[0] === "image"; } if (count > 8) { return store.messages.push("Max 8 images per post please"); } for (const file of input.files) { if (isFileImage(file)) { } else { return store.messages.push("Only image files are allowed"); } } var index = 0; while (count--) { var reader = new FileReader(); reader.onload = (e) => { fields.value.previews.push(e.target.result); }; fields.value.images.push(input.files[index]); reader.readAsDataURL(input.files[index]); index++; } } I send the data to the backend using this function: function submitPost() { let uploaded_images = [] fields.value.images.forEach((val) => uploaded_images.push(val)) const fieldsData = { "category": selectedCat.value, … -
Dynamically positioning an element depending on the models properties in Django
As a personal project I am working on a custom calendar. I have an Event model that includes TimeFields describing when the event starts and ends which I've redacted to only include relevant fields in this post. class Event(models.Model): owner = models.ForeignKey(User, on_delete=models.CASCADE) start_date = models.DateField() end_date = models.DateField() start_time = models.TimeField(null=True, blank=True) end_time = models.TimeField(null=True, blank=True) summary = models.CharField(max_length=200, help_text="Enter summary") description = models.CharField( max_length=1000, help_text="Enter description and relevant data") The calendarView returns an array of querysets for each day that I iterate through to create a grid of events. @login_required def index(request): startingDate = datetime.date(2022, 11, 21) datesDisplayed = [startingDate + datetime.timedelta(days=i) for i in range(7)] eventsByDate = [] for i in range(7): eventsByDate += [Event.objects.filter(owner=request.user).filter( start_date=datesDisplayed[i]).exclude(start_time=None)] context = {"eventsByDate": eventsByDate,} return render(request, 'index.html', context=context) The template: {% for events in eventsByDate %} <div class="eventsByDate"> {% for event in events %} <div class="event"> <b>{{ event }}</b>, {{event.timeDisplayed.0}} </div> {% endfor %} </div> {% endfor %} As the title describes I would like to position the events dynamically depending on the starting time of each event. So far the best way I could think of how to do that is to create a value in the view and pass … -
Django translation. RuntimeWarning: DateTimeField received a naive datetime
English is the default language of the project. When I switch language, values of all date fields are disrepair. When I try to fill up the form and send it, appear this error: RuntimeWarning: DateTimeField received a naive datetime (2022-11-27 12:00:00.045143) while time zone support is active. I think the problem with time zone. if make this USE_TZ = False the translation is not working at all... -
change an object with ModelViewSet
im building a project with DRF and im trying to understand how the modelviewset is working, im sending a url like this: localhost/do_somthing/object_id/ and route it with : router.register('do_somthing', views.do_somthing, basename='do_somthing') the view is: class do_somthing_View(viewsets.ModelViewSet): serializer_class = ObjectSerializer permission_classes = [permissions.IsAuthenticated] queryset = Object.objects.all() http_method_names = ['get'] def get_queryset(self): obj= Object.objects.get(id=self.kwargs['pk']) user = self.request.user if user == obj.user: obj.att= True obj.save return self.queryset else: None the object model looks like this: class Object(models.Model): user= models.ForeignKey(User, on_delete=models.PROTECT, related_name="realted_user") name= models.CharField(max_length=50) att= models.BooleanField(default=False) def __str__(self): return self.name the problem is that the att never changes and still set to False is there any way better i can get to change the attribute and return the object BTW ive tried to return an unauthorized response when its not that user but i cant return a response if someone can please help me or can even suggest a better way to do that that would help me alot thanks i am trying to present an object and when its presented by the correct user change an attribute of that object -
Why function try to processing not downloaded image?
The question arose, why does the function not allow the image to load, but trying to process it at the time of object creation? and how to fix it I would like to know. def image_as_base64(image_file, format='jpg'): if not os.path.isfile(image_file): return None encoded_string = '' with open(image_file, 'rb') as img_f: encoded_string = base64.b64encode(img_f.read()).decode('utf-8') return 'data:image/%s;base64,%s' % (format, encoded_string) # Example Usage class Post(models.Model): cover = models.ImageField() base_64 = models.TextField('base_64', blank=True, null=True) base_64_large = UnlimitedCharField(blank=True, null=True) def save(self, *args, **kwargs): print(image_as_base64(os.path.join(settings.MEDIA_ROOT , self.cover.path))) self.base_64 = image_as_base64(os.path.join(settings.MEDIA_ROOT , self.cover.path)) self.base_64_large = image_as_base64(os.path.join(settings.MEDIA_ROOT , self.cover.path)) super(Post, self).save(*args, **kwargs) And if I comment if not os.path.isfile(image_file): return None I take an Exception Type: FileNotFoundError. If image exist in folder, function works correctly -
how to use a toast library with html
I'm using a toast library called js-snackbar with django templates, after a call is being made to the messages, I get Snackbar is not defined on console, am I missing something? {% if messages %} {% for message in messages %} {% if message.tags == 'success'%} <script> new Snackbar({ message: "{{ message }}", status: "success", position: "bl" }); </script> {% elif message.tags == 'info' %} <script> new Snackbar({ message: "{{ message }}", status: "info", position: "bl" }); </script> {% endif %} {% endfor %} {% endif %} -
Hosting of django website or web application
how to host my newsblog which is created by python(django)..any suggestions of yours?? I tried it on netlify and other one two platform but unable to do it so here i am to seek a help from tremendous community of stack overflow which is created for the mantra of helping hands waited for your valueable answer -
an application that measures me the distance between the locale and the position of the client
django.contrib.gis.geoip2.base.GeoIP2Exception: Could not load a database from … I can't find a solution for an application that measures me the distance between the locale and the position of the client setting.py ` INSTALLEDAPPS = [ 'django.contrib.gis.geoip2', ] GEOIPPATH = os.path.join(BASE_DIR, 'geoip') utils.py from django.contrib.gis.geoip2 import GeoIP2 def get_geo(ip): g=GeoIP2() country=g.country(ip) city=g.city(ip) lat,lon=g.lat_lon(ip) return country, city, lat, lon ` -
Python Django saving two models from an html form
I have two models: PersonelModel and ArizaModel. Both in one html form. Personel data was previously saved in the PersonelModel table. When the fetch data button is pressed, the data is fetched by querying according to the p_sicil field. It is displayed in the p_isim and p_bilgisayar_adi fields. I created the required relationship between PersonelModel and ArizaModel. I want to save the data I entered in the a_aciklama field into the database according to the relationship between PersonelModel and ArizaModel. How can i do that? models.py: class PersonelModel(models.Model): p_sicil = models.CharField(max_length=8, verbose_name='Personel Sicili') p_isim = models.CharField(max_length=50, verbose_name='Personel Adı') p_bilgisayar_adi = models.CharField(max_length=4, verbose_name='Bilgisayar Adı') p_durum = models.BooleanField(default=True, verbose_name='Personel Durumu') birim = models.ForeignKey(BirimModel, verbose_name=("BİRİM"), on_delete=models.DO_NOTHING, null=True) grup = models.ForeignKey(GrupModel, verbose_name=("GRUP"), on_delete=models.DO_NOTHING, null=True) unvan = models.ForeignKey(UnvanModel, verbose_name=("ÜNVAN"), on_delete=models.DO_NOTHING, null=True) class Meta: db_table = 'PersonelTablosu' verbose_name = "PERSONEL" verbose_name_plural = "PERSONELLER" def __str__(self): return self.p_sicil class ArizaModel(models.Model): a_aciklama = models.CharField(max_length=100, verbose_name='Arıza Açıklama') a_acilma_tarihi = models.DateTimeField(auto_now_add=True, verbose_name='Açılma Tarihi') a_durum = models.BooleanField(default=True, verbose_name='Arıza Durumu') a_kapanma_tarihi = models.DateTimeField(auto_now_add=True, verbose_name='Kapanma Tarihi') birim = models.ForeignKey(BirimModel, verbose_name=("BİRİM"), on_delete=models.DO_NOTHING, null=True) teknik_personel = models.ForeignKey(TeknikPersonelModel, verbose_name=("TEKNİK PERSONEL"), on_delete=models.DO_NOTHING, null=True) personel_ariza_acan = models.ForeignKey(PersonelModel, verbose_name=("AÇAN PERSONEL"), on_delete=models.DO_NOTHING, null=True) class Meta: db_table = 'ArizaTablosu' verbose_name = "ARIZA" verbose_name_plural = "ARIZALAR" def __str__(self): return self.a_aciklama forms.py: class … -
How to change Django MultipleChoiceField to display multiple data from multiple tables and use specific value
I have 3 relational Django database tables and I want to display 1st column values as label, and 1st table id as value in Django MultipleChoiceField | Example Table Structure | Table 1 (province): | id | name_en |name_ta | | -------- | ---------- |---------- | |1 | Western | - | |2 | Central | - | Table 2 (district): | id | ForeignKey | Name_en |Name_ta | | -------- | ----------- | ----------- |------- | |1 | 2 | Kandy | - | |2 | 1 | Colombo | - | Table 3 (city): | id | ForeignKey | Name_en |Name_ta | | -------- | ----------- | ---------- |---------- | |1 | 1 | Uduwela | - | |2 | 2 | Homagama |- | I want to display MultipleChoiceField in this format <select> <option value='1(city id)'>Western,Colombo,Homagama</option> </select> -
auto generate thumbnail for FileField in django
I uploaded different file types to my project(pdf,doc,mp4 ,jpg). now I want to auto-generate thumbnail for each file which is going to add or was added previously, and save it to my DB. here is what I think: here is my File model: class File(models.Model): slug = models.SlugField( max_length=255, unique=True, ) address = models.FileField( validators=[ file_size, FileExtensionValidator( allowed_extensions=[ "jpg", "mp4", "doc", "pdf", ] ), ], upload_to="files/", max_length=255, ) thumbnail = models.ImageField( upload_to="files/thum/", max_length=255, null=True, blank=True ) TYPES = [ (IMG, "Image"), (VID, "Video"), (DOC, "Document"), ] type = models.CharField(max_length=3, choices=TYPES, default=IMG) here I wrote a function : def make_thumbnail(file): if file.type == File.IMG: make_image_thumbnail(file) if file.type == File.VID: make_video_thumbnail(file) if file.type == File.DOC: make_document_thumbnail(file) def make_image_thumbnail(file): #does not work img = Image.open(file.address) img.thumbnail((128, 128), Image.ANTIALIAS) thumbnailString = StringIO.StringIO() img.save(thumbnailString, "JPEG") newFile = InMemoryUploadedFile( thumbnailString, None, "temp.jpg", "image/jpeg", thumbnailString.len, None ) return newFile def make_video_thumbnail(file): video_input_path = file.address file_name = file.slug + "thumbnail" img_output_path = os.path.join(settings.MEDIA_ROOT, file_name) subprocess.call( [ "ffmpeg", "-i", video_input_path, "-ss", "00:00:00.000", "-vframes", "1", img_output_path, ] ) def make_document_thumbnail(file): # cache_path = ? # pdf_or_odt_to_preview_path = file.address # manager = PreviewManager(cache_path, create_folder=True) # path_to_preview_image = manager.get_jpeg_preview(pdf_or_odt_to_preview_path) pass now I want to fill the functions and I don't know a) … -
How to call a function in a Django template?
I have a function on my views.py file that connects to a mail server and then appends to my Django model the email addresses of the recipients. The script works good. In Django, I'm displaying the model with a table, and I'd like to include a button that says Get Emails and runs this function and it then reloads the page with the new data in the model / table. This is my views.py: class SubscriberListView(LoginRequiredMixin, SingleTableView): model = EmailMarketing table_class = EmailMarketingTable template_name = 'marketing/subscribers.html' # Get emails from email server # Connection settings HOST = 'xXxxxxXxXx' USERNAME = 'xXxxxxXxXx' PASSWORD = "xXxxxxXxXx" m = imaplib.IMAP4_SSL(HOST, 993) m.login(USERNAME, PASSWORD) m.select('INBOX') def get_emails(): result, data = m.uid('search', None, "ALL") if result == 'OK': for num in data[0].split(): result, data = m.uid('fetch', num, '(RFC822)') if result == 'OK': email_message_raw = email.message_from_bytes(data[0][1]) email_from = str(make_header(decode_header(email_message_raw['From']))) email_addr = email_from.replace('<', '>').split('>') if len(email_addr) > 1: new_entry = EmailMarketing(email_address=email_addr[1]) new_entry.save() else: new_entry = EmailMarketing(email_address=email_addr[0]) new_entry.save() # Close server connection m.close() m.logout() And this is what I tried on the urls.py: from django.urls import path from django.contrib.auth import views as auth_views from . import views urlpatterns = [ path('', views.marketing, name='marketing'), path('/getemails', views.get_emails, name='getemails'), ] And … -
How to point to a celery beat periodic task inside the upper level folder?
I want to make a periodic task with Django and Celery. I have configured the celery in my project. The project structure looks like this: ├── apps │ ├── laws └──tasks └──periodic.py # the task is in this file ├── config │ ├── celery.py │ ├── settings └── base.py # CELERY_BEAT_SCHEDULE defined in this file content of base.py settings file: CELERY_BEAT_SCHEDULE = { "sample_task": { "task": "apps.laws.tasks.periodic.SampleTask", # the problem is in the line "schedule": crontab(minute="*/1"), }, } The task on periodic.py: class LawAmendmentTask(Task): def run(self, operation, *args, **kwargs): logger.info("The sample task in running...") How can I define the route of the task correctly? -
How to Change File Upload Size Limit Django Summernote
I'm using Django-summernote. I have installed it by pip install django-summernote command. How can I change the file size upload limit? I get the error: "File size exceeds the limit allowed and cannot be saved" when I try to add an image using the summernote widget's toolbar. Thanks! -
Creating and updating data from API answerI to Django REST project (MySQ)?
I have a Django REST project. I have a models User, Store and Warehouse. And I have a module with marketplace parser, that gets data from marketplace API. In this module there is a class Market and a method "get_warehouses_list". This method returns a JSON with a STORE's warehouse list. Examle answer: { "result": [ { "warehouse_id": 1, "name": "name1", "is_rfbs": false }, { "warehouse_id": 2, "name": "name2", "is_rfbs": true } ] } What I have to do is to make creating and updating methods to set and update this warehouse list into my MySQL DB (with creating an endpoint for setting and updating this data). I don't know what is incorrect in my code, but when I send POST request to my endpoint in urls.py router.register("", WarehouseApi, basename="warehouse") I get 400 error instead of setting warehouse list into my DB. My code: user/models.py class User(AbstractUser): username = models.CharField( max_length=150, unique=True, null=True) id = models.UUIDField( primary_key=True, default=uuid.uuid4, unique=True, editable=False) store/models.py ` class Store(models.Model): user = models.ForeignKey( User, on_delete=models.PROTECT) name = models.CharField(max_length=128, blank=True) type = models.PositiveSmallIntegerField( choices=MARKET, default=1, verbose_name="Type API") api_key = models.CharField(max_length=128) client_id = models.CharField(max_length=128) warehouses/models.py class Warehouse(models.Model): store = models.ForeignKey( Store, on_delete=models.СASCAD, null=True) warehouse_id = models.BigIntegerField( unique = True, … -
Add type hints on django initialization
I have user as foreign key user = models.ForeignKey(settings.AUTH_USER_MODEL, models.CASCADE) But when I access user through related object I can't see auto-completion for user attributes. F.e Unresolved attribute reference 'public_name' for class 'ForeignKey' How can I add type hint that it is actually User model? In django app initialization I am overriding serializers.ModelSerializer with my custom serializer. And overriding is taking place in app/init.py module. Problem is I can't see some attributes that exists in CustomModelSerializer. Pycharm is thinking it is ModelSerializer from drf. Is it possible to hint somewhere that it is CustomModelSerializer. (PS: I know I can import CustomModelSerializer everwhere, but it is a big project and I was looking for solutions with adding type hint or making Pycharm recognize overriding) -
Ignore options which already given in django
I created a django forms class StudentFamilyForm(forms.ModelForm): class Meta: model = StudentFamily fields = '__all__' exclude = ['created', 'is_deleted'] it is used to create family details for a student. in the StudentFamily model, there is a student one-to-one field. If i've created a family entry for a student, I don't want to see it in the select input. so how to do that? -
How to filter the dates from datetime field in django
views.py import datetime from django.shortcuts import render import pymysql from django.http import HttpResponseRedirect from facligoapp.models import Scrapper from django.utils import timezone import pytz roles = "" get_records_by_date = "" def index(request): if request.method == "POST": from_date = request.POST.get("from_date") f_date = datetime.datetime.strptime(from_date,'%Y-%m-%d') print(f_date) to_date = request.POST.get("to_date") t_date = datetime.datetime.strptime(to_date, '%Y-%m-%d') print(t_date) global get_records_by_date get_records_by_date = Scrapper.objects.all().filter(start_time=f_date,end_time=t_date) print(get_records_by_date) else: global roles roles = Scrapper.objects.all() return render(request, "home.html",{"scrappers": roles}) return render(request, "home.html", {"scrappers": get_records_by_date}) models.py from django.db import models from django.db import connections # Create your models here. from django.utils import timezone class Scrapper(models.Model): scrapper_id = models.IntegerField(primary_key=True) scrapper_jobs_log_id = models.IntegerField() external_job_source_id = models.IntegerField() start_time = models.DateField(default=True) end_time = models.DateField(default=True) scrapper_status = models.IntegerField() processed_records = models.IntegerField() new_records = models.IntegerField() skipped_records = models.IntegerField() error_records = models.IntegerField() class Meta: db_table = "scrapper_job_logs" Database structure I post f_date = 2022-11-24 00:00:00 , t_date = 2022-11-24 00:00:00 . I need to get the row start_time and end_time which has dates 2022-11-24. Is there any solution how to filter datas from datetime field. If I pass f_date and t_date my <QuerySet []> is empty. -
How to configure webmail tools in django?
I configured mail for my django project. It worked as usual perfectly for gmail. But when I used this configuration for webmail it won't work. Someone pleas help me how to setup webmail configuration for django proejct. I try for several time but it gives me error. I expect to send mail using my webmail.