Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How to configure nginx to serve multi-tenant django application
I would like to deploy a django application with the django-tenants library. The project works fine locally, I can create tenants and access them via localhost:8000 Now I am trying to deploy the application on DigitalOcean using docker-compose and I have an issue with configuring the nginx server. As the log suggests I am able to start the gunicorn server on 0.0.0.0:8000 but the proxy can only reach the application like this: wget <DOMAIN>:8000 but not like this: wget <CONTAINER_NAME>:8000 (the container name in the docker-compose yml is 'web') The http response is 504 - Gateway Time-out Here is my NGINX config: server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name .<DOMAIN>; set $base /etc/nginx/sites-available/trackeree.com; # SSL ssl_certificate /etc/letsencrypt/live/trackeree.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/trackeree.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/trackeree.com/chain.pem; # security include /etc/nginx/security.conf; # logging access_log /var/log/nginx/access.log combined buffer=512k flush=1m; error_log /var/log/nginx/error.log warn; location / { uwsgi_pass web:8000; include /etc/nginx/uwsgi.conf; } # Django media location /media/ { alias $base/media/; } # Django static location /static/ { alias $base/static/; } # additional config include /etc/nginx/general.conf; } # non-www, subdomains redirect server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name www.<DOMAIN>; # SSL ssl_certificate /etc/letsencrypt/live/trackeree.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/trackeree.com/privkey.pem; ssl_trusted_certificate /etc/letsencrypt/live/trackeree.com/chain.pem; return 301 https://trackeree.com$request_uri; } # … -
Trying to install pip dependencies from a bash script
Trying the create setup.sh script file in my current Django project's root directory. Don't have too much experience with bash scripting , so to be honest from file access to configuration the issue can be anything. So what I'm trying to run looks like this: setupBackend() { echo "--------------------------- Creating virtual environment ----------------------" pip install --upgrade pip pip install virtualenv virtualenv venv source ./venv/Scripts/active echo "----------------------- Installing dependencies ------------------------------" pip install -r requirements.txt echo "----------------------- Running Django server -------------------------" python ./kudelasz/manage.py runserver } And I have this requirements file containing the dependencies asgiref==3.7.2 colorama==0.4.6 distlib==0.3.6 Django==4.2.2 django-tailwind==3.6.0 djangorestframework==3.14.0 djangorestframework-jsonapi==6.0.0 filelock==3.12.2 inflection==0.5.1 mysqlclient==2.2.0 platformdirs==3.7.0 PyMySQL==1.1.0 PyPDF2==3.0.1 pytz==2023.3 sqlparse==0.4.4 termcolor==2.3.0 tzdata==2023.3 virtualenv==20.23.1 The probalem I'm facing is, that when the script runs the pip installation, it seems to be trying to install all these stuffs to the global python environment. At least that's what I'm assuming, because it tell me this: "Requirement already satisfied: asgiref==3.7.2 in c:\users\customer\appdata\local\programs\python\python311\lib\site-packages (from -r requirements.txt (line 1)) (3.7.2)" at each package installation attempt. I can also see in my venv directory that none of those packages get installed, only the default pip dependencies can be seen. In the end the installation fails due dependency conflicts. For now … -
Cant add image and media files from database on production mode Django Cpanel
i have a website based Django mysql and my problem is when i want to add mediafiles(images and etc) from database in django admin panel , idk why but its doesnt work and its doesn`t show me any error! just 10 second wait and after that it whows me this : This site can’t be reached im using Cpanel and my code in setting is : for url : + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) setting : MEDIA_URL = "media/" MEDIA_ROOT = "/home/samaliz1/public_html/media" STATIC_ROOT = "/home/samaliz1/public_html/static" and model: prof_pic = models.ImageField(upload_to="img/prof_pics", null=True, blank=True) i should say that my staticfiles working perfectly but idk why my media doesnt i will be so thankfull if u guys help me <3 -
Change the default route from / to /docuseal/
I don’t know if it’s the good section but my problem is the following one : In my VM, I have a django server running with gunicorn and nginx and I would like to add a docuseal entity running with ruby on rails on the website (docuseal is also running with nginx). In fact, I figure out how to make my nginx configuration. So I can access docuseal by the url mydomaine/docuseal/, all the other are manage by django. However, all the route in my docuseal app start with ‘/’, but as I say, it’s django part. So I would like to “shift” all the docuseal routes from “/…” to “/docuseal/…”. I tried to make change in config/routes.rb but I didn’t succeed. Can somebody help me please. Thanks you ! -
Django template regroup - unable to print unique data
I want to print the data in my template in the following format Date 1-> Event ID 1a --> Table showing data for that date and event Event ID 2b --> Table showing data for that date and event Date 2-> Event ID 2a --> Table showing data for that date and event Event ID 2b --> Table showing data for that date and event Views.py #some code source_metadata=MetadataTable.objects.filter(sync_id=sync_detail.id) synclogs = SyncLog.objects.filter(sync_id=sync_detail.id) logs_by_date = {} sync_logs = SyncLog.objects.filter(sync_id=sync_detail.id).order_by('-date_added') # Replace with your desired ordering for log in sync_logs: date = log.date_added.date() if date not in logs_by_date: logs_by_date[date] = [] logs_by_date[date].append(log) And templates.py div class="container"> {% for date, logs in logs_by_date.items %} <div class="card"> <div class="card-header"> <a href="#" class="date-link" data-toggle="collapse" data-target="#collapse-{{ date|date:'mdy' }}">{{ date |date:"m/d/y" }}</a> </div> <div id="collapse-{{ date|date:'mdy' }}" class="collapse"> <div class="card-body"> {% with last_event_id=None %} {% for log in logs %} {% if forloop.first or log.sync_event_id != last_event_id %} {% with last_event_id=log.sync_event_id %} <div class="card event-card"> <div class="card-header"> <a href="#" class="event-link" data-toggle="collapse" data-target="#event-collapse-{{ date|date:'mdy' }}-{{ log.sync_event_id }}">Event {{ log.sync_event_id }}</a> </div> <div id="event-collapse-{{ date|date:'mdy' }}-{{ log.sync_event_id }}" class="collapse"> <div class="card-body"> <!-- Display the SyncLog records for the selected date and event in a table --> <table class="table table-nowrap … -
No module named 'attachments.wsgi' in render
I am trying to upload my django project to render but I am finding this error No module found on 'attachment.wsgi' enter image description here I tried to publish the site. Tried to change the wsgi page but no success please help me solve this error or how should the wsgi page be like? -
How do i download and uploaded file in django database?
i have three different files on my database and they belong to users, like each user uploads three different files and they all have a "reg no" as a unique number and i want to download those files base on their "reg no". i will appreciate new code snippet my views.py def download_file(request, regno): regno = request.session.get('reg_no_admin') file = CacAdmin.objects.get(regNo=regno) response = FileResponse(open(file.filePath, 'rb')) response['Content-Type'] = 'application/octet-stream' response['Content-Disposition'] = f'attachment; filename="{file.fileName}"' return response urls.py path('private/download-file/<int:regno>/', views.download_file, name="download_file"), html <a href="{% url 'download_file' file.regNo %}">Download File</a> -
How to make jwt check global
I am adding authoraziation with jwt in react for frontend and django for the backend. When an access token expires I refresh it using axios interceptors. If the refresh token expires then the user logs out. I store the tokens in localStorage and to log out the user I just delete them. useAxios.js .... axiosInstance.interceptors.request.use(async req => { const user = jwt_decode(authTokens.access) const isExpired = dayjs.unix(user.exp).diff(dayjs()) < 1; console.log(isExpired) if(!isExpired) return req const response = await axios.post(`${baseURL}/token/refresh/`, { refresh: authTokens.refresh }).catch(err=>localStorage.clear()) localStorage.setItem('authTokens', JSON.stringify(response.data)) setAuthTokens(response.data) setUser(jwt_decode(response.data.access)) req.headers.Authorization = `Bearer ${response.data.access}` return req }) I have also a file called AuthContext.js where the function to login the user is and where the tokens are made. Home.js ... let api = useAxios() let getUser = async () => { let response = await api.get('http://127.0.0.1:8000/a/') console.log(response.data) if (response.status === 200) { console.log(response.data) } } useEffect(()=>{ console.log('hey') getUser() },[]) ... So basically when the user enters the home page I am sending a request in django where you need to be authenticated to have access. So if the user's refresh token has expired then I log him out. The problem is that I don't want to write the getUser function for every single page to … -
HI i have two models called Category and item and each item has a category please how can i display all the items that are in the same category [closed]
MY MODELS.PY enter image description here MY VIEWS.PY enter image description here MY URLS.PY enter image description here .............................................................................................................................................................................................. ERROR I AM GETTING enter image description here -
User registration was working fine few days ago. Now i get 401 unauthorized response when i try to register in thunder client. am a beginner
I am making a shopify inspired django project using restframework. in my project, I have two types of users, one is the default User model and another is custom user model 'Seller'. Here is the code for the model class SellerUserManager(BaseUserManager): def create_user(self,email,password=None,**extra_fields): email=self.normalize_email(email) user=self.model(email=email,**extra_fields) user.set_password(password) extra_fields.setdefault('is_staff',True) #is_staff will let the user made here to have some admin accesses user.save() return user def create_superuser(self,email,password=None,**extra_fields): # this is a bit unnecessary as seller wont be allowed to acess the administration extra_fields.setdefault('is_superuser',True) return self.create_user(email,password,**extra_fields) # Since sellers would be different types of users they are custom users inherited from abstractbaseuser class Seller(AbstractBaseUser,PermissionsMixin): email=models.EmailField(unique=True,max_length=255,) # i don't have to create a passeord field as it is automatically inherited from abstractuser first_name=models.CharField(max_length=100) last_name=models.CharField(max_length=100) is_active=models.BooleanField(default=True) is_staff=models.BooleanField(default=False) company_name=models.CharField(max_length=100) seller_desc=models.TextField() seller_image=models.FileField(upload_to='seller/sellerImage',null=True) seller_verification=models.FileField(upload_to='seller/sellerVerification',null=True) created_at=models.DateTimeField(auto_now_add=True) updated_at=models.DateField(auto_now=True) status=models.BooleanField(default=False,null=True) #verification status objects=SellerUserManager() USERNAME_FIELD='email' #this makes it so that email is used as a unique identifier and not username EMAIL_FIELD='email' REQUIRED_FIELDS=[] # some errors that was solved by chat gpt that said to do these. groups = models.ManyToManyField('auth.Group', related_name='seller_users') user_permissions = models.ManyToManyField('auth.Permission', related_name='seller_users') def __str__(self): return self.email Here is my serializers.py code: class SellerRegistrationSerializer(serializers.ModelSerializer): class Meta: model=Seller fields=['email','password','first_name','last_name','company_name','seller_desc','seller_image','seller_verification'] extra_kwargs={ 'password':{'write_only':True} } #def create should be done since this is a custom User … -
SignatureDoesNotMatch DigitalOcean Spaces Boto3 Django-Storages Django
You got the following error while using your digital ocean spaces for static files: <Error> <Code>SignatureDoesNotMatch</Code> <RequestId>xxxxx-716fe6ea-xxxx</RequestId> <HostId>xxx-nyc3c-xxx-xxxx</HostId> </Error> GET 403 Forbidden -
For looping in Django not worked
Hi I am newbie in django, I have problem with for looping in django, to make a navbar/menu, I use for looping in html like this: <div class="menu"> <a href="/"> <div class="menu-link klik"> <i class="bx bx-home"></i> <div class="contentMenu hidden">HOME</div> </div> </a> for key,value in menu.items %} <a href="{% url 'app_'|add:key|add:':'|add:key %}"> <div class="menu-link klik"> <i class="{{value}}"></i> <div class="contentMenu hidden">{{key|upper}}</div> </div> </a> endfor %} </div> and the views: from django.shortcuts import render from .forms import ProjectForm def index(request): projectForm = ProjectForm() context = { 'title': 'Achmad Irfan Afandi', 'tile': 'Home', 'subtitle': 'Data Analyst', 'social_media': {'linkedin':'https://www.linkedin.com/in/achmad-irfan-afandi-9661131a6/', 'github':'https://www.github.com/achmadirfana', 'facebook':'https://www.facebook.com/achmad.irfan.754', 'twitter':'https://www.facebook.com/achmad.irfan.754', 'instagram':'https://www.facebook.com/achmad.irfan.754'}, 'menu': {'about': 'bi bi-file-earmark-person', 'education': 'bx bxs-graduation', 'skill': 'bx bx-wrench', 'projects': 'bx bx-building', 'services': 'bx bx-support', 'contact': 'bx bxs-contact'}, 'projectForm': projectForm } return render(request, 'index.html', context) that code above is in main app projec, all the menus are displayed properly like picture above: enter image description here But in another app (btw I use extends tag for all app) , the for looping is not displayed , it just show 'HOME' menu that not include in for looping like picture below: enter image description here Do you know why? or I have to write the menu one by one not use foor … -
Checking if there are security issues with my django form
I hope you can help me clarify some things regarding my django form, which is used for a chat app. Honestly, I don't know a lot about security against hackers, so my concern is mainly related to form security. My questions are simply put... Did I do django form backend validation correctly? I read that backend validation prevents hackers from injecting malicious codes into the database. Are there any other security issues in my code? I hope you can point out even very basic things I might be missing out. Here is my template <form id="post-form"> {% csrf_token %} <input type="hidden" name="user_id" id="user_id" value="{{user_id}}"/> <input type="text" name="var1" id="var1" width="100px" /> <input type="submit" value="Send"> </form> </div> </body> <script type="text/javascript"> $(document).on('submit','#post-form',function(e){ e.preventDefault(); $.ajax({ type:'POST', url:'/submit/', data:{ user_id:$('#user_id').val(), var1:$('#var1').val(), csrfmiddlewaretoken:$('input[name=csrfmiddlewaretoken]').val(), }, success: function(data){ alert(data) } }); document.getElementById('var1').value = '' }); </script> </html> Here is my views.py for the ajax: @login_required def submit(request): if request.method == 'POST': user_id = int(request.POST['user_id']) form = ChatForm(request.POST) if isinstance(user_id, int) and form.is_valid(): chat_instance = form.save(commit=False) user = User.objects.get(id=user_id) chat_instance.var2 = form.cleaned_data['var1']+"edited" chat_instance.user = user if request.user.is_admin: chat_instance.admin = True else: chat_instance.admin= False chat_instance.save() return HttpResponse('Message sent successfully') else: return HttpResponse('Error') return HttpResponse('Not a valid request method') Here is … -
Got an error while running a django project in docker
This site can’t be reached The webpage at http://0.0.0.0:8000/ might be temporarily down or it may have moved permanently to a new web address. ERR_ADDRESS_INVALID I want the correct starting page of first page of project.I tried multiple times, but the error is same. -
how can I stop django-elasticsearch-dsl search_index command from taking input?
In order for django-elastic-dsl to index the documents we have to run python manage.py search_index --rebuild on every deploy. so I faced an issue having docker-compose executing my django project and that is: File "/root/.local/share/virtualenvs/django-lHo0u5mj/lib/python3.11/site-packages/django_elasticsearch_dsl/management/commands/search_index.py", line 172, in _delete 2023-08-20T13:58:47.033526087Z response = input( 2023-08-20T13:58:47.033533712Z ^^^^^^ 2023-08-20T13:58:47.033537712Z EOFError: EOF when reading a line apparently this command is prompting an input from the user and it's called on every docker-compose build command, here is my start.sh file: #!/usr/bin/env bash pipenv run python manage.py makemigrations pipenv run python manage.py migrate pipenv run python manage.py search_index --rebuild #pipenv run python manage.py collectstatic --no-input pipenv run gunicorn --reload --bind 0.0.0.0:8000 service_monitoring.wsgi:application what is the workaround of not running the command mannually everytime I start the container? -
Wagtail fields not showing up in pages list response
Im using Wagtail with django and I'm following the tutorial. I've got a BlogPage like so: class BlogPage(Page): date = models.DateField("Post date") intro = models.CharField(max_length=250) body = RichTextField(blank=True) # Add this: authors = ParentalManyToManyField("blog.Author", blank=True) tags = ClusterTaggableManager(through=BlogPageTag, blank=True) api_fields: list[APIField] = [ APIField("tags"), APIField("date"), APIField("authors", serializer=AuthorSerializer(many=True)), APIField("intro"), APIField("body"), ] and when I go to a detail view, I'm able to see the fields e.g.http://127.0.0.1:8000/api/v2/pages/5/ { "id": 5, "meta": { "type": "blog.BlogPage", "detail_url": "http://localhost/api/v2/pages/5/", "html_url": "http://localhost/blog/first-blog-post/", "slug": "first-blog-post", "show_in_menus": false, "seo_title": "", "search_description": "", "first_published_at": "2023-08-20T04:37:17.102729Z", "alias_of": null, "parent": { "id": 4, "meta": { "type": "blog.BlogIndexPage", "detail_url": "http://localhost/api/v2/pages/4/", "html_url": "http://localhost/blog/" }, "title": "Our blog" } }, "title": "First blog post", "tags": [ "react" ], "date": "2023-08-20", "authors": [ { "name": "Brad", "author_image": "/media/original_images/71UHg51kgKL._AC_SY679_.jpg" } ], "intro": "This is a blog post intro", "body": "<p data-block-key=\"q28xv\">Hello World</p>" } However, in the list view, this same page does not contain those fields. I have tried using the fields=* parameter in the url and still, all that shows up is the title e.g http://127.0.0.1:8000/api/v2/pages/ { "meta": { "total_count": 3 }, "items": [ { "id": 3, "meta": { "type": "home.HomePage", "detail_url": "http://localhost/api/v2/pages/3/", "html_url": "http://localhost/", "slug": "home", "first_published_at": "2023-08-20T04:23:02.114917Z" }, "title": "Home" }, { "id": … -
Initilized django form field value not being saved in database
I am trying to create a form that creates a new model instance like below. But, although the instance is created, the fields are empty even though I initilized the form fields using the init method. Here is my forms.py class ChatForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.user_id = kwargs.pop('user_id') super(ChatForm, self).__init__(*args, **kwargs) user = User.objects.get(id=self.user_id) self.fields['user'].initial = user self.fields['var1'].initial = "new string data" class Meta: model = NewModel fields = ( 'var1', 'user', ) Here is my views.py. I am using django forms for backend validation only. def view(request): if request.method == 'POST': user_id = request.POST.get('user_id') form = ChatForm(request.POST, user_id=user_id) if form.is_valid(): form.save() return JsonResponse({'status': 'success'}) else: errors = form.errors.as_json() return JsonResponse({'status': 'error', 'errors': errors}) return HttpResponse('Not a valid request method') My models.py is simple. var1 is a charfield and user is a foreignkey field to a User model. The problem is that the instance is created, but var1 and user is blank for some reason. I hope you can help me with this, and leave any comments below. -
how to use apache cordova in front-end with django in backend
i wanna turn my django e-commerce website to mobile app using apache cordova what it is the method to do it, i wanna really lInk apache cordova to django in order to have mobile e-commerce web app. so, i wanna know if there exist api or a method to do that , my main purpose it is to have django e-commerce website and mobile e-commerce app wchich work together -
Get date in seconds in Python with lambda
I use the following code to get the time in seconds NowS = lambda : round(datetime.now().timestamp()) class api_REMITTANCE_(APIView): Now_ = NowS() def post(self,request): return_serial = {"status_" : "OK_","time":self.Now_}` But surprisingly, when I call again a minute later, it returns the previous time -
i cant understand why i am getting this error on django, help im a new programmer learning django from a tutorial and getting this error idk why?
enter image description here i tried to print "hello world" using django templates watching a tutorial of this person - https://www.youtube.com/watch?v=GNlIe5zvBeQ&list=PLsyeobzWxl7r2ukVgTqIQcl-1T0C2mzau&index=5 And im still getting error even though i did what he said idk why?? pls help im new programmer and i cant solve this problem no matter what pls help your fellow junior developer in this bug -
How do i get the seal_ids that have a manytomany field passed to a form before a user creates a dispatch
i have two models a Seal model and a Dispatch model, where there is a seal_id field that has a manytomany relationship with Seal model. I want to only list seal_ids on the modelform where a dispatch seal_location_status="Received" and station_from = request.user.station. here are my models class Seal(models.Model): s_id = models.AutoField(primary_key=True) # Auto-generated unique ID seal_no = models.CharField(max_length=12, unique=True) imei = models.CharField(max_length=15, unique=True) seal_type = models.ForeignKey(SealType,to_field='name', on_delete=models.SET_NULL, null=True) class Dispatch(models.Model): STATUS_CHOICES=( ('Dispatched','Dispatched'), ('Received','Received') ) dispatch_id = UniqueIDGeneratorField() seal_id = models.ManyToManyField(Seal,related_name='seals') # Change to CharField with appropriate max_length # seal_type = models.ForeignKey(SealType,to_field='name', on_delete=models.SET_NULL, null=True) handler = models.CharField(max_length=100) station_from = models.ForeignKey(Station, related_name='dispatches_from', on_delete=models.CASCADE) station_to = models.ForeignKey(Station, related_name='dispatches_to', on_delete=models.CASCADE) dispatched_by = models.ForeignKey(CustomUser,on_delete=models.CASCADE,null=True) seal_location_status = models.CharField(max_length=20, choices=STATUS_CHOICES) here is my modelform class DispatchForm(forms.ModelForm): class Meta: model = Dispatch exclude = ['dispatched_by','station_from' ] fields = ('seal_id','handler','station_to','seal_location_status') widgets = { 'seal_id': forms.CheckboxSelectMultiple } -
How do I authenticate only particular users into using the site?
I want the users, who have the email, that has the domain name '@example.com', to be able to use the buttons, that directs them to different url patterns. To carry out the above operation, I have created the following in my templates. Here is code snippet of my template {% if user.is_authenticated %} <a href="{% url 'quizlist' %}" class="btn btn-secondary btn-lg">Quizzes</a> <a href="{% url 'profile' %}" class="btn btn-secondary btn-lg">Profile</a> <a href="{% url 'logout' %}" class="btn btn-secondary btn-lg mr-2">Log Out</a> {% else %} <div class="d-flex justify-content-center"> <a href="{% url 'register' %}" class="btn btn-primary btn-lg mr-2">Register</a> <a href="{% url 'login' %}" class="btn btn-secondary btn-lg">Log In</a> </div> {% endif %} But this authenticates all logged in users and not only the users with a particular domain name. So any thoughts on how to do this? -
How to do django form backend validation for user inputs
I am NOT trying to use Django Form for rendering, but only for backend validation. I heard that doing backend validation increases security and santizes the user inputs, since hackers could inject harmful codes through the form inputs to accesss the database. This is my current code for a chat app: views.py def send(request): var1 = request.POST['var1'] user_id= request.POST['user_id'] main_user = User.objects.get(id=user_id) new_instance = ModelName.objects.create(var1=var1, user=main_user) new_instance.save() # Below is the alert message in ajax in template. return HttpResponse('Message sent successfully') html ... <form id="post-form"> {% csrf_token %} <input type="hidden" name="user_id" id="user_id" value="{{user_id}}"/> <input type="text" name="var1" id="var1" width="100px" /> <input type="submit" value="Send"> </form> </div> </body> <script type="text/javascript"> $(document).on('submit','#post-form',function(e){ e.preventDefault(); $.ajax({ type:'POST', url:'/send/', data:{ user_id:$('#user_id').val(), var1:$('#var1').val(), csrfmiddlewaretoken:$('input[name=csrfmiddlewaretoken]').val(), }, success: function(data){ // alert(data) } }); document.getElementById('var1').value = '' }); </script> </html> However, I am thinking about changing this to include django backend validation. I am thinking that the structure should be something like below, but I am not sure. views.py def send(request): user_id= request.POST['user_id'] main_user = User.objects.get(id=user_id) if request.method =='POST': form = ChatForm(request.POST, user=main_user) if form.is_valid(): form.save() return HttpResponse('successful.') return HttpResponse('Not successful') forms.py class ChatForm(forms.ModelForm): def __init__(self, *args, **kwargs): self.main_user = kwargs.pop('user') super(ChatForm, self).__init__(*args, **kwargs) # Some kind of code to automatically … -
purpose of argument name="home" in django path definatioin
I write a path in Django with an argument name and with its value home to display a simple HttpResponse. My question is why we use name="home" while writing a path. path('',views.home, name='home'), Kindly reason??? path('',views.home, name='home'), Kindly reason??? -
oracle storage with django
I'm having trouble using oracle object storage as a static file store using django-storages. # Storage settings STORAGES = {"staticfiles": {"BACKEND": "storages.backends.s3boto3.S3StaticStorage"}} ORACLE_BUCKET_NAME = "crescendo-bucket" ORACLE_NAMESPACE = "ax0elu5q0bbn" ORACLE_REGION = "us-phoenix-1" AWS_ACCESS_KEY_ID = "<:)>" AWS_SECRET_ACCESS_KEY = "<:)>" AWS_STORAGE_BUCKET_NAME = ORACLE_BUCKET_NAME AWS_S3_CUSTOM_DOMAIN = ( f"{ORACLE_NAMESPACE}.compat.objectstorage.{ORACLE_REGION}.oraclecloud.com" ) AWS_S3_ENDPOINT_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}" AWS_S3_OBJECT_PARAMETERS = { "CacheControl": "max-age=86400", } AWS_DEFAULT_ACL = "" # STATIC_ROOT = os.path.join(BASE_DIR, "static") STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/{ORACLE_BUCKET_NAME}/" I have entered this setting and when I enter the `collectstatic` command, I get the error `botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://ax0elu5q0bbn.compat.objectstorage.us-phoenix-1.oraclecloud.com/crescendo-bucket/admin/css/rtl.css"`. https://docs.oracle.com/en-us/iaas/Content/Object/Tasks/s3compatibleapi.htm Cannot set up Oracle bucket for django static files storage Using this link as a guide, I think I have the right URL configured, but when I make the bucket public and access it as an admin user, the browser still shows a "connection refused" message. I'm pretty sure I've configured that URL (AWS_S3_ENDPOINT_URL in settings.py) correctly, but it's preventing me from making API calls and accessing the browser. Please let me know what I'm doing wrong.