Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Are you having trouble deploying your Django apps to Heroku?
I had trouble with this, too. Even after following Mozilla's guide, and a YouTube video I found on the subject as well. So I put together this handy guide incorporating both the MDN guide and the YouTube video guide, which you can find here in my GitHub repo. Hope it helps you all! -
Django Shell indexing Queryset on any position returns the exact same result - DB Lazy Evaluation
This isn't maybe as much of a question as it is a confirmation and request for more insight. When running a QuerySet request in python shell something like this: qs = MyModel.objects.all() or qs = MyModel.objects.get_queryset() or qs = MyModel.objects.filter(field='something') then followed by anything like this: qs[0] or qs[1] or qs[any_valid_int] it will always return the DB entry in position 0 of the returned QuerySet no matter what index you use. This mad me scratch my head at first. Now I understand QuerySets are generators in Django (?) and are evaluated lazy as documented here: Django Doc: Querysets Are Lazy When you do anything (in the shell) that evaluates the returned qs like for example len(qs) and then use indexing again it will suddenly return the correct DB entries with qs[any_valid_int] behaving exactly as expected. I believe this corresponds with this Django bug report question from 6 years ago as well. So am I on the right track here assuming that this has to do with lazy evaluation? And what is the best/quick way in Django shell to just get a QuerySet and directly index the one you want for testing without having to use something like len(qs) first? Is … -
how to set-up liveness and readiness probes for Celery worker pods
I want to set-up liveness and readiness probes for Celery worker pods. Since these worker pods doesn't have a specific port associated to them I am finding it difficult. Main Django app nginx server was easier to set-up. I am very new to k8s so not much familiar to the different ways to do it. -
How to Setup send email function in html form using any programing language? [closed]
The html form code given as follow how to setup this contact form to get email to my account using any language: <form action="" method="post"> <div class="fields"> <div class="field name"> <input type="text" placeholder="Name" name="name" required> </div> <div class="field email"> <input type="email" placeholder="Email" name="email" required> </div> </div> <div class="field"> <input type="text" placeholder="Subject" name="subject" required> </div> <div class="field textarea"> <textarea cols="30" rows="10" placeholder="Message.." name="message" required> </textarea> </div> <div class="button-area"> <button type="submit">Send message</button> </div> </form> <!-- html form code --> -
Django Heroku Application Erorr
I made a small site and I wanted to publish it on heroku. However, some errors arose during this time. The site gave a favicon.ico error, so I wondered if there was a problem with the django project I coded, so I opened a new clean project and the same problem arose. settings.py """ Django settings for yayinda project. Generated by 'django-admin startproject' using Django 4.0.3. For more information on this file, see https://docs.djangoproject.com/en/4.0/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.0/ref/settings/ """ import os from pathlib import Path import django_heroku django_heroku.settings(locals()) # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-6hv!w%64=3)hj7hix=tzv^$9n4-mn0l@!=4$uax%gs)mtsr)z0' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['127.0.0.1','yayinda.herokuapp.com'] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'yayinda_deneme' ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'yayinda.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR,'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, … -
Single token refresh vs Long running refresh tokens (Django GraphQL JWT)
I used both "Single token refresh" mode and "Long running refresh tokens" mode. "Single token refresh" mode: GRAPHQL_JWT = { "JWT_VERIFY_EXPIRATION": True, "JWT_EXPIRATION_DELTA": timedelta(minutes=5), "JWT_REFRESH_EXPIRATION_DELTA": timedelta(days=7), } "Long running refresh tokens" mode: GRAPHQL_JWT = { "JWT_VERIFY_EXPIRATION": True, "JWT_LONG_RUNNING_REFRESH_TOKEN": True, // This code is added. "JWT_EXPIRATION_DELTA": timedelta(minutes=5), "JWT_REFRESH_EXPIRATION_DELTA": timedelta(days=7), } But I couldn't get a refresh token in "Single token refresh" mode running this graphql below: mutation { tokenAuth(username: "admin", password: "admin") { token payload refreshExpiresIn refreshToken // Here } } Then, I got this error: { "errors": [ { "message": "Cannot query field \"refreshToken\" on type \"ObtainJSONWebToken\". Did you mean \"refreshExpiresIn\"?", "locations": [ { "line": 20, "column": 5 } ] } ] } Then, I removed "refreshToken" field and ran this graphql: mutation { tokenAuth(username: "admin", password: "admin") { token payload refreshExpiresIn # refreshToken } } Then, I could get this result without error but I still couldn't get a refresh token: { "data": { "tokenAuth": { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNjQ3MDk2MTExLCJvcmlnSWF0IjoxNjQ3MDk1ODExfQ.5AY0HGqqmy3KwW1Gb_DFO99hIvJJh_AEngRH7hSe4DM", "payload": { "username": "admin", "exp": 1647096111, "origIat": 1647095811 }, "refreshExpiresIn": 1647700611 } } } Next, when I ran this graphql with "refreshToken" field in "Long running refresh tokens" mode: mutation { tokenAuth(username: "admin", password: "admin") { token payload refreshExpiresIn refreshToken // … -
How to store Url parameters value in variable using django? [closed]
Url - http://127.0.0.1:8000/result/?query=boys view.py - query = request.GET.get('query') params = { "query":{query}, "image_type":"photo" } -
How to multiply two variables together in HTML template DJANGO
I have this page that lists various info on a specific stock including orders that have been placed on that specific item. I would like to display how much money the user of this system would get from that specific order. <table class='table'> <thead> <tr> <th>ORDER ID</th> <th>NAME</th> <th>AMOUNT ORDERED</th> <th>REVENUE</th> <th>ORDERED ITEM</th> <th>ADDRESS</th> <th>CITY</th> </tr> </thead> {% for x in queryset2 %} <tr> <td>{{x.id}}</td> <td>{{x.name}}</td> <td>{{x.quantity}}</td> <td>{{x.quantity * stock.ppu}}</td> <td>{{x.order_item}}</td> <td>{{x.address}}</td> <td>{{x.city}}</td> </tr> {% endfor %} </table> I have this code so far. What would be the correct syntax to multiply these two variables together : {{x.quantity * stock.ppu}} -
here i am creating a ecommerce website using Django code .but facing error during installations of requirements [closed]
The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html Traceback (most recent call last): File "C:\Users\MY PC\AppData\Local\Temp\pip-install-0t2cfsyb\pillow_f848d0aa6d444c8faf818219ccf20861\setup.py", line 852, in <module> setup( File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py", line 61, in run return orig.install.run(self) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\command\install.py", line 568, in run self.run_command('build') File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\MY PC\AppData\Local\Programs\Python\Python310\lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "C:\Users\MY PC\AppData\Local\Temp\pip-install-0t2cfsyb\pillow_f848d0aa6d444c8faf818219ccf20861\setup.py", line 687, in build_extensions raise RequiredDependencyException(f) __main__.RequiredDependencyException: zlib During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "C:\Users\MY PC\AppData\Local\Temp\pip-install-0t2cfsyb\pillow_f848d0aa6d444c8faf818219ccf20861\setup.py", line 903, in <module> raise RequiredDependencyException(msg) __main__.RequiredDependencyException: The headers or library files could not be found for zlib, a required dependency when compiling … -
DJANGO MODELCHOICEFIELD DEFAULT FIELD SHOWS FIELD REQUIRED ERROR ON UPDATEVIEW
I am trying to let users complete their registration by updating their Profile with other data. The Profile model is linked to Django's User model via foreignkey relationship in models.py as shown below: class Profile(models.Model): user_main = models.ForeignKey(User, on_delete=models.DO_NOTHING) And my forms.py I have: class ProfileForm(ModelForm): class Meta: model = Profile fields = ('user_main', 'other_fields') widgets = { 'user_main': forms.Select(attrs={ 'id': 'user_main', 'class': 'form-control input-lg userprofile-class disabled', 'name': 'user_main', 'disabled': True }), And views.py: class UserUpdateView(LoginRequiredMixin, UpdateView): form_class = ProfileForm template_name = "registration/update_profile.html" success_url = '/theportal/home-page' def get_initial(self): #set initials and return it So, the form displays with the user_main already pre-selected and it is disabled by default so that users cannot mistakenly select another user for it. But when I click submit button, I get error This field is required. for already selected user_main and when the form returns with the error, the reloaded form comes back with all the data entered by the user but user_main is now empty as shown in the attached screenshot. How do I rectify this? -
Redirect in CreateView Django doesn't work
Hi I try to make a blog using CBV. I want after create a new post in post_form.html the CreateView will redirect to the new post_detail I just made. So I was search on gg and try both get_success_url and redirect_field_name. But it still had error Page not found . Because of that I really don't know the new post was created or not. Can someone check it for me. Views.py class PostCreateView(LoginRequiredMixin,CreateView): login_url = '/login/' form_class = forms.Post_form model = models.Post #redirect_field_name = 'mlog/post_detail.html' def get_success_url(self): return reverse('post_detail', kwargs={'pk': self.object.pk,}) urls.py path('post/<int:pk>/',views.PostDetailView.as_view(),name='post_detail'), path('post/new/',views.PostCreateView.as_view(),name='post_new'), path('post/<int:pk>/edit/',views.PostUpdateView.as_view(),name='post_edit'), path('post/<int:pk>/remove/',views.PostDeleteView.as_view(),name='post_remove'), path('dratf/',views.DraftListView.as_view(),name='post_draft_list'), -
Multiple select with same name django
Please i need help with the following: i have the following select: <select multiple class="form-control"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> </select> i want to clone it with jquery and submit multiple select like this, in php i add a "[][]" in name, and the result is some like: [[1,1,1,], [2,2,2]], how i achieve this using django? thanks -
Cache when user open multiple tabs Redis + Django
I have a database that is updated once a month, so I use redis to save cache Everything works fine for me, I add user name after a key like this: nhan_vien=CustomUser.objects.get(id=request.user.id).username contract_number = cache.get("contract_number" + nhan_vien) my settings: CACHES = { "default": { "BACKEND": "django_redis.cache.RedisCache", "LOCATION": "redis://127.0.0.1:6379/1", 'TIMEOUT': 60 * 60 * 8, "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", } } } A user cannot access cache from another users. If a user open 2 tabs, Tab1: he/she has contract_number from cache.get("contract_number" + nhan_vien). He open new tab2, then he/she has new contract_number from cache.get("contract_number" + nhan_vien) My issue when he/she save data in tab1, my website gets value from new contract_number (in tab2) to save data while the content belongs to contract_number in tab1. If I set Timeout, after this time no record contract is appear and then they cannot save data. I have 3 questions: How can I handle this issue by redis + django. How can I dont allow user opens a new tab while they access my website? If I cannot solve this by only redis + django, Is there any other solutions? I used to read in Stackoverflow https://stackoverflow.com/questions/7763115/django-passing-data-between-views how can pass data between views. Solution … -
I can't install django through pip
Im trying to install django on an venv using python (3.9) on vsc. I already had a hard time activating the venv and now i can't seem to be able to install django. when i use pip install django this shows up : (env) PS C:\CODE_PROJECTS\django_test> pip install Django Fatal error in launcher: Unable to create process using '"C:\Users\camil\CODE_PROJECTS\django_test\env\Scripts\python.exe" "C:\CODE_PROJECTS\django_test\env\Scripts\pip3.9.exe" install Django': O sistema nÒo pode encontrar o arquivo especificado. I have tried pip3, pip3.9 also and same result What should I do? -
"GET /css/styles.css HTTP/1.1" 404 2578
I'm new to Django and this is my first time using it. I keep getting the error "GET /css/styles.css HTTP/1.1" 404 2578" I've already looked through other solutions posted and none have helped. I've followed the documentation exactly as laid out by Django's documentation, but it still isn't working. Relevant settings.py STATIC_URL = 'static/' STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIR = [ os.path.join(str(BASE_DIR.joinpath('static')),) ] index.html {% load static %} <html lang="en"><head> ... <link href="{% static 'css/styles.css' %}" rel="stylesheet"/> </head>... Relevant urls.py urlpatterns = [ path('admin/', admin.site.urls), path('', include('App1.urls')), ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) Here is an image of my current directory -
django celery [celery.worker] DEBUG: Timer wake-up! Next ETA when run a scrapy process
I am running a simple spider in Django using celery, in the task.py file. Code that run my spider is below: file task.py: @shared_task(bind=True) def scrape_amazon_products(self,products_urls,current_user,task_id,current_site): process = CrawlerProcess() process.crawl(my_spider) #Here the name of the spider process.start() process.stop() It works great, spider starts and finished but: Problem: The celery never stops and giving these logs continuously mentioned below: [2022-03-12 19:44:57,512: WARNING/MainProcess] 2022-03-12 19:44:57 [celery.worker] DEBUG: Timer wake-up! Next ETA 1.0 secs. [2022-03-12 19:44:58,535: DEBUG/MainProcess] Timer wake-up! Next ETA 0.9690000000118744 secs. [2022-03-12 19:44:58,536: WARNING/MainProcess] 2022-03-12 19:44:58 [celery.worker] DEBUG: Timer wake-up! Next ETA 0.9690000000118744 secs. [2022-03-12 19:44:59,527: DEBUG/MainProcess] Timer wake-up! Next ETA 1.0 secs. [2022-03-12 19:44:59,528: WARNING/MainProcess] 2022-03-12 19:44:59 [celery.worker] DEBUG: Timer wake-up! Next ETA 1.0 secs. [2022-03-12 19:45:00,543: DEBUG/MainProcess] Timer wake-up! Next ETA 0.9839999999967404 secs. [2022-03-12 19:45:00,544: WARNING/MainProcess] 2022-03-12 19:45:00 [celery.worker] DEBUG: Timer wake-up! Next ETA 0.9839999999967404 secs. [2022-03-12 19:45:01,546: DEBUG/MainProcess] Timer wake-up! Next ETA 0.062000000005355105 secs. [2022-03-12 19:45:01,547: WARNING/MainProcess] 2022-03-12 19:45:01 [celery.worker] DEBUG: Timer wake-up! Next ETA 0.062000000005355105 secs. [2022-03-12 19:45:01,619: DEBUG/MainProcess] Timer wake-up! Next ETA 1.0 secs. [2022-03-12 19:45:01,620: WARNING/MainProcess] 2022-03-12 19:45:01 [celery.worker] DEBUG: Timer wake-up! Next ETA 1.0 secs. [2022-03-12 19:45:02,627: DEBUG/MainProcess] Timer wake-up! Next ETA 0.9219999999913853 secs. [2022-03-12 19:45:02,628: WARNING/MainProcess] 2022-03-12 19:45:02 [celery.worker] DEBUG: Timer wake-up! Next … -
Django rest framwwork and MVC architecture
In the Django framework and MVC architecture, the Django Rest Framework serializer and validation of inputs(query_param, body and etc) is part of the controller layer or presentation layer? In this response/request scenario What are the layers related to MVC? request <> django-middleware <> django-view <> DRF serializer <> personal-function <> model -
How to render multiselect field
I have a bootstrap theme that I'm trying to use to style a multi checkbox from a ModelForm but I can't get this to render correctly when applying the attrs() Model class ProjectForm(ModelForm): class Meta: model = Project fields = ('name','website','description','category','type','platform','token_total_supply', 'stage','blockchain','twitter_handle','contract_address') widgets = { 'name': forms.TextInput(attrs={'class': 'form-control wd-xl-250'}), 'website': forms.URLInput(attrs={'class': 'form-control wd-xl-250'}), 'description': forms.Textarea(attrs={'class': 'form-control wd-xl-250'}), 'blockchain': forms.CheckboxSelectMultiple(), } HTML Template <div class="parsley-checkbox wd-250 mg-b-0" id="cbWrapper2"> <label class="ckbox mg-b-5-f"><input data-parsley-class-handler="#cbWrapper2" data-parsley-errors-container="#cbErrorContainer2" data-parsley-mincheck="2" name="browser[]" required="" type="checkbox" value="1"><span>Polygon</span></label> <label class="ckbox mg-b-5-f"><input name="browser[]" type="checkbox" value="2"><span>Ethereum</span></label> <label class="ckbox mg-b-5-f"><input name="browser[]" type="checkbox" value="3"><span>Solana</span></label> <label class="ckbox"><input name="browser[]" type="checkbox" value="4"><span>Binance</span></label> </div><!-- parsley-checkbox --> Using Django Form <div class="parsley-checkbox wd-250 mg-b-0" id="cbWrapper2"> {{ form.blockchain }} </div> I've tried adding 'blockchain': forms.CheckboxSelectMultiple(attrs={'class': 'ckbox mg-b-5-f'}), But it doesn't work, and i'm not sure why. It should be like this: But I get What am I doing wrong here? -
Pusher - autenticated users not receiving events from private channels
Let's say I have a vue client trying to receive an event from a private channel using pusher services. This client autenticates using pusher auth secuence: Here are the docs: https://pusher.com/docs/channels/server_api/authenticating-users/ Seems I need to provide an endpoint on my server in order to autenticate the user. So, as the docs says, since my server is in a different domain to the front-end app, I need to use CORS or JSONP, I choose JSONP. My server (backend) is made in Django using django-rest-framework and it provides an endpoint that is responsible to process the socket_id, the channel_name and the callback that the pusher-js (which is a pusher frontend library) generates. Something alike to a javascript code is sent to the frontend, so the response needs to be content-type:application/javascript. In order to test the event, I made a simple python script which I will later integrate to my bussiness logic. This script is the responsible to trigger the event. The problem: Well, the main problem is the event never arrives. I looked up into the web-console (frontend) to check the correct function of the requests. The ws protocol requests responds with status 101 and the endpoint /auth/pusher with status 200. So … -
What are the options to deploy my e-commerce Django project?
I am currently learning Django and I am planning to deploy my project to sell a product. What options do I have to deploy? -
Measure Time spent on a view in django
I have a django view that prompts the user to enter something into an input. I want to measure the time that the user took to submit the form. How is this possible? I've seen related problems like Printing Time spent on a view in Django but it doesn't seem to solve my issue, because I do not want to measure the time taken on a function call. Alex -
Remove username field from Django Allauth
I'm trying to remove the username field after overriding the Django Allauth package. I tried the following suggestions: Set ACCOUNT_USER_MODEL_USERNAME_FIELD = None and some more inside settings.py as following: ACCOUNT_USER_MODEL_USERNAME_FIELD = None ACCOUNT_AUTHENTICATION_METHOD = 'email' ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_UNIQUE_EMAIL = True ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_EMAIL_VERIFICATION = 'mandatory' ACCOUNT_PASSWORD_MIN_LENGTH = 8 Overriding User Model in venv\Lib\site-packages\django\contrib\auth\models.py class User(AbstractUser): username = None email = models.EmailField(_('email address'), unique=True) USERNAME_FIELD = 'email' class Meta(AbstractUser.Meta): swappable = "AUTH_USER_MODEL" both failed, as when I run py manage.py createsuperuser, I still got the username field popping up: Username (leave blank to use 'admin'): How can I safely remove the username field while overriding Django Allauth? Could you show me a way to solve this? Thank you! -
Real Time Flash Messages in Django with Django Channels
i want to be implement a real time flash message feature that immediately sends flash messages through django-channels websocket connection to the webpage without the need to pass the message through the normal request method. An Example would be displaying a flash message as soon as notification is received by the channels websocket connection. is this possible? if yes how can it be done. else what other alternatives can be used to achieve the real time flash message functionality (it doesn't have to be django channels) -
I need an logic implementation of following simple scenario
Queue implementation of request I need to run multiple thread in python. My Scenario is: Users send requests on an API. Every user has a Account. Every Account has some request tags like ['1','2','3'] What I need is to run different python background Threads for different Account. Example : user 1 with account 1 -> send request then create new thread that handle request for Account 1 user 2 with account 1 -> send request then if account 1 thread is already running its push in the Account 1 Queue user 3 with account 2 -> send request then if **account 2 ** thread is already running its push in the **Account 2 ** Queue else create new Thread Important Point I also need to keep track of update push in Account Queue: Example: for request in account1Q: #do something if request.last(): if check_for_update_in_queue: reRun Thread else: kill Thread() -
NOT NULL constraint failed: home_contact.name
I Keep Reciving This Error Even All The Attribute Name Is Same From Contact.html and view.py untegrityError at /contact NOT NULL constraint failed: home_contact.name Also Done migration and migrate still no solution views.py from django.shortcuts import render,HttpResponse from datetime import datetime from home.models import Contact # Create your views here. def index(request): # return HttpResponse("This Is Homepage") # To Render String Use HttpResponse context = { 'variable' : "This IS SEND 121212", 'v2' : "V@" } return render(request,'index.html',context) # Render Menas It Load The index.html file and send the data of context def about(request): # return HttpResponse("This Is About") # To Render String Use HttpResponse return render(request,'about.html') # Render Menas It Load The index.html file and send the data of context def services(request): # return HttpResponse("This Is Services") # To Render String Use HttpResponse return render(request,'services.html') # Render Menas It Load The index.html file and send the data of context def contact(request): # return HttpResponse("This Is Contact") # To Render String Use HttpResponse if request.method == "POST": name = request.POST.get('nme') print(name) # email = request.POST.get('email') # print(email) # pwd = request.POST.get('pwd') # print(pwd) c1 = Contact(name=name) # contact = Contact(name=name,email=email,pwd=pwd,date=datetime.today()) c1.save() return render(request,'contact.html') # Render Menas It Load The index.html …