Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
how to setup django ssl for development purpose?
One notice: I'm new to python but was able to run django based project for mobile. There's a js part where I need to add some functionality about camera and what I found the web page needs to be run from https:// as I need access from my phone. Is running nginx with self signed cert the best solution? Will it working using https://192.168.0.xxx? -
why does clean_password2() method work but not clean_password1() in Django usercreationform
I am trying to figure out why this works if someone could maybe explain it to me. I've just created a custom user model (shown below) and for the password validation it uses the clean_password2(self): (shown below) method however when I try to use clean_password1(self): (shown below) the validation does not work. why? Surely using either password1 or password2 to clean the data would work since they are the same? Django docs state that we can use clean_<fieldname>(): methods to clean/validate data and since password1 is a fieldname in my mind that should work. Custom user model class UserManager(BaseUserManager): def create_user(self, email, password=None): if not email: raise ValueError("Users must have an email address") user = self.model(email=self.normalize_email(email)) user.set_password(password) user.save(using=self._db) return user def create_superuser(self, email, password=None): user = self.create_user(email=email, password=password) user.is_staff = True user.is_admin = True user.save(using=self._db) return user class User(AbstractBaseUser): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) email = models.EmailField(verbose_name="Email Address", max_length=255, unique=True) is_active = models.BooleanField(default=True) is_staff = models.BooleanField(default=False) is_admin = models.BooleanField(default=False) objects = UserManager() USERNAME_FIELD = "email" REQUIRED_FIELDS = [] def __str__(self): return self.email def has_perm(self, perm, obj=None): return True def has_module_perms(self, app_label): return True This works class UserCreationForm(forms.ModelForm): password1 = forms.CharField( label="Password", help_text=password_validation.password_validators_help_text_html(), widget=forms.PasswordInput, ) password2 = forms.CharField( label="Confirm Password", … -
Django project is not reading my static css file
I am working on a django project and for some reason the style.css file is not read. However, my static images are working. Not really sure what the issue is, any help is greatly appreciated. There are also no errors showing in the console and terminal.. Link to my github repository https://github.com/Amanuel763/petwebsite -
Remain authenticated in a mobile application
I am working on an Ionic mobile app and have a django backend. We currently use JWT authentication in order to access the django backend (multiple applications use this backend including a react frontend). So the current auth method needs to stay in tact. Now that we are working on an app we want the user to stay logged in after entering his credentials once on the app. I've been researching a good way to do this all day but can't seem to find a clear answer. What is the best option to keep the user authenticated? Should I set a high expiration on the refresh token? (Not sure if that is secure..) Should I use session auth? I found it that Django mostly supports this on services on the same domain. Seems like you have to relax quite a few security settings which doesn't seem to be the right solution. I am not sure where to go from here. Do you guys have any suggestions? -
Add products with different sizes and price to Cart | Django
I use session's to create a shopping cart. I have a product model and a model for Product-sizes, which I define the size-title(XL , etc) and price of product in it . So that I can have products with different sizes as well as different prices. But my logic has some problems if I add product_1 with size A , it's ok ... if I add product_1 with size B , it's ok ... but when I'm trying to add same product with different sizes at same time the cart only shows the price of first size #shop/models.py class ProductSizes(models.Model): name = models.CharField(max_length=50) price = models.IntegerField() picture = models.ImageField(upload_to="products/%Y/%m/%d" ) class Product(models.Model): name = models.CharField(max_length=100) size = models.ManyToManyField(ProductSizes , blank=True , related_name="sizes" ) price = models.IntegerField() #cart/cart.py from django.conf import settings from shop.models import Product class Cart: def __init__(self,request): self.session = request.session cart = self.session.get(settings.CART_SESSION_ID) if not cart: cart = self.session[settings.CART_SESSION_ID] = {} self.cart = cart # add to cart def add(self,product,size_,quantity=1,override_quantity=False): product_id = str(product.id) print(product.size.name) if product_id not in self.cart : if size_ != None: if size_.off_price: self.cart[product_id] = {'quantity':0,'price':size_.off_price} elif size_.price: self.cart[product_id] = {'quantity':0,'price':size_.price} else: if product.off_price: self.cart[product_id] = {'quantity':0,'price':product.off_price} else: self.cart[product_id] = {'quantity':0,'price':product.price} if override_quantity: self.cart[product_id]['quantity'] = … -
how to write nested tuples in django using django-environ
I am using django-environ to configure my Django app with environment variables. I am trying to write tuples data in .env From django-environ documentation tuples are supported: tuple: (FOO=(a,b,c)) But I couldn't find anything about nested tuples. (Also about nested dicts and lists) I am trying to write nested tuples: nested_tuple_setting = (('setting10', 'setting11'), ('setting20'), ('setting21')) -
I've a problem with django update in crud?
I have a problem where, in the update part when the form is displayed, in whichever fields there is more than one word (like name, address) the first one is only displayed in the form to be edited, the rest is gone. I went through the whole project multiple times but I can't find the solution. Please help me. Thanks in Advance!!! base.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous"> </head> <body> <div class="container" align="center"> {% block body %} {% endblock %} </div> </body> </html> create.html <!DOCTYPE html> {% extends "testAppTem/base.html" %} {% block body %} <div class="jumbotron"> <h1>Employee insertion form</h1><hr> <form method='post'> <table border=3> {{form}} </table> {%csrf_token%}<br><br> <input type="submit" value="Insert" class="btn btn-lg btn-danger"> </form> </div> {% endblock %} index.html <!DOCTYPE html> {% extends "testAppTem/base.html" %} {% block body %} <div class="jumbotron"> <h1><u>Employee Information Dashboard</u></h1><br><br> <table border=4> <thead> <th>Employee Name</th> <th>Employee Number</th> <th>Employee Salary</th> <th>Employee Address</th> <th>Actions</th> </thead> {% if employees %} {% for e in employees %} <tr align=center> <td>{{e.enum}}</td> <td>{{e.ename}}</td> <td>{{e.esal}}</td> <td>{{e.eaddr}}</td> <td><a href="/update/{{e.id}}" class="btn btn-sm btn-dark">Update</a> <a href="/delete/{{e.id}}" class="btn btn-sm btn-info">Delete</a></td> </tr> {% endfor %} {% else %} <p>There is no data...</p> {% endif … -
Cannot connect JS Event Source to Python (Django) backend server
I'm working with Django Framework + Javascript and want to create a server-sent event which gonna send messages to the front-end. Here is my Js-client part: btn.addEventListener('click', function(event){ console.log('started...'); var url = new URL('http://127.0.0.1:8000/get/stream/data/'); var source = new EventSource(url); source.onopen = function(){ console.log('Source has been connected....'); }; console.log(source); source.onmessage = function(event){ data = JSON.parse(event.data); console.log('on message event', event, data); console.log(event); }; source.onerror = function(err) { source.close(); console.error("EventSource failed:", err); }; source.onclose = function(){ evtSource.close(); console.log('event source has been closed'); } }); Python-Django part: def prepare_stream_data(): import json from django.core.serializers.json import DjangoJSONEncoder while True: for i in range(30): yield json.dumps('%s' % i, cls=DjangoJSONEncoder) print(i) time.sleep(5) def send_stream_data(request): stream_data = prepare_stream_data() response = django.http.StreamingHttpResponse(stream_data, content_type='text/event-stream') return response urls.py path('get/stream/data/', main_course_api.send_stream_data, name='stream_data') Django basically works and I see the result in console...., when I click on the button, but it shows me in JS console, that event source is not connected (readyState equals to 0) and does not receive any messages) :( -
What should I do to show the previous data when I'm updating some information on website in Django?
Here, on my site admin can update product information. Hereafter clicking that green update button a form will appear. but I want that as admin is updating information, previous information will also appear in this form. So, I want to show previous data already filled up in this form. How can I do this as I'm not using any ModelForm here views.py def update_product(request,product_id): if request.method=='POST': product = Product.objects.get(pk=product_id) product.product_name = request.POST['product_name'] product.category = request.POST['product_category'] product.price = request.POST['product_price'] product.image = request.FILES['product_photo'] product.description = request.POST['product_description'] product.pub_date = datetime.today() product.save() messages.success(request, 'Product has been updated successfully!!!') return redirect("/") else: return HttpResponse("404-Not Found") form is inside a modal in fruit.html: <button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#updateModal"><i class="bi bi-arrow-repeat"></i></button> <div class="modal fade" id="updateModal" tabindex="-1" aria-labelledby="updateModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="updateModalLabel">Add New Products</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <form action="{% url 'update_product' i.product_id %}" method="post" enctype="multipart/form-data"> {% csrf_token %} <div class="mb-3"> <label for="exampleFormControlInput1" class="form-label">Product Name:</label> <input type="text" class="form-control" id="product_name" name="product_name" placeholder="E.g. Potato Regular" required /> </div> <div class="mb-3"> <label for="exampleFormControlInput1" class="form-label">Product Category:</label> <select class="form-select" aria-label="Default select example" id="product_category" name="product_category" required> <option selected>Choose Category</option> <option value="Fruit">Fruit</option> <option value="Vegetable">Vegetable</option> <option value="Toy">Toy</option> <option value="Medicine">Medicine</option> <option value="Stationery">Stationery</option> <option value="Pet">Pet</option> <option value="Electric">Electric</option> … -
Django Urls loads the page and shows 404 status
I am trying to learn Django but today I faced a problem. I have got an app that is called 'users' and ı have URLs in it. Here is the urls.py file in users app. urlpatterns = [ path('signup/', views.signup, name = "signup"), path('logout/', views.user_logout, name='logout'), path('dashboard/', views.dashboard, name='dashboard'), path('profile/', views.user_profile, name='profile'), ] ı included it in main urls.py urlpatterns = [ path('admin/', admin.site.urls), path('', views.index, name = 'index'), path("users/", include('users.urls')), path('customer/', include('customer.urls')) ] When I am trying to get a get request to the URL 127.0.0.1:800/users/dashboard terminal shows me an 404 error and it loads the page without error and I could not figure out why it happens. I am not sure if it's interested with it but /users/dashboard view has decorator loginrequired(login_url='index') [03/Feb/2022 18:08:13] "GET /users/dashboard/ HTTP/1.1" 200 6610 Not Found: /users/dashboard/... [03/Feb/2022 18:08:13] "GET /users/dashboard/... HTTP/1.1" 404 3324 -
How can I select a user and notify him that he's selected in django?
I'm working on my final year project which is campus recruitment system in django. I am a beginner and learning python and django. I want to create a module as Selection Panel and when the candidate will click on it he'll know whether he is selected for the particular job by particular company or not. I'm unable to understand the what and how should I do? -
Django Flashcards view (mark as known)
i'm currently stuck with the view of a Django Flashcards Website to mark the cards as 'known'... he're is the code, the previous card works well..: class CardView(View): template_name = 'card.html' def get(self, request, set_id, card_id): selected_set = get_object_or_404(Set, pk=set_id) try: selected_card = selected_set.card_set.get(id=card_id) except (KeyError): return render(request, 'set_index.html',) else: context = { 'set': selected_set, 'card': selected_card, } try: known_card = selected_set.card_set.filter( id__lt=card_id).order_by("id") Card.known +=1 except(KeyError, AssertionError): pass else: context['known_card'] = known_card try: prev_card = selected_set.card_set.filter( id__lt=card_id).order_by("id") prev_card = prev_card[len(prev_card) - 1] except (KeyError, AssertionError): pass else: context['prev_card'] = prev_card -
User id is not passing through in the URL in Django rest framework
I'm passing the user id in the URL but its taking '0' http://localhost:1400/api/Values/GetLeaves/0 As it is suppose to show the list of id when I select the particular id it should show the leaves of the particular member but it just showing only '0'. when I print the id which pass through it just showing '0' This is what I have tried views.py: @api_view(['GET']) def GetLeaves(request, userid): if request.method == 'GET': print("GetLeavesBRG--->", userid) cursor = connection.cursor() cursor.execute('EXEC [dbo].[sp_GPHGetUserLeaveDetailsBRG] @user=%s',(userid,)) result_set = cursor.fetchall() print(result_set) response_data = [] for row in result_set: response_data.append({ "FromDate":row[0] }) return Response(response_data) urls.py: path('Values/GetLeaves/<int:userid>', GetLeaves, name='GetLeaves') -
django-simple-history how to get the related foreign key objects
I have a model named Order and another OrderItem. The OrderItem table has a foreign key to the Order table. Now I have the [simple-history][1] installed and setup on both the models. I try to get the Order history and also fetch related OrderItem from history using the related name on the OrderItem table but it returns an error: AttributeError: 'HistoricalOrder' object has no attribute 'order_items' Here is my Order and OrderItem table. class OrderItem(models.Model): order = models.ForeignKey( "Order", on_delete=CASCADE, related_name="order_items" ) content_type = models.ForeignKey(ContentType, on_delete=models.RESTRICT) object_id = models.PositiveIntegerField() content_object = GenericForeignKey("content_type", "object_id") history = HistoricalRecords() ....... class Order(models.Model): po_id = models.CharField(max_length=50, unique=True, blank=True, null=True) history = HistoricalRecords() ..... Following command gives me an order. order = Order.history.filter(id=102).first() But if I run order.order_items.all() then I get the attribute error. If I run the query on the actual model then I get the order_items by using below command. Order.objects.get(id=102).order_items.all() Is it possible to get the order_items from the history table in the same way as normal django models. And how can I do this to work. Thank you. [1]: https://django-simple-history.readthedocs.io/en/latest/index.html -
Heroku release section overrides release process
I have the following heroku.yml file for containers deployment: build: docker: release: dockerfile: Dockerfile target: release_image web: Dockerfile config: PROD: "True" release: image: web command: - python manage.py collectstatic --noinput && python manage.py migrate users && python manage.py migrate run: # web: python manage.py runserver 0.0.0.0:$PORT web: daphne config.asgi:application --port $PORT --bind 0.0.0.0 -v2 celery: command: - celery --app=my_app worker --pool=prefork --concurrency=4 --statedb=celery/worker.state -l info image: web celery_beat: command: - celery --app=my_app beat -l info image: web When I deploy I get the following warning, which does not make any sense to me: Warning: You have declared both a release process type and a release section. Your release process type will be overridden. My Dockerfile is composed of two stages and I want to keep only the release_image stage: FROM python:3.8 as builder ... FROM python:3.8-slim as release_image ... According to the docs the proper way to choose release_image is to use the target section within build step. But it also mentions that I can run my migrations within a release section. So what am I supposed to do to get rid of this warning? I could only live with it if it was clear that both my migrations and … -
Large file upload problem with Azure file storage and Django
I use Azure file storage for media files in my django app. When I upload small data or images it works fine. But when I upload large dataset about 300 MB of size then request take 2 minutes and then I see an error like that in browser azure.core.exceptions.HttpResponseError azure.core.exceptions.HttpResponseError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer')) When I look at inside of the container in storage account in Azure I see uploaded files. But I never get a response back it just terminate the connection. I am using version of django 3.2.11, django-storages[azure] 1.12.3 and Azure file storage StorageV2. Ps: Please consider that I am not allowed to use another file storage like AWS S3, and etc. -
type object 'Post' has no attribute 'published' django by exapmle book
I'm following Django by example book first chapter and when I'm trying to access http://127.0.0.1:8000/blog/ i got this error type object 'Post' has no attribute 'published' and in the terminal it says this is the error File "/Users/ziad/Documents/code/blog/mysite/blog/views.py", line 6, in post_list posts = Post.published.all() but i can't figure out what is the issue i double checked the code and everything is fine this is my views.py def post_list(request): posts = Post.published.all() return render(request,'blog/post/list.html',{'posts': posts}) models.py class Post(models.Model): STATUS_CHOICES = ( ('draft', 'Draft'), ('published', 'Published'), ) title = models.CharField(max_length=250) slug = models.SlugField(max_length=250, unique_for_date='publish') author = models.ForeignKey(User, on_delete=models.CASCADE, related_name='blog_posts') body = models.TextField() publish = models.DateTimeField(default=timezone.now) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) status = models.CharField(max_length=10, choices=STATUS_CHOICES, default='draft') ` class Meta: ordering = ('-publish',) def __str__(self): return self.title def get_absolute_url(self): return reverse('blog:post_detail', args=[self.publish.year, self.publish.month, self.publish.day, self.slug]) objects = models.Manager() # The default manager. published = PublishedManager() # Our custom manager. ` -
Django save user IP each new Sign In
Each time the user logs in, I want to store the IP address in a list of the respective user, so that each user has a list with all IP addresses used during login. How could I do this? Custom User Model class NewUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('E-Mail'), unique=True) username = models.CharField(max_length=150, unique=True) start_date = models.DateTimeField(default=timezone.now) is_staff = models.BooleanField(default=False) is_active = models.BooleanField(default=True) last_login = models.DateTimeField(default=timezone.now) code = models.ImageField(blank=True, upload_to='code') objects = CustomAccountManager() USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['username', ] Views SingIn def signin_view(request): if request.user.is_authenticated: return HttpResponseRedirect('/') form = SigninForm(request.POST or None) if form.is_valid(): time.sleep(2) email = form.cleaned_data.get("email") password = form.cleaned_data.get("password") user = authenticate(request, email=email, password=password) if user != None: login(request, user) return redirect("/dashboard/") else: request.session['invalid_user'] = 1 return render(request, "signin.html", {'form': form}) -
Getting - Can't install traversal 'has' exists on NodeSet, error when matching Node
I'm using Django with Neomodel and django_neomodel to connect to AuraDB and fetch data. In my views I'm doing: def homePage(request): name = request.user.last_name + ', ' + request.user.first_name my_person_node = Person.nodes.get(person_name=name) ... My Person model: class Person(DjangoNode): id = UniqueIdProperty(primary_key=True) person_id = StringProperty(unique_index=True) person_name = StringProperty(unique_index=False) service_position = StringProperty(unique_index=False) has = Relationship('Research_Topic', 'has', model=Person_has_Research_Topic) is_teaching = RelationshipTo('Course', 'is_teaching') class Meta: app_label = 'profiles' def __str__(self): return self.person_name and 'has' relation model: class Person_has_Research_Topic(StructuredRel): type = StringProperty() This throws an error: ValueError: Can't install traversal 'has' exists on NodeSet -
'JobSerializer' object has no attribute 'email' what i am missing?
serializers.py class JobSerializer(serializers.ModelSerializer): # image = Base64ImageField(max_length=None, # use_url=True) # applicant = serializers.ForeignKe applicant = serializers.StringRelatedField(many=True) email = serializers.SerializerMethodField("get_username_from_user") company_name = serializers.SerializerMethodField("get_company_name_from_user") class Meta: model = Jobs fields = ['company_name', 'email', 'title', 'desc', 'image', 'price', 'category', 'applicant'] # extra_kwargs = {"email": {"required": False}} def get_username_from_user(self, jobs): email = jobs.user.email return email def get_company_name_from_user(self, jobs): company_name = jobs.user.company_name return company_name views.py @api_view(['GET']) @permission_classes([IsAuthenticated]) def api_detail_jobs_view(request, id): try: jobs = Jobs.objects.get(id=id) except Jobs.DoesNotExist: data = {} data['response'] = "Job does not exist" return Response(data, status=status.HTTP_404_NOT_FOUND) if request.method == "GET": serializer = JobSerializer(jobs) user = request.user if user == serializer.email: data = {} auth_show = serializer data['title'] = auth_show.title data['desc'] = auth_show.applicant return Response(data) else: no_auth_show = serializer data = {} data['title'] = no_auth_show.title return Response(data) here is serializers.py in which 'email' is included. i know i am missing something very clear but it took hours to realise :) so any help will be appriciated i am trying to show 'applicants' only to users who owns the 'job' but i can't pass 'email' from serializer in to the view. I can't pass any attribute from serializer in to data dict. -
Run script python in web browser
I have a script python for Reading biometric identity card with a card reader this script use this https://github.com/roeften/pypassport, i want to creat a web app with django and use this script and run it on client machine (on web browser) , each user can read his card with a card reader on this web application. how can i do that ? any idea can be useful looked at this part of script that I want to run on the client browser: from pypassport.reader import ReaderManager from pypassport.reader import ReaderManager from pypassport.epassport import EPassport, mrz r = ReaderManager() reader = r.waitForCard() p = EPassport(reader,"YOURMRZINFO") p.register(print) p.setCSCADirectory("C:\\TEMP") p.doBasicAccessControl() p.doActiveAuthentication() p['DG2'] -
"The specified alg value is not allowed" error raises when launching django using gunicorn
I have a database web application running on nginx (front-end) + django + postgresql and I am trying to use gunicorn to manage communications between nginx and django. I use JWT to manage authentication on the application. When I launch the service using django directly, I get "alg": "HS512" token but for some reason I don´t understand, when I launch the same django application using gunicorn, the token generated corresponds to "alg": "HS256" and I get the following error: File "/srv/gather-api/env/lib/python3.9/site-packages/jwt/api_jws.py", line 232, in _verify_signature raise InvalidAlgorithmError("The specified alg value is not allowed") I tried changing my settings.py file from: SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=ACCESS_TOKEN_LIFETIME), 'REFRESH_TOKEN_LIFETIME': timedelta(minutes=REFRESH_TOKEN_LIFETIME), 'ALGORITHM': 'HS512', 'SIGNING_KEY': SECRET_KEY } to: SIMPLE_JWT = { 'ACCESS_TOKEN_LIFETIME': timedelta(minutes=ACCESS_TOKEN_LIFETIME), 'REFRESH_TOKEN_LIFETIME': timedelta(minutes=REFRESH_TOKEN_LIFETIME), 'ALGORITHM': 'HS256', 'SIGNING_KEY': SECRET_KEY } but still get the same error. Questions: Why the algorithm generating the token changes when I launch the application using gunicorn? Is there anyway to indicate my django application to allow this algorithm and therefore get a valid token? Thanks in advance. Let me know if more information is required. -
django: how to simultaneously render and redirect to the desired page
I need to render and redirect the page CreateOrder.html at path: "/order/", after click the form submit button. is there a way to do the rendering and redirecting at the same time? (i.e. update the CreateOrder.html and redirect to this page) def CreateOrder(request): navi_load = request.session['navi_load'] navi_unload = request.session['navi_unload'] dist = request.session['dist'] charge = request.session['charge'] return render(request, 'OnlinePricing/CreateOrder.html', {'pickup_address': navi_load, 'delivery_address': navi_unload, 'distance': dist, 'charge': charge}) -
Django - Creating a new user model extending an already extended user model
I am starting a new project and I created my user model extending the AbstractBaseUser, like below: class NewUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField( unique=True) user_name = models.CharField(max_length=150, unique=True) ... I am wondering whether it is possible and makes sense to create my user (e.g. Teacher) by extending NewUser, and adding all of the Teacher profile info. That would be something like: class Teacher(NewUser): role = models.CharField(max_length=150) title = models.CharField(max_length=150) date_of_birth = models.CharField(max_length=150) ... Would this be good practice and would it allow me to use the built-in authentication methods with DRS? And would this give more flexibility if then I want to enable other users (e.g. Students) to also register an account and log-in? Or would it make more sense to just use NewUser directly? Would Really appreciate some advice/ insight! -
DoesNotExist at /accounValid OAuth Redirect URIs, Deauthorize callback URL, Data Deletion Request URLts/linkedin_oauth2/login/
I am login with Instagram on our website but cannot save changes. show issue the URL not valid please give me any suggestion whose URL use in these three options our Django website original URL localhost.