Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How can I modify the keys in Django Auth ADFS claims mapping?
I am using django-auth-adfs to authenticate Azure AD users on my django backend, this works fine for users within my organization. For users in other organizations however, there are certain keys defined in my CLAIMS_MAPPING that aren't returned in the JWT token. I have tried different suggestions I found to get those keys to be present but non have worked for me, so I decided to just make use of the keys present in both tokens (tokens from my organization and tokens from outside my organization). For example, I changed 'USERNAME_CLAIM': 'upn' to 'USERNAME_CLAIM': 'email' because the upn key is not present in both tokens but the email key is and they pretty much return the same values. My problem right now is with the first_name and last_name keys. With tokens from my organization, this mapping works fine: 'CLAIM_MAPPING': {'first_name': 'given_name', 'last_name': 'family_name', 'email': 'upn'}, However the key family_name does not exist in tokens from outside my organization. The name key exists in both tokens, so I thought to .split(" ") the name key and get the parts but I am not sure how to go about this since the mapping is to a string representing a key in the … -
Django rest framework create or update in POST resquest
can anyone help please, with DRF according to POST request, I want to create(if not exists) or update() table belows are my codes model.py class User1(models.Model): user = models.CharField(max_length=10) full_name = models.CharField(max_length=20) logon_data = models.DateTimeField(blank=True, null=True) serializer.py class UserSerializer(serializers.ModelSerializer): class Meta: model = User1 fields = '__all__' views.py from .models import User1 from .serializers import UserSerializer from rest_framework.response import Response from rest_framework.decorators import api_view @api_view(['GET', 'POST']) def UserView(request): if request.method == 'GET': users = User1.objects.all() serializer = UserSerializer(users, many=True) return Response(serializer.data) elif request.method == 'POST': users = User1.objects.all() serializer = UserSerializer(data=request.data, many=True) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=201) return Response(serializer.errors, status=400) urls.py from django.urls import path from . import views urlpatterns = [ path('users/', views.UserView), ] when POST request, I want to check like this: if user exists: if user.full_name == request.fullname update (user.logon_data) save() else: update (user.full_name) update (user.logon_data) save() else: create( user = request.user, full_name = request.full_name, logon_data = request.logon_date) save() POST request for JSON like this: [ { "user": "testuser1", "full_name": "test user1", "logon_data": "2022-10-19 09:37:26" }, { "user": "testuser2", "full_name": "test user2", "logon_data": "2022-10-20 07:02:06" } ] -
Does npm server is necessary for ReactJS with django on production?
I have developped the application with DJango + ReactJS when in developpment, using $python manage.py runserver and $yarn start which launche the two servers on localhost:8000 and localhost:3000 However in production environment, I need to launch two servers?? When I use webpack before I run two server in developpment environment, but in Production just building in advance and use only on one server uwsgi -
"django.core.exceptions.ImproperlyConfigured:" while doing migrations to posgreSQL
I created a table in models.py and also added the connection to my PostgreSQL database in settings.py. But when I do the migrations in the command prompt I get these error ` django.core.exceptions.ImproperlyConfigured: 'django.db.backends.posgresql' isn't an available database backend or couldn't be imported. Check the above exception. To use one of the built-in backends, use 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'postgresql', 'sqlite3' ` I have installed Django through command prompt but still I don't know why I get these error. I was expecting a successful migration of my table to PostgreSQL data base. -
deploy django app to vps server using cyberpanel
I am trying to deploy django app to vps server using cyberpanel.I followed the steps in the doc, here is the link to the doc (https://community.cyberpanel.net/t/how-to-setup-django-application-on-cyberpanel-openlitespeed/30646), but the site gives 500 Internal Server Error In the Error log, this error appears 2022-10-31 06:15:44.516946 [INFO] [126625] [wsgi:futuurelineworkshop.com:/]: locked pid file [/tmp/lshttpd/futuurelineworkshop.com:.sock.pid]. 2022-10-31 06:15:44.516975 [INFO] [126625] [wsgi:futuurelineworkshop.com:/] remove unix socket for detached process: /tmp/lshttpd/futuurelineworkshop.com:.sock 2022-10-31 06:15:44.517516 [NOTICE] [126625] [LocalWorker::workerExec] VHost:futuurelineworkshop.com suExec check uid 99 gid 99 setuidmode 0. 2022-10-31 06:15:44.517541 [NOTICE] [126625] [LocalWorker::workerExec] Config[wsgi:futuurelineworkshop.com:/]: suExec uid 99 gid 99 cmd /usr/local/lsws/fcgi-bin/lswsgi -m /home/futuurelineworkshop.com/public_html/workShop2/WorkShop/wsgi.py, final uid 99 gid 99, flags: 0. 2022-10-31 06:15:44.518080 [NOTICE] [126625] [wsgi:futuurelineworkshop.com:/] add child process pid: 146100 2022-10-31 06:15:44.518154 [INFO] [126625] [wsgi:futuurelineworkshop.com:/]: unlocked pid file [/tmp/lshttpd/futuurelineworkshop.com:_.sock.pid]. 2022-10-31 06:15:45.031045 [NOTICE] [126625] [127.0.0.1:44700#futuurelineworkshop.com] Premature end of response header. I am trying to deploy django app to vps server using cyberpanel.I followed the steps in the doc, here is the link to the doc (https://community.cyberpanel.net/t/how-to-setup-django-application-on-cyberpanel-openlitespeed/30646), but the site gives 500 Internal Server Error In the Error log, this error appears -
Form Filter with Pagination not working in Django
I am trying to use Form filters and Pagination together in a view and only one works at one point of time, I am not able to make both work together, Please help if there is a workaround to my problem. views.py ` def viewAmc(request): amc = Amc.objects.all() paginator = Paginator(amc, 10) page_obj = paginator.page(request.GET.get('page', '1')) amcFilter = AmcFilter(request.GET, queryset=amc) amc = amcFilter.qs#qs means query set context = {'amc': page_obj, 'amcFilter': amcFilter} return render(request, 'view_amc.html', context) ` filters.py ` class AmcFilter(django_filters.FilterSet): class Meta: model = Amc fields = 'amc_type', 'amc_status' ` view_amc.html ` {% extends 'base.html' %} {% load static %} {% block content %} <br> <div class="row"> <div class="col-md-8"> <div class="card card-body"> <h5>&nbsp; Annual Maintenance Contract :</h5> <div class="card card-body"> <form method="get"> {{ amcFilter.form.amc_type.label_tag }}{{ amcFilter.form.amc_type }} {{ amcFilter.form.amc_status.label_tag }}{{ amcFilter.form.amc_status }} <button class="btn btn-primary" type="submit">Filter</button> </form> </div> <div class="col"> </div> <div class="card card-body"> <a class="btn btn-primary btn-sm btn-block" href="{% url 'create_amc' %}">Create New AMC</a> <table class="table table-sm"> <tr> <th>Customer</th> <th>Location</th> <th>AMC ID</th> <th>AMC Type</th> <th>AMC Status</th> <th>AMC Cost</th> <th>AMC Start</th> <th>AMC Expiry</th> </tr> {% for items in amc %} <tr> <td>{{ items.customer }}</td> <td>{{ items.location }}</td> <td>{{ items.name }}</td> <td>{{ items.amc_type }}</td> <td>{{ items.amc_status }}</td> <td>{{ items.amc_cost }}</td> … -
How api_key for 3rd party application works?
In my project i want to provide data with APIs what is the better way to generate and auth api-keys. BTW i'm using python django. tried django-rest-framework-api-keys but not worked. -
How to override the help messages shown in Django's "set password" step?
I replaced the password set's step HTML with my own HTML, so far everything's good. Thing is, all tutorials seem to use the {{form.as p}} part when the user is changing their password, so the code will be left like this: {% extends "account/base.html" %} {% load static %} {% block title %}Password recovery{% endblock title %} {% block content %} {% if validlink %} <h1>Password change</h1> <form method="POST"> {% csrf_token %} {{ form.as_p }} <input type="submit" value="Change password"> </form> {% else %} <h1>Error.</h1> <p>Please try again.</p> {% endif %} {% endblock%} Thing is, when testing it, the page displays this additional help text: Your password can’t be too similar to your other personal information. Your password must contain at least 8 characters. Your password can’t be a commonly used password. Your password can’t be entirely numeric. And I want to modify that text. I looking for the validator's class in password_validation.pyi at contrib.auth, and calling it from a forms.py I created in my "login" app, changing the "get_help_text" function this way def get_help_text(self): return ngettext( "Blah blah, text changed", "Blah blah, text changed", self.min_length ) % {'min_length': self.min_length} But it doesn't seem to be changed in the set password … -
image not showing in browser using easy thumbnail with Amazon S3 in Django Project
working on django project and use easy thumbnail for croping the images. Previously i used the in local enviornment and its working fine. but when i move media to Amazon S3 then images not showing (could not load the image) in browser. easy-thumbnail library link image tag in template:- image tag in browser:- But when i remove the (.1200x800_q95_crop.jpg) this part through web developer tools in img tag. then its working. but image size and crop option not working. I want to crop and resize image when its showing in browser. -
How to inspect oracle database without primary key in django
command: python .\manage.py inspectdb --database=ORACLE > models.py This command run successfully. But models.py output is # Unable to inspect table 'acc_advance_other_adj_dt' # The error was: ORA-00904: "USER_TAB_COLS"."IDENTITY_COLUMN": invalid identifier # Unable to inspect table 'acc_ari_entries_dt' # The error was: ORA-00904: "USER_TAB_COLS"."IDENTITY_COLUMN": invalid identifier # Unable to inspect table 'acc_asset_mt' # The error was: ORA-00904: "USER_TAB_COLS"."IDENTITY_COLUMN": invalid identifier -
{% for top in topwear.brand %} is not executing
I want to list the items by brand so user can choose according to the brand of the product in the sidebar but somehow it is not happenning `your text`` views.py class home(View): def get (self,request): products=Product.objects.all() topwear=Product.objects.filter(Category='TW') bottomwear=Product.objects.filter(Category='BW') context={'topwear':topwear,'bottomwear':bottomwear,'products':products} return render(request,'store/index.html',context) models.py your text class Product(models.Model): category=[ ('TW','Top Wear'), ('BW','Bottom Wear'), ('Shoes','Shoes'), ('mobile','mobile'), ('Laptop','Laptop') ] title=models.CharField(max_length=100) selling_price=models.FloatField() discounted_price=models.FloatField() description=models.TextField() brand=models.CharField(max_length=100) Category=models.CharField(choices=category,max_length=10) product_image=models.ImageField(upload_to='productimg') def __str__(self): return str(self.id) Bottom wear and mobile section is showing but not topwear section. index.html your text <div class="dropdown-menu position-absolute bg-secondary border-0 rounded-0 w-100 m-0"> {% for top in topwear.brand %} <a href="{% url 'searchproduct' top %}" class="dropdown-item">Top Wear</a> {% endfor %} <a href="" class="dropdown-item">Bottom Wear</a> <a href="" class="dropdown-item">Mobile</a> </div> Everything else is running file .Just top wear section is not showing in browser. Is this syntax not correct? Help will be appreciated -
how can i search for a keyword in order django
content = request.query_params.get('search') searchList = list(content.strip(" ")) resultLoop= Medicines.objects.filter(name__icontains=searchList[0]) for letter in searchList: resultLoop = resultLoop.filter(name__icontains=letter) this is the how I manage to get the result which contains all the letters that the keyword contains, but it is a scrambled result. ie. if am searching 'abc' from ['abcd','bcda','cdab','adbc'], it returns all the four elements because it contains all the letter that the keyword has, What I need is, only two elements which is in the actual order of the keyword. Those are ['abcd','abdc'] -
Django - Copy and edit data from one model into another
I have a 'Services' model that contains a user's templated services. I have a 'serviceSelect' model that I want to be able to copy and a template from 'Services' into the 'ServiceSelect' model which will then be related to a proposal and can be edited. I have a ServiceSelectForm that has initial dropdown data from the 'Service' model. I am trying to be able to select a 'service' from the drop-down and copy it into the 'ServiceSelect' model for later editing. When I try to do this I'm getting: Cannot assign "'a303adbb9bd4'": "Proposal.services" must be a "ServiceSelect" instance. This is what I have tried: **Service model ** There are only a few entries as these are templated services. title = models.CharField(null=True, blank=True, max_length=100) discription = models.TextField(null=True, blank=True) category = models.CharField(choices=CATEGORY, blank=True, max_length=100) quantity = models.FloatField(null=True, blank=True) price = models.FloatField(null=True, blank=True) paymentTerms = models.CharField(choices=PAYMENT, blank=True, max_length=100) salesTax = models.CharField(choices=SALESTAX, blank=True, max_length=100) uniqueId = models.CharField(null=True, blank=True, max_length=100) slug = models.SlugField(max_length=500, unique=True, blank=True, null=True) date_created = models.DateTimeField(blank=True, null=True) last_updated = models.DateTimeField(blank=True, null=True) def __str__(self): return '{} {}'.format(self.title, self.uniqueId) def get_absolute_url(self): return reverse('product-detail', kwargs={'slug': self.slug}) def save(self, *args, **kwargs): if self.date_created is None: self.date_created = timezone.localtime(timezone.now()) if self.uniqueId is None: self.uniqueId = str(uuid4()).split('-')[4] self.slug … -
Django ORM Using Dynamic Variable To Get Object Field Value
my_dict['name'] = my_model.objects.get(pk=pk).object_name I need ".object_name" to be a dynamic variable. I tried creating a variable and adding it to the end. my_model.objects.get(pk=pk).variable_name my_model.objects.get(pk=pk)variable_name etc... When I try to add a variable to the end of the query it throws an error. "Object has no attribute 'variable_name'". "Statements must be separated by a new line or semicolon." I'm sure there must be some other way to write this but I can't find any information to achieve this. -
How to fix type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast error
Hi I am new to flutter & dart. I am trying to get the api of Django Rest Framework using the following test.dart import 'dart:convert'; import 'package:http/http.dart' as http; // var response = await http.get(Uri.parse("http://127.0.0.1:8000/")); // print(response.body); Future<void> main() async { final response = await http.get(Uri.parse("http://127.0.0.1:8000/api/Username/items/")); final decoded = jsonDecode(response.body) as Map; final data = decoded['data'] as Map; print(data['name']); for (final name in data.keys) { final value = data[name]; print('$name,$value'); } } Here is the api.views @api_view(['GET']) def getItem(request, **kwargs): user = get_object_or_404(User, username=request.user) items=Item.objects.filter(user=user) serializer = ItemSerializer(workouts, many=True) return Response(serializer.data) Here is the api/urls: path('<str:username>/workouts/',views.getWorkout, name='api_workout'), Here is the serializer.py class ItemSerializer(serializers.ModelSerializer): user = serializers.CharField(source="user.username", read_only=True) class Meta: model= Workout fields = '__all__' I am not sure why I am getting: Unhandled exception: type 'Null' is not a subtype of type 'Map<dynamic, dynamic>' in type cast #0 main bin\test.dart:11 <asynchronous suspension> My question: Why am i getting this error and how can I get access to the api json in the mentioned http -
Subscription System IAP using some language of backend
I want to create a management subscription IAP for my app in Flutter, I don't want to use renewcat or other like that. I want to create my own backend Manager What is the best option for create faster? and what do I need, this system is like to a CRUD? exist some Api or tools for make easy this work? Sorry for my doubt, I tried looking information about but I didn't found nothing. -
python sleep for second to throttle requests
I have a celery periodic task which has a function call inside it i need to make the code sleep for a second for every 20 emails sent how can i achieve that. @app.task(bind=True) def send_email_reminder_on_due_date(self): send_email_from_template( subject_template_path='emails/subject.txt', body_template_path='emails/template.html', template_data=template_data, to_email_list=email_list, fail_silently=False, content_subtype='html' ) i have some condition before send_email_from_template i.e fetching records from database whose due_date is today and i will be sending email for all the records which i fetch let's say i have 30 records for which i need to send an email to so i would do sleep for 1 second after the email function gets executed for 20 records. -
Celery does not start when running on docker with Django, RabbitMQ with docker-compose
I have a docker-compose that contains the the following components: django, rabbitmq and celery. However for whatever reason, my celery itself does not seem to be starting. When i use the frontend to send a task (which should pass to celery), it fails. This is my docker-compose file version: "3.9" services: django: build: context: . args: build_env: production ports: - "8000:8000" command: > sh -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" volumes: - .:/code links: - rabbitmq - celery rabbitmq: container_name: rabbitmq restart: always image: rabbitmq:3.10-management ports: - "5672:5672" # specifies port of queue - "15672:15672" # specifies port of management plugin celery: container_name: celery restart: always build: context: . args: build_env: production command: - "celery worker -A kraken.celery -l info" depends_on: - rabbitmq Dockerfile ARG PYTHON_VERSION=3.9-slim-buster # define an alias for the specfic python version used in this file. FROM python:${PYTHON_VERSION} as python # Python build stage FROM python as python-build-stage ARG build_env # Install apt packages RUN apt-get update && apt-get install --no-install-recommends -y \ # dependencies for building Python packages build-essential \ # psycopg2 dependencies libpq-dev # Requirements are installed here to ensure they will be cached. COPY ./requirements . # Create Python Dependency and … -
Using django forms with separate models for labels and fields
I apologize in advance if this ends up sounding cryptic... I'm building a site using Django where users can select a topic from a list and then fill out a form that contains questions specific to that topic. I have 2 models: the Topic model is for the different topics and contains the specific questions for each. The Answers model is for the answers that are submitted in the form. The Answers model is linked to the Topic model with a foreign key. I currently have everything working the way that I want it to, but very messily. I am using purely html forms, and each input label is populated with the question text saved in the Topic model. What I am doing is running JavaScript when the form is submitted, querying all the form fields, and then using fetch to send a POST request with all the field text. Then in my views.py, I receive the request, get all the data, and save a new instance of the Answers model. I'm not well versed in form security, other than knowing to use a csrf token. Out of consideration for any SQL injection vulnerabilities, I started doing some research and … -
How to redirect http://127.0.0.1:8000/ to login page if the user is not logged in
In my Django project I am trying to make the http://127.0.0.1:8000/ which is the home page to redirect to the Login in Page if user is not logged in however there is a user who is logged in I want http://127.0.0.1:8000/ to become http://127.0.0.1:8000/username/ I have tried different answers but nothing specific lead to this answer: Here is the login view after login: class LoginView(LoginView): template_name = 'login.html' def get_success_url(self): user=self.request.user.username return f'/{user}/' Here is the login urls: path('accounts/login/', LoginView.as_view(redirect_authenticated_user=True,template_name='users/login.html'), name='login'), Here is the home views: class home(LoginRequiredMixin, ListView): model = Item template_name = 'app/home.html' context_object_name = 'items' Here is the app urls: path('<str:username>/', home.as_view(), name='home'), My question: How to redirect home page to http://127.0.0.1:8000/username/ if user is logged in and if not to login page -
Django tests not isolated when testing authentication
I am testing my authentication with the django.test.Client and two tests cases fail because once I test my test_login_success test case, the other tests fail because the user remains authenticated, even when I am instantiating a new client in the class setUp and even deleting the user in the tearDown. My code: from django.test import Client, TestCase from app.users.models import User class TestLogin(TestCase): def setUp(self): super().setUp() self.email = 'test@test.com' self.password = 'SomeRandomPass96' User.objects.create_user(email=self.email, password=self.password) self.client = Client() def tearDown(self): User.objects.filter(email=self.email).delete() super().tearDown() def test_not_authenticated(self): # success the first time, fails after test_login_success is executed for the first time. user = User.objects.get(email=self.email) assert not user.is_authenticated def test_login_success(self): # always success self.client.post( '/users/login/', {'email': self.email, 'password': self.password} ) user = User.objects.get(email=self.email) assert user.is_authenticated def test_login_wrong_credentials(self): # success the first time, fails after test_login_success is executed for the first time. self.client.post( '/users/login/', {'email': self.email, 'password': 'wrongPassword123'} ) user = User.objects.get(email=self.email) assert not user.is_authenticated -
DJANGO + ReactJS | Error when the response is not 200
Getting the below error when sending a 401 (un-authorized) response. As per the error, when I change it to 200, it works well. But here I need to send 401 itself. Access to fetch at 'http://127.0.0.1:8888/employees/api/fetch/home/data/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status. Frontend : ReactJS Backend : Django Any help would be greatly appreciated. -
Django Dynamic URL from Forms
TL;DR - I failed implementing dynamic urls for too long. My plan is: Whenever the form is submitted, it would redirect you to a page (with a pk as the url), that sums up your choices. I'm aware that this was asked multiple times and I was able to implement Dynamic URLs perfectly fine with a new project. Yet, my current one is simply not making any sense to me. I have a simple form with CharField as fields. It renders them from the Models file which states pretty much the same. I added to the Models.py: > task_id = models.AutoField(primary_key=True) The form is inside "hunting.html", and you access it through the navbar: > <a class="nav-link {% if 'hunting' in segment %} active {% endif %}" href="/hunting.html"> My view is quite simple, I recently opted to Class-based (when using function-base it did not work as well): app/views.py class Hunting(LoginRequiredMixin, View): def get(self, request): form = HuntForm() print('Access Hunting') return render(request, 'home/hunting.html', {'form': form}) def post(self, request): form = HuntForm(request.POST, request.FILES) name = request.POST['name'] limit = request.POST['limit'] os = request.POST.getlist('os') mal = request.POST.getlist('mal') my_type = request.POST.getlist('my_type') if form.is_valid(): form.save() print('Hunt information is saved') return redirect('home/index.html') return redirect('home/index.html') app/urls.py: path('', views.index, name='home'), … -
Custom User class, password isn't saved from the form
I've coded my own AbstractBaseUser and BaseUserManager. Creating users and superusers via terminal works fine. But there is a problem with creating users via form. All user fields are saved properly except password field, which is blank. My models.py: from django.db import models from django.utils import timezone from django.utils.translation import gettext_lazy as _ from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager class CustomAccountManager(BaseUserManager): def create_superuser(self, email, first_name, last_name, password, **other_fields): other_fields.setdefault('is_staff', True) other_fields.setdefault('is_superuser', True) other_fields.setdefault('is_active', True) if other_fields.get('is_staff') is not True: raise ValueError( 'Superuser must be assigned to is_staff=True.') if other_fields.get('is_superuser') is not True: raise ValueError( 'Superuser must be assigned to is_superuser=True.') return self.create_user(email, first_name, last_name, password, **other_fields) def create_user(self, email, first_name, last_name, password, **other_fields): if not email: raise ValueError(_('You must provide an email address')) email = self.normalize_email(email) user = self.model(email=email, first_name=first_name, last_name=last_name, **other_fields) user.set_password(password) user.save() return user class MyUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('email address'), unique=True) first_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=False) objects = CustomAccountManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['first_name', 'last_name'] def __str__(self): return self.email And my forms.py: from django import forms from .models import MyUser class MyUserForm(forms.ModelForm): password = forms.CharField(widget=forms.PasswordInput) class Meta: model = MyUser fields = ['email', 'first_name', 'last_name'] I think there is … -
I'm receiving the error: PermissionError: [Errno 13] Permission denied: '/app/vol'
The full error: The Dockerfile: FROM python:3.9-alpine3.13 LABEL maintainer="arithmeticatuition.com" ENV PYTHONUNBUFFERED 1 COPY ./requirements.txt /requirements.txt COPY ./app /app COPY ./scripts /scripts WORKDIR /app EXPOSE 8000 RUN python -m venv /py && \ /py/bin/pip install --upgrade pip && \ apk add --update --no-cache postgresql-client && \ apk add --update --no-cache --virtual .tmp-deps \ build-base postgresql-dev musl-dev linux-headers && \ /py/bin/pip install -r /requirements.txt && \ apk del .tmp-deps && \ adduser --disabled-password --no-create-home app && \ mkdir -p /vol/web/static && \ mkdir -p /vol/web/static && \ chown -R app:app /vol && \ chmod -R 755 /vol && \ chmod -R +x /scripts ENV PATH="/scripts:/py/bin:$PATH" USER app CMD ["run.sh"] The docker-compose-deploy file: version: '3.9' services: app: build: context: . restart: always volumes: - static-data:/vol/web environment: - DB_HOST=db - DB_NAME=${DB_NAME} - DB_USER=${DB_USER} - DB_PASS=${DB_PASS} - SECRET_KEY=${SECRET_KEY} - ALLOWED_HOSTS=${ALLOWED_HOSTS} depends_on: - db db: image: postgres:13-alpine restart: always volumes: - postgres-data:/var/lib/postgresql/data environment: - POSTGRES_DB=${DB_NAME} - POSTGRES_USER=${DB_USER} - POSTGRES_PASSWORD=${DB_PASS} proxy: build: context: ./proxy restart: always depends_on: - app ports: - 80:8000 volumes: - static-data:/vol/static volumes: postgres-data: static-data: I've tried everything from similar stack exchange requests but none seem to be working... I've rewatched lots of tutorials and I don't seem to be getting anywhere, who would've …