Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django and postgres: Bad request syntax
I started a new django project to create it around existing postgresql database. I followed django docs and installed psycopg2 and modified my settings file like this: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'northwind', 'USER': '********', 'PASSWORD': '****************', 'HOST': '127.0.0.1', 'PORT': '5050', } After that I typed inspectdb > models.py command which should create models from existing database and palce them in file. Nothing happened, had to stop process. Then I tried to reload local server but everything I get after using "python manage.py runserver" is this: Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). So I stop it with ctrl+c and in the other terminal where I'm running postgre server I get this message: 2021-09-13 19:32:15,510: ERROR werkzeug: 127.0.0.1 - - [13/Sep/2021 19:32:15] code 400, message Bad request syntax ('\x00\x00\x00\x08\x04Ò\x16/') Server was working before that database switching from default sqlite to postgre, now I can't start it up. -
AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` ..., but received a `<class 'rest_framework.authtoken.models.Token'>`
I am trying to return authenticated user information like username, email, first_name, and last_name on MyProfile.vue using the serializer. I get this error and I can't find a way of solving this. The logic is like that: The authenticated user has token stores in localStorage, I get it via Axios request and send it to the View model in Django, where I use it to find who the user is and send this user to get method to send it back to the MyAccount.vue and show the user info. I am using Django Rest Framework and Vue.js. Hope you can help, I've been dealing with this problem for a week now. Thank you! PS: I am doing this because User.objects.get(current_user=request.user) returns AnonymousUser, even if I am authenticated. This is my Views.py: class UserDetails(APIView): def post(self, request, *args, **kwargs): serializer = UserAccountTokenSendSerializer(data=request.data) global token if serializer.is_valid(): token = serializer.validated_data['token'] user = Token.objects.get(key=token) self.user = user # global current_user # current_user = User.objects.get(username=user) # email = User.objects.get(email=user) # print(current_user, email) return user return Response(serializer.data) def get(self, request, *args, **kwargs): details = Token.objects.get(key=self.user) print(self.user) # HERE I TRY TO PRINT IT TO SEE IF IT WORKS AND THIS IS WHERE I GET THE … -
how to scan document using mobile came - django
i'm trying building a scanner from mobile phone camera to upload some documents into my django project , database is postgres class Document(models.Model): booking =models.ForeignKey(Booking,on_delete=models.PROTECT) docs = models.ImageField(upload_to=upload_docs) and this is my views.py @login_required def add_new_image(request,id): obj = get_object_or_404(Booking,id=id) if request.method == 'POST': images = request.FILES.getlist('images') if images: for img in images: photo = Document.objects.create( booking=obj, docs = img ) photo.save() return redirect(reverse_lazy("booking:add_booking",kwargs={"room_no":obj.room_no.room_no})) return render(request,'booking/add_img.html',{'obj':obj}) and this is my template <form action="" method="POST" enctype="multipart/form-data" dir="ltr">{% csrf_token %} <div id="main_form" class="text-lg"> <p class="p-2 header rounded-lg text-center text-white">{% trans "adding new documents" %} {{obj.id}}</p> <div class="border border-purple-900 mt-2 rounded-lg p-2 text-center"> <p>{% trans "booking number" %}: {{obj.id}} </p> </div> </div> <hr> <div class="form-group m-3"> <label>{% trans "choose or scan some documents" %}</label> <input required name="images" type="file" multiple class="form-control-file"> </div> <button class="header pt-2 text-white px-4 p-1 rounded-lg mt-4">{% trans "save" %}</button> </form> this only works for uploading existing documents , but i have to let user to upload their documents via their mobile phones .. thanks in advance -
How to retrieve count objects faster on Django?
My goal is to optimize the retrieval of the count of objects I have in my Django model. I have two models: Users Prospects It's a one-to-many relationship. One User can create many Prospects. One Prospect can only be created by one User. I'm trying to get the Prospects created by the user in the last 24 hours. Prospects model has roughly 7 millions rows on my PostgreSQL database. Users only 2000. My current code is taking to much time to get the desired results. I tried to use filter() and count(): import datetime # get the date but 24 hours earlier date_example = datetime.datetime.now() - datetime.timedelta(days = 1) # Filter Prospects that are created by user_id_example # and filter Prospects that got a date greater than date_example (so equal or sooner) today_prospects = Prospect.objects.filter(user_id = 'user_id_example', create_date__gte = date_example) # get the count of prospects that got created in the past 24 hours by user_id_example # this is the problematic call that takes too long to process count_total_today_prospects = today_prospects.count() I works, but it takes too much time (5 minutes). Because it's checking the entire database instead of just checking, what I though it would: only the prospects that … -
Django convert queryset to a list
I am trying to do a bulk insert using jquery ajax and django restframework. When I upload my data using the django restframework interface, it works and when I print the request.data I get this [{'name': 'Tenant 1', 'email': 'tenant1@gmail.com', 'phone_number': 619}, {'name': 'Tenant 2', 'email': 'tenant2@gmail.com', 'phone_number': 911}] However, when I upload it using jquery, I get the data as <QueryDict: {'name': ['Tenant 1', 'Tenant 2'], 'calling_code': ['254', '254'], 'phone_number': ['619', '911'], 'email': ['tenant1@gmail.com', 'tenant2@gmail.com']}> here is my code: in tenantsAdd.html: $(document).on('submit', '#create_tenant_bulk', function (event) { var form_data = new FormData(this); event.preventDefault(); $.ajax({ method: 'POST', url: '{% url "tenants:tenant-listcreate" %}', data: form_data, mimeType:'application/json', contentType: false, dataType: "json", processData: false, In my views.py: class CreateTenantAPIView(generics.ListCreateAPIView): queryset = Tenant.objects.all() serializer_class = TenantSerializer def create(self, request, *args, **kwargs): print('yaaaaaaaaaaaaaaaaaaaaaaaazweeeeeeeeeeeeeh') print(request.data) print(type(request.data)) many = isinstance(request.data, list) serializer = self.get_serializer(data=request.data, many=many) if serializer.is_valid(raise_exception=True): saved_user= serializer.save(added_by=self.request.user) return Response({ 'success': 'user has been added succsfully', }) else: return Response({ 'error': 'you done f@#ckd up', 'error_list':serializer.errors.items() }) So baically, I am trying to turn this: <QueryDict: {'name': ['Tenant 1', 'Tenant 2'], 'calling_code': ['254', '254'], 'phone_number': ['619', '911'], 'email': ['tenant1@gmail.com', 'tenant2@gmail.com']}> Into this: [{'name': 'Tenant 1', 'email': 'tenant1@gmail.com', 'phone_number': 619}, {'name': 'Tenant 2', 'email': 'tenant2@gmail.com', 'phone_number': 911}] -
Bulk GET in Django REST Framework
I'm building an application using Django and Django REST Framework. I'm reasonably comfortable with base Django but I'm very much a newbie with DRF. Hoping someone can help me with the below. I have a list of dictionaries that want to send via my API as a single call, rather than sequentially sending request.get calls in, say, a loop (tediously slow, too many database hits etc.) I've built a list and serialised it to JSON which now looks something like: [ { "kingdom":"Plantae", "phylum":"Tracheophyta", "class_taxonomic":"Magnoliopsida", "order":"Apiales", "family":"Apiaceae", "genus":"Heracleum", "species":"mantegazzianum", "taxon_rank":"SPECIES" }, { "kingdom":"Plantae", "phylum":"Bryophyta", "class_taxonomic":"Bryopsida", "order":"Orthotrichales", "family":"Orthotrichaceae", "genus":"Zygodon", "species":"viridissimus", "taxon_rank":"SPECIES" }, { "kingdom":"Plantae", "phylum":"Tracheophyta", "class_taxonomic":"Magnoliopsida", "order":"Caryophyllales", "family":"Polygonaceae", "genus":"Fallopia", "species":"japonica", "taxon_rank":"SPECIES" } ] Is it possible to send this list to my model (taxonData) and return those model instances if they're present in the above list? If so, what would be the best way to achieve this? Would I need to use generics.ListAPIView and a custom get_queryset method? If I try this with the following code: # models.py class TaxonData(models.Model): kingdom = models.CharField(max_length=64, blank=True, null=True) phylum = models.CharField(max_length=64, blank=True, null=True) class_taxonomic = models.CharField(max_length=64, blank=True, null=True) order = models.CharField(max_length=64, blank=True, null=True) family = models.CharField(max_length=64, blank=True, null=True) genus = models.CharField(max_length=64, blank=True, null=True) species … -
Failed to build wheel for <package>
I've tried to install a package called mazelib, everytime i try to I get cannot build wheel for mazelib. I've tried reinstalling pip, download wheel from pip and even tried to download the uncached version still all dont work. ERROR: Failed building wheel for mazelib Running setup.py clean for mazelib Failed to build mazelib Installing collected packages: mazelib Running setup.py install for mazelib ... error Any help really appreciated. -
Is possible to pass a request parameter in a admin object?
I'd like to pass the request.user.first_name into a model from the admin panel. Is it possible? models.py class News(models.model): text = models.TextField() template.html <div class='container'> {{object.text | safe }} </div> Thanks so much -
Converting html + bootstrap files (using flex) into pdf - Django?
I am trying to create a webapp where, the data comes from a certain API and is saved into the database. Now, I want to create a pdf using the data. I had my html Code ready with custom css and bootstrap ( using display: flex; ). I already tried using the xhtml2pdf, reportlab libraries but am not able to get it right with CSS flex properties. The source for the HTML, and some python file are attached below. HTML File: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 5.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <title>Invoice-ID</title> <style type="text/css"> /* Bootstrap CSS */ .col-md-7 { flex: 0 0 auto; width: 58%; } .container { width: 1320px; } .bg-light { background-color: #f8f9fa !important; } .nav { display: flex; flex-wrap: wrap; padding-left: 0; margin-bottom: 0; list-style: none; } .justify-content-center { justify-content: center; } .navbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding-top: .5rem; padding-bottom: .5rem; } .navbar>.container-fluid { display: flex; flex-wrap: inherit; align-items: center; justify-content: space-between; } .navbar-light .navbar-brand { color: rgba(0, 0, 0, .9); } .navbar-brand { padding-top: .3125rem; padding-bottom: .3125rem; margin-right: 1rem; font-size: 1.25rem; text-decoration: none; white-space: nowrap; } .flex-column { flex-direction: column !important; } .d-flex … -
'QuerySet' object has no attribute 'info' in django
i am crating social media share button https://github.com/codingforentrepreneurs/Guides/blob/master/all/social_share_links.md trying this guide ant trying encode my model.info which is char field paste into status <a class="i-links" target="_blank" href="https://twitter.com/home?status=I'm%20going%20to%20learn%20to%20Code...%20Come%20build%20an%20web%20apsp%20with%20me!%20%23CFE%20and%20@justinmitchel%20{{ request.build_absolute_uri|urlencoded }}"> trying from urllib.parse import urlencode, quote_plus def ttt_read(request, title): ttt = movie.objects.filter(urltitle=title) share_string = quote_plus(ttt.info) if request.method == 'POST': form = Commentform(request.POST) if form.is_valid(): form.save() messages.success(request, 'Thank You For Your Comment') else: form = Commentform() return render(request, 'ttt_read.html',{'ttt':ttt,'form':form,'share_string':share_string}) but when i tried to render it thows above mentioned error so what i am doing wrong here -
Using 2 models in Django CreateView with input fields for only 1 model
I am trying to make a page like this where the quotes are randomly picked from quotes.models.Quote using classmethod Quote.get_random(): Quote1... by Author1 Quote2... by Author2 RichTextfield for user to comment on the quotes. The user should not be able to edit the quotes in this page, just the comment. But I want the relationship between the quotes and user's comment to be saved. I've looked at previous questions and answers but those were for using multiple forms in a view and the user can edit all fields. I also looked at package https://django-extra-views.readthedocs.io/en/latest/index.html but I don't think it helps my problem. I am stuck at displaying the quotes and passing the selected quotes to the form to be saved. Can someone help or suggest how I can make progress? Screenshot of page: Using {% get_quotes %} in the post.html template, I get a list of dictionary for the quotes. {% get_quotes 3 %} also works to generate 3 quotes. [{'id': 81, 'text': '..., 'tags': [76, 77]}, {'id': 75, 'text': ..., 'tags': [74, 75, 76, 77, 78, 79, 80, 81]}] But nothing happens when I try to loop through the list. {% for quote in get_quotes %} {{ quote }} … -
Annotate and compare 2 counts for SubQuery results
I'm trying to get 2 counts of a related table for comparison so I can output different status codes based on that comparison. Problem is I can't seem to get more than one count, as count itself eagerly evaluates the query and I get ValueError: This queryset contains a reference to an outer query and may only be used in a subquery. This is the modelmanager query: class SuccessCode(Enum): SUCCESS = "Success" PARTIAL = "Partial" FAILURE = "Failed" completed = MyModel.objects.filter( backup=OuterRef("pk") ).completed() unsuccessful = ( MyModel.objects.filter(backup=OuterRef("pk")) .completed() .filter(model_field__isnull=False) ) return ( self.active() .annotate(complete=Subquery(completed.count())) .annotate(unsuccessful=Subquery(unsuccessful.count())) .annotate( success=Case( When( complete=F("unsuccessful"), then=Value(SuccessCode.FAILURE), ), When(unsuccessful=0, then=Value(SuccessCode.SUCCESS)), default=Value(SuccessCode.PARTIAL), ) ) ) So I need 2 counts - completed and unsuccessful (unsuccessful will by definition be a subset of completed - anywhere from 0 to all of the completed records). Then I have to compare these values. Any tips? -
Cannot assign "'..'": "ForwardFile.receiver" must be a "User" instance
The goal here is to allow a user who uploads a file to share it with intended recipients who is registered user in the system. The recipient can only then see a file when shared with them. To implement this logic, I have a dropdown where intended recipients are queried from the database. File models.py class ForwardFile(models.Model): file = models.ForeignKey(Document, related_name='documents', on_delete=models.CASCADE) receiver = models.ForeignKey(User, related_name='receiver', on_delete=models.CASCADE) comment = models.TextField() created_by = models.ForeignKey(User, related_name='documents', on_delete=models.CASCADE) forwarded_at = models.DateTimeField(auto_now_add=True) File views.py for handling file forward function def forward_file(request, file_id): file = Document.objects.get(pk=file_id) managers = Manager.objects.all() users = User.objects.all() if request.method == 'POST': form = FileFowardForm(request.POST) if form.is_valid(): forward = form.save(commit=False) forward.file = file forward.receiver = request.POST.get('receiver', '') forward.created_by = request.user forward.save() create_notification(request, file.receiver, 'forward', extra_id=forward.id) messages.success(request, f"Document Forwarded successfuly to {forward.receiver}") return redirect('dashboard') else: form = FileFowardForm() return render(request, 'doc/file_forward.html', {'form':form, 'users':users}) File forms.py class FileFowardForm(forms.ModelForm): class Meta: model = ForwardFile fields = ['comment'] Template forward_file.html {% extends 'core/base.html' %} {% block content %} <h2 class="title">Forward {{ file.title}} - {{ file.category }}</h2> <form action="" method="POST"> {% csrf_token %} {% if form.errors %} {% for error in form.errors %} <div class="notification is-danger"> {{ error }} </div> {% endfor %} {% endif %} … -
Django Model ForeignKey Reciprocation
I'm wondering what the best way to reciprocate the existence of the ForeignKey would be for a model. I.e. I want to be able to see the associated ForeignKey in the Model in the admin page, not just the initial instance of the model. -
Django: Join Two Models without ForeignKey: (Can i Use Polymorphic Relation, if Yes Then How)
class Services(models.Model): id = models.BigAutoField(primary_key=True) medical_unit = models.ForeignKey(MedicalUnits, models.DO_NOTHING, related_name='services_medical_unit', blank=True, null=True) created_at = models.DateTimeField() updated_at = models.DateTimeField() name = models.CharField(max_length=500, blank=True, null=True) billing_code = models.CharField(max_length=500, blank=True, null=True) department_id = models.IntegerField(blank=True, null=True) assignable_type = models.CharField(max_length=500, blank=True, null=True) assignable_id = models.BigIntegerField(blank=True, null=True) department_service_id = models.IntegerField(blank=True, null=True) user_id = models.IntegerField(blank=True, null=True) is_active = models.BooleanField(blank=True, null=True) ward_id = models.IntegerField(blank=True, null=True) class Meta: managed = False db_table = 'services' class PackageServices(models.Model): id = models.BigAutoField(primary_key=True) billing_package = models.ForeignKey(BillingPackages, models.DO_NOTHING, blank=True, null=True) assignable_type = models.CharField(max_length=500, blank=True, null=True) assignable_id = models.BigIntegerField(blank=True, null=True) quantity = models.IntegerField() created_at = models.DateTimeField() updated_at = models.DateTimeField() class Meta: managed = False db_table = 'package_services' I want To access "PackageService" Through "Services". If Any Solution Please Help. -
raise ImproperlyConfigured(error_msg) in django
I am trying to host a django website in gcloud... i did some changes in settings.py file this is my code DATABASES = {"default": env.db()} # If the flag as been set, configure to use proxy if os.getenv("USE_CLOUD_SQL_AUTH_PROXY", None): DATABASES["default"]["HOST"] = "127.0.0.1" DATABASES["default"]["PORT"] = 5432 after adding this code into settings.py file i am facing below error File "C:\Users\CHANDU\Downloads\Unisoftone\unisoftone\website\website\settings.py", line 99, in <module> DATABASES = {"default": env.db()} File "C:\Users\CHANDU\AppData\Local\Programs\Python\Python38-32\lib\site- packages\environ\environ.py", line 208, in db_url return self.db_url_config(self.get_value(var, default=default), engine=engine) File "C:\Users\CHANDU\AppData\Local\Programs\Python\Python38-32\lib\site- packages\environ\environ.py", line 281, in get_value raise ImproperlyConfigured(error_msg) django.core.exceptions.ImproperlyConfigured: Set the DATABASE_URL environment variable can anyone help me -
Fetch Username in python Django using LDAP in intranetwork
We are stuck into the Problem. We have hosted python Django based website on our intraNetwork Linux Server. When any user(client machine) in same network access that website, the system needed to authenticate that user from LDAP directory and pass username to the System, Further System process will work on the same username. Please Note that user is not passing any credentials, because it is already logged in to the active directory on their machine. What we want: We want to Fetch the username of Client Machine using already logged in windows active directory from browser that access intraNetwork python Django Website(Without Providing Credentials again on Browser). The Url looks like: IP/PageName.html Note: Client Remote Machine Can be linux/Windows. Web Server Hosted Machine: Linux I have used: https://docs.djangoproject.com/en/3.2/howto/auth-remote-user/ ldap3 But for that user need to provide credentials on their remote machine when they hit the URL. But we want to authenticate and fetch username by using already logged in active directory. we believe that there must be a solution, so please guide the one. Thanks, -
Can I stop the significant amount of [Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header from strange sites I'm getting?
Since adding the option to email me (the admin) when there are problems with my Django server, I keep getting a LOT of the following emails (20 in the last hour alone). [Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: 'staging.menthanhgiadalat.com'. You may need to add 'staging.menthanhgiadalat.com' to ALLOWED_HOSTS. I've set my server up to have the following at the top of the file in my sites-enabled nginx config as I read (somewhere on SO) that this would may prevent me from getting these types of emails: server { server_name _; return 444; } But it hasn't done anything. In the next server block I have the IP address and domain names for my site. Could this be causing the problem? This 'staging' site isn't the only domain I'm being asked to add to my ALLOWED_HOSTS. But it is, by far, the most frequent. Can I stop this type of alert being sent? Can I stop it from being raised? Is there something I've configured incorrectly on my server (I'm ashamed to admit I'm pretty new at this). Thanks for any help you might be able to give. -
Accessing .count() and .all() inside the model
Can I access .all() or . count () inside the model in models.py file? I'm working on a poll app and I want on field value dynamically to save the .count() of it's many to many field. -
Choice field not getting updated Django
I am trying to update my choice field on form submission but somehow its not getting updated, It representing a blank value in Django-admin contact_no = request.POST['contact_no'] password = request.POST.get('password') user_type = request.POST.get('user_type') print(user_type) user = User(gender=gender, email=email, username=username, first_name=first_name, last_name=last_name, date_of_birth=date_of_birth, contact_no=contact_no,user_type=user_type) user.set_password(password) user.save() Model Definition USER_TYPE = (('HR', 'recuriter'), ('job seeker', 'job_seeker')) user_type = models.CharField(max_length=255, choices=USER_TYPE) -
How can I have an atomic block of code that doesn't access the database in Django?
I am working on a project that uses Django and Django REST Framework. In one of the views there's a method F() that does the following: Fetches data from the database (read operation) Sends a create (POST) request to a 3rd party API. (although not local, this is a write operation and this is where a race condition might take place) Returns JSON data I'd like F() to be atomic, in other words, if the server receives multiple requests at the same asking for this view, the server should handle one of requests to the fullest, and after that, handle the second request to the fullest. How can this be achieved? I have read that Django provides transactions.atomic() but this guarantees atomicity of database transactions, what I need is atomicity for a whole block of code regardless of whether it accesses the database or not. -
DRF: only for representation purpose. How to combine two serializers
I have class Serializer1(serializers.ModelSerializer): class Meta: model = Model1 fields = ("first_name","last_name") class Serializer2(serializers.ModelSerializer): class Meta: model = Model2 fields = ("phone","email") Now I want to show both the serializers as one only for representation purpose like { first_name: last_name: phone: email: } How can do that -
React.js: Unhandled Rejection (TypeError): Cannot read property 'error' of undefined
hello i'm just gettin the error "Unhandled Rejection (TypeError): Cannot read property 'error' of undefined " and this is my Home.js import React ,{useState, useEffect} from 'react' import {GetProducts} from '../core/helper/coreapicalls' export default function Home() { const [Products , setProducts] = useState([]); const [Error , setError] = useState(false); const LoadAllProducts = ()=>{ GetProducts() .then(data =>{ if(data.error){ setError(data.error); console.log(Error) } setProducts(data); }) } useEffect(()=>{ LoadAllProducts() },[]); return ( <div> <h1>Home Component</h1> <div className="row"> {Products.map((product,i)=>{ return( <div key = {i}> <h1>{product.name}</h1> </div> ) })} </div> </div> ) } and this is the API fetch code import {API} from '../../backend'; export const GetProducts = ()=>{ return fetch(`${API}product`,{method : "GET"}) .then(response =>{ return response.json(); }) .catch(error=>{ console.log(error); }); }; API is just an environment variable setting the api link : localhost:8000/api/ -
Image url from S3 is not working in Django template
My django back-end and website is hosted in heroku. My media files are hosted in Amazon S3. I have no issue with uploading image to S3. But when I try to embed image url from S3 into img tag, then I have problem. It does not show image. <img src="{{ taxi.user_photo.url }}" alt="Photo of user"> here is the url that is returned: https://elasticbeanstalk-us-west-2-865036748267.s3.amazonaws.com/media/user_photo/default_taksist.png?AWSAccessKeyId=AKIA4S2BVIXV43WWVZG4&Signature=En2f5F65B61oaYexN2HIIcWIgME%3D&Expires=1631531071 In this link there are KeyId and Signature, I have no idea why it is like that. And, here is my S3 bucket policy: { "Version": "2012-10-17", "Statement": [ { "Sid": "PublicReadGetObject", "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::elasticbeanstalk-us-west-2-865036748267/*" } ] } I checked other answers in stackoverflow, they did not help much. Base point is that I have a url but that is not working somehow. Any help of yours is appreciated, thanks for your time. -
Deploy a private server [closed]
I'll host my Django web app on DigitalOcean droplet it will be a website for small business but the problem here that I need to make the server only accessible from certain devices in the company, even with a domain I don't want the website to be public for everyone. I've also looked for Nginx deny and allow ip addresses but the devices ip's addresses changes and they are not static so this step is not working or maybe I'm doing it wrong... So is there any ideas how to achieve that? Thanks.