Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How Can I Setup Celery in my Flask Project
So I've been working on a project for a couple months now and I've been trying to implement Celery into my flask project and it has not gone well. I thought maybe it's my computer or windows or something like, and all the responses I've seen are from a couple years ago and I don't think that they would still work because those were the ones I tried using. So thank you for any responses in advance. I tried using the celery config from the documentation and some chat gpt tutorials but they haven't been of help. And I'm running redis on the localhost -
Modifing ticket creating in django helpdesk
im tring to figure out how can i modify the field that are in the creating ticket area im modifed my admin.py code, i succsed to ad custom fields, but not in the desired way im just wondering if it possible to customize it in my own way without creating new model -
How to Attach Files from a web app to Local Outlook Client?
I'm working on a task where I need to implement a button in the frontend that opens the local Outlook client to compose an email. The user selects files (.dat or .csv) in the frontend, and upon clicking the button, Outlook should open with a default message and the selected files already attached, allowing the user to review the email before sending it. I understand that it might be easier to send the emails directly from the application, but that’s not the desired approach for this project. Can you please let me know if this is even possible, and if so, how I could implement it? I’ve tried using the Outlook API, but it didn’t meet my needs because it doesn’t open Outlook before sending the email, which is a key requirement for this project. Additionally, I cannot use links; the files must be attached directly as they are. -
creating a category system with MVT in django
I am working on a project and I created a system that has cars model and some user models . I want to create another model for user's skills and give the user model a relation to skill model . But I don't know how to do this optimize? for example , some users may can't fix the gearbox of one car But others Can , And some users may can fix some engine problems with some cars that others can't! So with this I need to have ralations to 'Car' model and also I have to save the skills with cars in the database . But there is more than 2000 cars in database! What do you think I can do? -
Logs are not transferred correctly
I have a logger set up to save logs to a file, but I'm encountering an issue with log rotation. Not all logs are being transferred during the rotation process, and the majority of logs are missing. What could be the problem? Why are many of my logs not being transferred during log rotation, and how can I resolve this? Here’s my logger configuration: LOGGING = { "version": 1, "disable_existing_loggers": False, "filters": {"correlation_id": {"()": "django_guid.log_filters.CorrelationId"}}, "formatters": { "standard": { "format": "[%(levelname)s] %(asctime)s [%(correlation_id)s] %(name)s: %(message)s", }, }, "handlers": { "file": { "level": "ERROR", "class": "logging.handlers.TimedRotatingFileHandler", "formatter": "standard", "filters": ["correlation_id"], "filename": "logging_view/logs/server-logs/server.log", "when": "midnight", "interval": 1, "backupCount": 30, "encoding": "utf-8", "delay": True, "utc": True, "atTime": None, "errors": None, }, "custom_mail_admins_handler": { "level": "ERROR", "class": "logging_view.logger.CustomAdminEmailHandler", "formatter": "standard", }, "js_file": { "level": "ERROR", "class": "logging.handlers.TimedRotatingFileHandler", "formatter": "standard", "filters": ["correlation_id"], "filename": "logging_view/logs/client-logs/client.log", "when": "midnight", "interval": 1, "backupCount": 30, "encoding": "utf-8", "delay": True, "utc": True, "atTime": None, "errors": None, }, }, "loggers": { "": { "handlers": ["file", "custom_mail_admins_handler"], "level": "ERROR", "propagate": False, }, "js_logger": { "handlers": ["js_file"], "level": "ERROR", "propagate": False, }, }, } settings.py # log_viewer LOGGING = LOGGING LOG_VIEWER_FILES_DIR = "logging_view/logs/server-logs" LOG_VIEWER_FILES_CLIENT_DIR = "logging_view/logs/client-logs" LOG_VIEWER_PAGE_LENGTH = 25 LOG_VIEWER_MAX_READ_LINES = 1000 LOG_VIEWER_FILE_LIST_MAX_ITEMS_PER_PAGE = … -
Unable to create superuser after creating CustomUser
After creating Custom user when i tried to create a superuser it gave error TypeError: UserManager.create_superuser() missing 1 required positional argument: 'username' Then after creating CustomUserManager its showing Expression of type "CustomUserManager" is incompatible with declared type "UserManager[Self@AbstractUser]" "CustomUserManager" is incompatible with "UserManager[Self@AbstractUser]" Expression of type "CustomUserManager" is incompatible with declared type "UserManager[Self@AbstractUser]" "CustomUserManager" is incompatible with "UserManager[Self@AbstractUser]" class CustomUserManager(BaseUserManager): def create_user(self, email, password=None, **extra_fields): if not email: raise ValueError('The Email field must be set') email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, email, password=None, **extra_fields): extra_fields.setdefault('is_staff', True) extra_fields.setdefault('is_superuser', True) return self.create_user(email, password, **extra_fields) class CustomUser(AbstractUser, PermissionsMixin): username = None email = models.EmailField(unique=True) daily_reminders = models.IntegerField(default=0) start_at = models.TimeField(null=True, blank=True) end_at = models.TimeField(null=True, blank=True) notification_status = models.IntegerField(null=True, blank=True) device_type = models.CharField(choices=DIV_CHOICES, max_length=10, null=True, blank=True) device_token = models.CharField(max_length=255, null=True, blank=True) categories = models.JSONField(default=list, null=True, blank=True) USERNAME_FIELD = 'email' REQUIRED_FIELDS = [] objects = CustomUserManager() def __str__(self): return self.email I BaseUserManager imported from django.contrib.auth.base_user import BaseUserManager but still showing error -
Django RestFramework make lookup_field accept special characters (".")
I am working on a DRF viewset which has a custom query (using annotate to group data), for this I want to implement list, retrive and delete functions based on a field called "batch" which contains a string with special characters like "-" and ".". I am able to make the viewset to list and retrive data but the data retrival fails when special characters (".") are present in the batch string. How can I setup viewset router to allow "." in the batch name? class BatchViewSet(viewsets.ModelViewSet): queryset = Product.objects.values('batch', 'customer', 'order_number').annotate( total_quantity=Sum('total_quantity'), ready_quantity=Sum('ready_quantity') ).filter(deleted_at__isnull=True).all() serializer_class = BatchSerializer lookup_field = 'batch' filter_backends = [filters.SearchFilter, filters.OrderingFilter] search_fields = ['batch', 'customer', 'order_number'] ordering_fields = ['batch', 'customer', 'order_number', 'total_quantity', 'ready_quantity'] ordering = ['batch'] def create(self, request, *args, **kwargs): raise MethodNotAllowed('POST') router.register(r'batches', BatchViewSet, basename="batches") These are the routes generated to get the batch details products/ ^batches/(?P<batch>[^/.]+)/$ [name='batches-detail'] products/ ^batches/(?P<batch>[^/.]+)\.(?P<format>[a-z0-9]+)/?$ [name='batches-detail'] which is not working on my batch TEATECH.01427964.11.08 but working on TEATECH. I tried making a custom router to get the batch number but it is also not working and I can't create a regex which can process the batch. Similarly I can't setup lookup_field_regex to catch the batch string. I can navigate my … -
Django Server URL not running [closed]
I am trying to run the django backend server using the intergrated terminal but the url is not running it is saying Not found tried to open it in the browser but it wasnt running still.I was expecting it to say welcome to the student task tracker -
django factory boy, image fields not created?
I tried to follow the standard recipe for image fields for django factory boy: class ConfigurationSingletonFactory(DjangoModelFactory): class Meta: model = Configuration django_get_or_create = ("id",) id = 1 custom_theme = ImageField(color="blue", width=200, height=200) class GeneralConfiguration(SingletonModel): custom_theme = PrivateMediaImageField("Custom background", upload_to="themes", blank=True) However whenever I try to test it: def test_config(self): conf = GeneralConfigurationSingletonFactory( custom_theme__name="image.png" ) print(conf.custom_theme.width) self.assertEqual(conf.custom_theme.width, 200) The following error pops up: ValueError: The 'custom_theme' attribute has no file associated with it. What am I misunderstanding, I thought I did exactly what https://factoryboy.readthedocs.io/en/stable/orms.html#factory.django.ImageField says? -
Removing success message after deleting was denied
Given the fact, that this is already some years old and no perfect answer was provided: How do I overwrite the delete_model/queryset functions in the admin, so the success message is not shown if the deletion was denied? class BookAdmin(admin.ModelAdmin): def delete_queryset(self, request, queryset): if not can_delete(): messages.error(request, "cannot delete ...") return super().delete_queryset(request, queryset) The logic works, but I get a success AND an error message which is confusing for the user. I know I can go the long way and implement a whole custom logic, but then I would face the issue of not seeing the "are you sure ..." page? I have the same problem I show here for delete_queryset() also with the delete_model(). -
Django Channels: WebSocket Consumer event handling method doesnt get trigerred
I'm working on a Django project using Django Channels with Redis as the channel layer. My setup allows WebSocket connections, and I am able to send and receive data from Redis without issues. However, when I try to send data to specific WebSocket channels using self.channel_layer.send, the send_online_users method in my AsyncWebsocketConsumer is not triggered. I’ve verified that my Redis server is working and communicating with the Django server. The channels and users are being stored correctly in Redis. The self.channel_layer.send() function runs without throwing errors, but the send_online_users method is never triggered (the print statements inside send_online_users do not show in the logs). Here is my Consumers.py code: from channels.generic.websocket import AsyncWebsocketConsumer import redis from django.conf import settings import redis.client from asgiref.sync import sync_to_async import json from channels.layers import get_channel_layer redis_client = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=0) class UserActivityConsumer(AsyncWebsocketConsumer): async def connect(self): self.user = self.scope['user'] if self.user.is_anonymous or not self.user.is_authenticated: await self.close() else: self.channel_name = f'user_activity_{self.user.username}' await sync_to_async(redis_client.sadd)('online_users', self.user.id) await sync_to_async(redis_client.sadd)("online_channels",self.channel_name) await self.accept() await self.send_to_all() async def disconnect(self,close_code): user_id = self.scope['user'].id await sync_to_async(redis_client.srem)("online_users", user_id) await sync_to_async(redis_client.srem)("online_channels", self.channel_name) await self.send_to_all() async def send_to_all(self): try: online_users = await sync_to_async(redis_client.smembers)("online_users") online_users = [int(user_id) for user_id in online_users] online_channels = await sync_to_async(redis_client.smembers)("online_channels") channel_layer = get_channel_layer() … -
Why in the Django + Tailwindcss project, styles are used in one file and not in another?
Here is the project's file system: enter image description here All classes work in this file: file: navbar.html <nav class="bg-white shadow-lg"> <div class="max-w-6xl max-auto px-4"> <div class="flex justifly-between"> <div class="space-x-7"> <div class="flex"> <a href="#" class="flex items-center px-2 py-4"> <img class="h-8 w-8" src="{% static 'myapp/images/logo.png' %}" alt="logo"> <span class="font-semibold text-xl"> Shop </span> </a> </div> <div class="items-center flex space-x-1"> <a href="#" class="py-4 px-2 font-semibold border-b-4 border-black ">Sell</a> <a href="#" class="py-4 px-2 font-semibold ">Sold</a> <a href="#" class="py-4 px-2 font-semibold ">Home</a> </div> </div> </div> </div> </nav> In this file tailwind classes for some reason do not work. Why is this happening??? file: contacts.html <div class=" p-10 grid grid-cols-1 sm:grid-cols-1 md:grid-cols-3 xl:grid-cols-3 lg:grid-cols-3 gap-3 "> {% for item in items %} <a href="{% url 'site:detail' item.id %}"> <div class=" px-10 py-10 rounded overflow-hidden shadow-lg"> <img src="{{item.images.url}} " alt="img"> {{item.name}} {{item.price}} <br> </div> </a> {% endfor %} </div> Why does tailwind work in one part of the code and not in another? Even though both files are in the same folder. You need to make tailwind work in the contacts.html file. -
i'm trying to acess my django project admin page(local) and i keep getting this trackback
ModuleNotFoundError at /admin/login/ No module named 'users.backends' Request Method: GET Request URL: http://127.0.0.1:8000/admin/login/?next=/admin/ Django Version: 5.0.6 Exception Type: ModuleNotFoundError Exception Value: No module named 'users.backends' Exception Location: <frozen importlib._bootstrap>, line 1324, in _find_and_load_unlocked Raised during: django.contrib.admin.sites.login Python Executable: C:\Users\DELL\Documents\Jamor_tech\Jam_T\Jam_T\Scripts\python.exe Python Version: 3.12.3 Python Path: ['C:\\Users\\DELL\\Documents\\Jamor_tech\\Jam_T', 'C:\\Users\\DELL\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip', 'C:\\Users\\DELL\\AppData\\Local\\Programs\\Python\\Python312\\DLLs', 'C:\\Users\\DELL\\AppData\\Local\\Programs\\Python\\Python312\\Lib', 'C:\\Users\\DELL\\AppData\\Local\\Programs\\Python\\Python312', 'C:\\Users\\DELL\\Documents\\Jamor_tech\\Jam_T\\Jam_T', 'C:\\Users\\DELL\\Documents\\Jamor_tech\\Jam_T\\Jam_T\\Lib\\site-packages'] Server time: Sun, 29 Sep 2024 18:06:12 +0000. i tried "http://127.0.0.1:8000/admin" on my browser expecting my admin page so that i can test my superuser details as well as generally testing the whole project, -
Django ` [ERROR] Worker (pid:7) was sent SIGKILL! Perhaps out of memory?` message when uploading large files
My dockerized Django app allows users to upload files(uploaded directly to my DigitalOcean Spaces). When testing it on my local device(and on my Heroku deployment) I can successfully upload small files without issue. However when uploading large files, e.g. 200+MB, I can get these error logs: [2024-09-29 19:00:51 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:7) web-1 | [2024-09-29 19:00:52 +0000] [1] [ERROR] Worker (pid:7) was sent SIGKILL! Perhaps out of memory? web-1 | [2024-09-29 19:00:52 +0000] [29] [INFO] Booting worker with pid: 29 The error occurs about 30 seconds after I've tried uploading so I suspect it's gunicorn causing the timeout after not getting a response. I'm not sure what to do to resolve it. other than increasing the timeout period which I've been told is not recommended. Here is my code handling file upload: views.py: @csrf_protect def transcribe_submit(request): if request.method == 'POST': form = UploadFileForm(request.POST, request.FILES) if form.is_valid(): uploaded_file = request.FILES['file'] request.session['uploaded_file_name'] = uploaded_file.name request.session['uploaded_file_size'] = uploaded_file.size session_id = str(uuid.uuid4()) request.session['session_id'] = session_id try: transcribed_doc, created = TranscribedDocument.objects.get_or_create(id=session_id) transcribed_doc.audio_file = uploaded_file transcribed_doc.save() ... except Exception as e: # Log the error and respond with a server error status print(f"Error occurred: {str(e)}") return HttpResponse(status=500) ... else: return HttpResponse(status=500) else: form = … -
Why does my Celery task not start on Heroku?
I currently have a dockerized django app deployed on Heroku. I've recently added celery with redis. The app works fine on my device but when I try to deploy on Heroku everything works fine up until the Celery task should be started. However nothing happens and I don't get any error logs from Heroku. I use celery-redis and followed their setup instructions but my task still does not start when I deploy to Heroku. Here is my code: heroku.yml: setup: addons: plan: heroku-postgresql plan: heroku-redis build: docker: web: Dockerfile celery: Dockerfile release: image: web command: python manage.py collectstatic --noinput run: web: gunicorn mysite.wsgi celery: celery -A mysite worker --loglevel=info views.py: from celery.result import AsyncResult task = transcribe_file_task.delay(file_path, audio_language, output_file_type, 'ai_transcribe_output', session_id) task.py: from celery import Celery app = Celery('transcribe')# @app.task def transcribe_file_task(path, audio_language, output_file_type, dest_dir, session_id): print(str("TASK: "+session_id)) #rest of code return output_file celery.py: from future import absolute_import, unicode_literals import os from celery import Celery from django.conf import settings os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") app = Celery("mysite") app.config_from_object("django.conf:settings", namespace="CELERY") app.autodiscover_tasks() I ensured that my CELERY_BROKER_URL and CELERY_RESULT_BACKEND are getting the correct REDIS_URL from environment variables by having it printing it's value before the task is to be started. So I know that's not … -
Google Login with Django and React
I am trying to integrate google login with Django and React (Vite) but I keep getting an error. I have set up the credential on google cloud console, I use @react-oauth/google for the login in the frontend. The login in the frontend goes through but not the backend. I don't know what I am doing wrong. Below is the error and the code. The frontend works well but the backend has issues settings.py AUTH_USER_MODEL = "base.User" # Application definition INSTALLED_APPS = [ "django.contrib.sites", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", # App "base", # Third party apps "rest_framework", "rest_framework.authtoken", "dj_rest_auth", "dj_rest_auth.registration", "allauth", "allauth.account", "allauth.socialaccount", "allauth.socialaccount.providers.google", "corsheaders", # Debug toolbar for development "debug_toolbar", ] SITE_ID = 1 MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "corsheaders.middleware.CorsMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.contrib.auth.middleware.AuthenticationMiddleware", "django.contrib.messages.middleware.MessageMiddleware", "allauth.account.middleware.AccountMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", "debug_toolbar.middleware.DebugToolbarMiddleware", ] AUTHENTICATION_BACKENDS = [ "base.auth_backends.CaseInsensitiveModelBackend", "allauth.account.auth_backends.AuthenticationBackend", ] # Social login settings CALLBACK_URL = config("CALLBACK_URL") LOGIN_REDIRECT_URL = "/api/auth/google/callback/" SOCIALACCOUNT_LOGIN_ON_GET = True ACCOUNT_EMAIL_VERIFICATION = "none" ACCOUNT_AUTHENTICATION_METHOD = "email" ACCOUNT_EMAIL_REQUIRED = True SOCIALACCOUNT_PROVIDERS = { "google": { "APP": { "client_id": config("CLIENT_ID"), "secret": config("CLIENT_SECRET"), "key": "", }, "SCOPE": [ "profile", "email", ], "AUTH_PARAMS": { "access_type": "online", }, "METHOD": "oauth2", # "REDIRECT_URI": "http://localhost:8000/api/auth/google/callback/", } } # Simple jwt config for dj-rest-auth SIMPLE_JWT = { "ROTATE_REFRESH_TOKENS": True, "ACCESS_TOKEN_LIFETIME": … -
502 Bad Gateway: Permission Denied for Gunicorn Socket
2024/09/29 14:04:13 [crit] 6631#6631: *1 connect() to unix:/home/ubuntu/myproject/Ecom_project/ecom_p/gunicorn.sock failed (13: Permission denied) while connecting to upstream, client: 103.175.89.121, server: ecomweb-abhishadas.buzz, request: "GET / HTTP/1.1", upstream: "``http://unix``:/home/ubuntu/myproject/Ecom_project/ecom_p/gunicorn.sock:/", host: "www.ecomweb-abhishadas.buzz" What I Tried: Checked Socket Permissions: I ran the command ls -l /home/ubuntu/myproject/Ecom_project/ecom_p/gunicorn.sock to verify the permissions of the socket file. I noticed that the permissions did not allow the Nginx user (www-data) to access the socket. Changed Socket Permissions: I modified the permissions of the socket file using chmod to ensure that the Nginx user has the necessary permissions to access it. Example command: sudo chmod 660 /home/ubuntu/myproject/Ecom_project/ecom_p/gunicorn.sock Set Socket Ownership. I ensured that the socket file is owned by the user running Gunicorn (e.g., ubuntu or whatever user you specified). Example command: sudo chown ubuntu:www-data /home/ubuntu/myproject/Ecom_project/ecom_p/gunicorn.sock Restarted Services. I restarted both Nginx and Gunicorn to apply the changes. Commands used: sudo systemctl restart nginx sudo systemctl restart gunicorn (or the specific command you use to start Gunicorn). What I Was Expecting: I was expecting that after adjusting the permissions and ownership of the Gunicorn socket file, Nginx would be able to connect to Gunicorn without the permission denied error. This would allow my Django application to be served properly, resolving … -
BaseForm.__init__() got an unexpected keyword argument 'my_username'
once i made a simple login form in django i got this error i searched a lot but i found nothing i read many articles here and github enter image description here this is my form code and views code. i made it with html it worked but in django project i created file named it form.py wrote the code once trying to run server got this error i tried searching in the documention of django can any one help please -
In Django `import-export` lib how to pass row if values in few rows don't meet specific conditions?
I have a few dynamic fields (2) in ModelResource class. I need to export a row only if at least one of those fields has a value: +----+-------+-------+ | ID | col A | col B | +====+=======+=======+ | 1 | | value | # <-- exports +----+-------+-------+ | 2 | value | | # <-- exports +----+-------+-------+ | 3 | | | # <-- passes as no values in both columns +----+-------+-------+ Is there a way to achive this goal in import-export lib or I have to edit a tablib dataset ? P.S. Data exports to Excel if that matters. -
Why is there no answers for programming on android? [closed]
There is no answers for programmming on android. Why? I have tried to check everywhere but i only get anders for PC. -
Frontend and backend servers behind Nginx - CORS problem
Here is a newbie question about having two servers behind nginx. I have two applications, nextjs frontend, and django backend. Nextjs listens to the port 127.0.0.1:3000, and django serves its api on 127.0.0.1:8000/api. The two apps are behind nginx server, which itself listens at the port 38. The idea is to make the django backend completely inaccessible from the outside. How do I setup nginx configuration, so that django api sees the nextjs requests as coming from 127.0.0.1:3000, rather than 127.0.0.1:38? I have set up the django CORS_ALLOWED_ORIGINS to "http://127.0.0.1:3000" and would like to keep i that way. Here is one of the several nginx conf file variants that I tried (none worked) server { listen 38; location /api { proxy_pass http://127.0.0.1:8000; # Forward API requests to Django proxy_set_header Host $host; # Preserve the original Host header proxy_set_header X-Real-IP $remote_addr; # Pass the real IP of the client proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Pass the forwarded IP proxy_set_header X-Forwarded-Proto $scheme; # Pass the protocol (http or https) } location / { proxy_pass http://127.0.0.1:3000; # Forward all other requests to Next.js proxy_set_header Host $host; # Preserve the original Host header proxy_set_header X-Real-IP $remote_addr; # Pass the real IP of the client proxy_set_header … -
Redirection link is wrong after login
When I try to logout, I'm getting this error Page not found (404) Request Method: GET Request URL: http://127.0.0.1:8000/logout/registration/login Using the URLconf defined in SHADOW.urls, Django tried these URL patterns, in this order: The current path, logout/registration/login, didn’t match any of these. You’re seeing this error because you have DEBUG = True in your Django settings file. Change that to False, and Django will display a standard 404 page. The problem is that after logging in the page isn't redirecting to the index page even though I have it already I have set the login and logout redirection URL in my settings.py. LOGIN_REDIRECT_URL = 'scanner/index/' LOGOUT_REDIRECT_URL = '/accounts/login/' LOGIN_URL = '/accounts/login/' I found something where I can get out of this by making the logout request as POST required but then the URL(http://127.0.0.1:8000/logout/) loads to a blank page. It might be because its trying to load the logout page but I don't want that. I don't understand why the request URL is http://127.0.0.1:8000/logout/registration/login when the redirection URL is different it should have been the empty path which is http://127.0.0.1:8000/ these are my views https://ctxt.io/2/AAC4cSUxEQ my URL patterns https://ctxt.io/2/AAC4BSIiFg -
How to create build of Djnago web app rest api project, and what are the tools which can be possible use to create build?
I have developed Django web app in which rest Api's are written using Django rest framework. I have used visual studio code for coding. Now I want to create build of that project. I am new to build tools. Please list build tools which can be used for Django web app and guide in creating build. I am new to Django as well as for build tools, I searched for build tools for Django, but I am not getting any relevant information, which I can understand and implement. -
How to make this div go to the bottom?
how can i make this div go to the botttom? here's the code <div class="container-fluid"> <div class="row customRows"> <div class="col col-md-3"> <div class="d-flex mb-4"> <img src="{% static '/img/cat.png' %}" alt="Logo" class="img-fluid w-25 align-self-center"> <h1 class="heading-4 align-self-center">Que vamos a estudiar hoy?</h1> </div> <ul class="m-0 p-0"> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2"> Inicio </p> </a> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2"> Chat </p> </a> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2"> Ingresa a tu clase </p> </a> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2"> Buscar clases </p> </a> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2"> Calendario </p> </a> </ul> <div class="text-center"> <img src="{% static '/img/laying.png' %}" alt="" class="w-75"> </div> <div class="profileContainer row p-2 mt-auto"> <div class="col-2"> <img src="{% static '/img/girl3.png' %}" class="w-100"> </div> <div class="col-10 my-auto"> <a href="#" class="text-decoration-none"> <p class="parrafo menuItem rounded-2 p-2 m-0"> Nombre Usuario </p> </a> </div> </div> </div> <div class="col col-md-9"></div> </div> the things that i've tried are mt-auto class from bootstrap, mb-auto from bootstrap (to check if the ul pushed the container to the bottom), marging-bottom auto in css, d-flex and flex-column with flex grow (this kinda worked but changed the distribution of the content). .menuItem { transition: background-color 0.3s … -
Can Django identify first-party app access
I have a Django app that authenticates using allauth and, for anything REST related, dj-rest-auth. I'm in the process of formalising an API My Django app uses the API endpoints generally via javascript fetch commands. It authenticates with Django's authentication system (with allauth). It doesn't use dj-rest-auth for authentication, it uses the built in Django auth system. My Discord bot uses the API as would be typical of a third-party app. It authenticates via dj-rest-auth, meaning it internally handles the refresh and session tokens as defined in dj-rest-auth's docs. Currently the API is completely open, which means anyone could use cURL to access the endpoints, some of which an anonymous user can access. Others, require an authenticated user, and this is done with the request header data: Authorization: Bearer, as what dj-rest-auth takes care of (this is what my Discord bot uses). I now want to expand on this by incorporating the Django Rest Framework API package so that API Keys are required to identify thirdparty client apps. For example, my Discord bot would use the Authorization: Api-Key header data to identify itself as an API client. It would be up to the thirdparties to make sure their API key …