Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Error binding parameter 14 - probably unsupported type
Here's my code for saving a staff profile into the sqlite3. What could i be missing? .................... def save(self): super(StaffProfile, self).save() img = Image.open(self.image.path) if img.height > 300 or img.width > 300: output_size = (300, 300) img.thumbnail(output_size) img.save(self.image.path) -
template not rendering after post request in django
I am trying to render a template after the post request is submitted via JQuery but the template is not rendering and stuck on the same page JQuery code $(document).ready(function(){ $("#issuebtn").click(function (){ var csrft=$("#csrf_t").val(); var issueid=$("#issuebtn").attr("data-issue-id"); $.post('/fetchRules',{iss_id:issueid,csrfmiddlewaretoken:csrft}); }); }); views.py def fetch_rules(request): if request.method=='POST': iss_id=request.POST.get('iss_id','') rules=Rules.objects.all().filter(parentissue=iss_id) return render(request,"questions.html",{"rules":rules}) Urls.py from django.urls import path,include from . import views urlpatterns = [ path('', views.homepage,name="home"), path('fetchRules', views.fetch_rules,name="fetchrules"), ] -
Filter all object form django modal if its id is not available to other table
Comments(models.Model): comments = models.CharField(max_length=55) UsedComment(model.Model): comment_id = model.ForeginKey(Comments, on_delete=models.CASCADE) I want to filter all the comments Model if comment id is not present in used comment model -
ForeignKey between Django Models abstract base classes
I have a Django app where I want to use a set of abstract base classes to define certain models. I want to connect some of these abstract models through foreign keys. I know that Django does not allow models.ForeignKey to abstract models. I've done some searching on StackOverflow and the general consensus solution seems to be - using GenericForeignKey. However, from my understanding, this results in an extra db-level SELECT call. I want to avoid this because quite a few of my abstract models have this kind of relationship. An example is given below: class Person (models.Model): name = models.CharField (max_length=256) class Meta: abstract = True class Phone (models.Model): phone_no = models.BigIntegerField () owner = models.ForeignKey (Person) # This is, of course, wrong. I'd like something like this. class Meta: abstract = True Besides the posts about GenericForeignKey, I also came across a post about dynamic model generation. The link is given below. The question-poster themselves have provided the answer. Defining an Abstract model with a ForeignKey to another Abstract model I would like to ask: if this still holds for the current versions of Django, if there are any caveats I should be aware of, and if there … -
Django UpdateView condition for form_valid()
So this is what I have: #models.py class Story(models.Model): title = models.CharField(max_length=150) story = models.TextField() page = models.ForeignKey(Page, on_delete=models.CASCADE) #views.py class StoryUpdateView(LoginRequiredMixin, UserPassesTestMixin, UpdateView): model = Story fields = ['title', 'content'] def form_valid(self, form): story = self.get_object() if self.request.user in User.objects.filter(groups__name=story.page.name): return super().form_valid(form) else: pass def test_func(self): story = self.get_object() if self.request.user in User.objects.filter(groups__name=story.page.name): return True return False #urls.py path('edit_story/<int:pk>', StoryUpdateView.as_view(), name='update-story') here I want to give access to this update view to a group of users. So my query should be like this: if the current user is in User.objects.filter(groups__name=story.page.name) group, then he should have access to update a story. Now I believe that my form_valid() and test_func() method is wrong. But I can't find a way to make it right. What should be the right logic for doing this? Also, to get the story, what should I do? Do I do story = self.get_object() as done here which possibly is not working or do I need to use the method get_object_or_404() and how to do that? Any help will be much appreciated -
How to display questions that are stored in database one by one so user can answer the question and then proceed to next question in Django?
I am making a car diagnosis app using expert system and i have stored the facts or you can say questions in the database and i want to show the next question accordingly to the user's choice (yes or no). The app will ask user questions about the car symptoms and the app will show the next question accordingly. Template {% extends 'base.html' %} {% block content%} <div class="questionwrapper"> {% for rul in rules %} <div class="question"> <h1>{{rul.question}}</h1> </div> <div class="solution"> <p>{{rul.solution}}</p> </div> {% endfor %} <div class="question_btns"> <a id="yes_q" href="#">Yes</a> <a id="no_q" href="#">No</a> </div> </div> {% endblock %} Views.py def questions_page(request): if request.method=='POST': stateid=request.POST['selected_state'] rules=Rules.objects.all().filter(state=stateid) return render(request,"questions.html",{"rul":rules}) -
Django Runserver error while executing "Python manage.py runserver"
C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\Scripts\FirstDjango Proj>python manage.py runserver Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x00000000038D00D0> Traceback (most recent call last): File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\utils\autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\core\management\commands\runserver.py", line 117, in inner_run autoreload.raise_last_exception() File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\utils\autoreload.py", line 251, in raise_last_exception six.reraise(*_exception) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\utils\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\utils\autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\apps\registry.py", line 85, in populate app_config = AppConfig.create(entry) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\apps\config.py", line 94, in create module = import_module(entry) File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\importl ib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\contrib\admin\__init__.py", line 4, in <module> from django.contrib.admin.filters import ( File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\contrib\admin\filters.py", line 10, in <module> from django.contrib.admin.options import IncorrectLookupParameters File "C:\Users\SRIRAM_CHIVO\AppData\Local\Programs\Python\Python38\lib\site-pa ckages\django\contrib\admin\options.py", line 12, in <module> from django.contrib.admin import helpers, widgets SyntaxError: Generator expression must be parenthesized (widgets.py, line 152) Django version installed successfully-1.11.10 python version-3.8.1 Project created and manage.py as well created. BUt … -
How to prevent second for loop from slowing down data return from service
I am using firestore get data in my django application. The query stream works just well. I am trying to do some relation query, get the author of post from another table. I am not sure if this is the way it's done with django. Here is the code I have: # Get Updates Method def get_updates(): # Get Updates From Firestore user_ref = firestore_client.collection('post') query = user_ref.where('status', '==', 'online').order_by('updatedAt', direction=firestore.Query.DESCENDING) # Updates Lists updates = [] # For Loop to get stream into list and change date strings to django friendly for doc in query.stream(): updates.append(doc.to_dict()) for update in updates: # Get Update Author author_ref = firestore_client.collection('users').document(update['uid']) author = author_ref.get() if author.exists: update['name'] = author.get('displayName') update['avatar'] = author.get('photoURL') update['createdAt'] = datetime.strptime(doc.get('createdAt'), '%Y-%m-%d %H:%M:%S') update['updatedAt'] = datetime.strptime(doc.get('updatedAt'), '%Y-%m-%d %H:%M:%S') The second for loop increases the load time. The page loads and I get the result I want but too slow. What would be the efficient way to do this? -
How to get details about RuntimeError: populate() isn't reentrant?
I saw some similar questions about this problem but I could not find any solutions. I am running my Django app with Apache and usually when I wake up my App is down and the only info in the console is that: raise RuntimeError("populate() isn't reentrant") RuntimeError: populate() isn't reentrant. After I restart Apache everything is fine. I ran python manage.py check but it found 0 issues. How can I get the exact problem to make it work, or how can I make Apache restart if the app is down? -
how can I customize send by form data in Django
I want to send data from Form but can't send a specific data for example: in my model has a student that I want send separate from view in view: student = Student.objects.filter(id=id) if request.method == "POST": form = StudentProject(request.POST, files=request.FILES) form.student_id=id form.save() return redirect('main') in form: class Meta: model=Project fields=['name','link','image','body','term'] in model: name=models.CharField(max_length=100,null=False) link=models.CharField(max_length=1000,null=False) image=models.ImageField(upload_to='static/project/images/') body=models.TextField() term=models.DecimalField(max_digits=1,decimal_places=0,null=False) student=models.ForeignKey(Student,on_delete=models.CASCADE) created_at=models.DateTimeField(default=timezone.now) -
Load Media Files in Django
I'm trying to create a home media server using Django. For this I want it to be in such a way that my media files are stored in an external USB. Now from my code when I try to load the video, it doesn't work. I even tried hard coding a path to see if it works. When I run through Django, It doesn't work but when I directly open the HTML in chrome It works perfectly. Placeholder Template Code: <!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <video width="640" height="480" controls autoplay> <source src="E:/Programming\Projects\Youtube Downloader\Ariana Grande - One Last Time (Official).mp4" type="video/mp4"> </video> <p><b>Note:</b> The autoplay attribute will not work on some mobile devices.</p> </body> </html> Actual Template: {% extends 'MediaPlayer/layout.html' %} {% block MainContent %} {{ video_source}} <video width="640" height="360"> <source src="E:/OneLastTime.mp4" type="video/mp4"> </video> <p><b>Note:</b> The autoplay attribute will not work on some mobile devices.</p> {% endblock %} {% block PageScripts %} {% endblock %} View that calls the template: def select_video_page(request, video_id): file_path = FILE_SCANNER.files["video"][video_id] context = { "video_source": file_path, "title": '.'.join(file_path.split("\\")[-1].split(".")[:-1]) } return render(request, "MediaPlayer/selectvideopage.html", context) Everything on the page works perfectly fine, Template loads and everything. Only issue i'm facing is with the … -
Implement Signing data in django
I have a code in c#. public string GetSign(string data) { var cs = new CspParameters { KeyContainerName = "PaymentTest" }; var rsa = new RSACryptoServiceProvider(cs) { PersistKeyInCsp = false }; rsa.Clear(); rsa = new RSACryptoServiceProvider(); rsa.FromXmlString("<RSAKeyValue><Modu- lus>My RSA Private Key</RSAKeyValue>"); byte[] signMain = rsa.SignData(Encoding.UTF8.GetBytes(data), new SHA1CryptoServiceProvider()); string sign = Convert.ToBase64String(signMain); return sign; } I want to implement this code in django. In this code , SHA1 is used. I implemented this in python with SHA256 but result is not same. from Crypto.PublicKey import RSA from Crypto.Cipher import PKCS1_v1_5 as Cipher_PKCS1_v1_5 from Crypto.Signature import PKCS1_v1_5 from base64 import b64decode, b64encode def sign_data(data, private_key_path): from Crypto.Hash import SHA256 message = b64encode(bytes(data, 'utf8')) digest = SHA256.new() digest.update(message) private_key = False logger.info(private_key_path) with open(private_key_path, "r") as key_file: private_key = RSA.importKey(key_file.read()) signer = PKCS1_v1_5.new(private_key) sig = signer.sign(digest) sig = b64encode(sig) return sig I changed SHA256 to SHA1 but it gives me error : File "/home/kamiar/.pyenv/versions/3.6.8/lib/python3.6/site-packages/Crypto/Util/asn1.py", line 211, in encode raise ValueError("Trying to DER encode an unknown object") I dont know what is my problem. Can somebody help me ? -
Django: UniqueConstraint Not Enforced
Thanks in advance! In Python, I'm trying to use a UniqueConstraint as follows: class CitationVote(models.Model): user_who_voted = models.ForeignKey('User', on_delete=models.CASCADE) vote = models.IntegerField(choices = [(-1, "down"), (1, "up")]) timestamp_voted = models.DateTimeField() citation_id = models.ForeignKey('Citation', on_delete=models.CASCADE) class meta: constraints = [models.UniqueConstraint(fields=['user_who_voted', 'citation_id'], name='one_vote_pp')] Although the Django 3.0 docs do not mention any restriction on using UniqueConstraint with a Foreign Key (or Unique_Together, neither of which work in this example), the restriction is certainly not enforced in testing. I don't see anything in migrations either that indicate the constraint being enforced in Postgres. For kicks, I changed the code to: class CitationVote(models.Model): user_who_voted = models.ForeignKey('User', on_delete=models.CASCADE) vote = models.IntegerField(choices = [(-1, "down"), (1, "up")]) timestamp_voted = models.DateTimeField() citation_id = models.ForeignKey('Citation', on_delete=models.CASCADE) class meta: constraints = [models.UniqueConstraint(fields=['vote', 'timestamp_voted'], name='one_vote_pp')] Alas, the same thing occurs (and yes, I drop the entire DB and recreate it fresh each time)-- no constraint enforced, nothing in migrations to suggest it would be after applying them. Am I doing something obviously wrong here? Thanks! -
Unable to select radio choices of form
I have an HTML with 2 forms. I want to be able to select one from the first two and one from the next three radio buttons. How to I achieve this? Given below is the html snippet: <form method="POST" action="/profiles/adminKaLogin/"> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" class="custom-control-input" id="defaultInline1" name="inlineDefaultRadiosExample"> <label class="custom-control-label" for="defaultInline1">Vendor 1</label> </div> <!-- Default inline 2--> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" class="custom-control-input" id="defaultInline2" name="inlineDefaultRadiosExample"> <label class="custom-control-label" for="defaultInline2">Vendor 2</label> </div> <h3> Select time period</h3> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" class="custom-control-input" id="defaultInline1" name="inlineDefaultRadiosExample1"> <label class="custom-control-label" for="defaultInline1">1 Month</label> </div> <!-- Default inline 2--> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" class="custom-control-input" id="defaultInline2" name="inlineDefaultRadiosExample1"> <label class="custom-control-label" for="defaultInline2">2 Months</label> </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" class="custom-control-input" id="defaultInline2" name="inlineDefaultRadiosExample1"> <label class="custom-control-label" for="defaultInline2">6 Months</label> </div> <button type="submit" class="btn btn-primary" name="form1">Submit</button> </form> Note that these buttons have to be in groups of 2 and 3, because I have different uses for them in the backend. Thanks. -
How should I use Django-setting ATOMIC_REQUESTS? It doesn't work as I expected
macOS, Django 1.11, mysql 5.7, I want to know how ATOMIC_REQUESTS worked, how can I use it. # some code in settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'HOST': '127.0.0.1', 'NAME': 'kma_dev', 'USER': 'root', 'PASSWORD': 'root', 'ATOMIC_REQUEST': True, } } When I raise an Error in view, mysql operation didn't roll back. # test raise Error in view like this⬇️⬇️ class StoreGroup(View): def get(self, request): s = Store.objects.first() s.name = s.name + 'ABC' s.save() raise ValueError Thanks very much. -
Nested Serializer Creation
I am using django rest framework. I am trying to use create() method for serializer. In DishSerializer when i am trying to pass Dish reference to the Ingredient instance It shows Unaccepted keyword argument Ingredient Model class is: class ingredient(models.Model): dish_id = models.ForeignKey(Dish, on_delete=models.CASCADE, null = True, related_name='ingredientInfo') . . . Here is My Dish Serializer: class DishSerializer(serializers.ModelSerializer): ingredientInfo = IngredientSerializer(many = True) class Meta: model = Menu fields = ['id', 'name','type','status','ingredientInfo'] def create(self , validated_data): ingredientInfo_data = validated_data.pop('ingredientInfo') dish = Dish.objects.create(**validated_data) for info in ingredientInfo_data: Ingredient.objects.create(**info, dish = dish) return dish It shows me Ingredient() got an unexpected keyword argument 'dish' -
How to return custon json in django rest framework multiple model
I am working on a project and i am stuck on registration api.Or I should override drf_multiple_models?.I am getting this response by the views that I have provided and I don't want response like this: { "message": "success", "code": 200, "country": [ { "country_name": "nepal", "country_code": "977" } ], "postal code": [ { "post_code": 105 } ], "suburb": [ { "suburb_name": "damak" } ], "state": [ { "state_name": "india1" } ] } but i need response like this { "message": "success", "code": 200, "country": [ { "country_name": "nepal", "country_code": "977" } "postal code": { "post_code": 105 } "suburb": { "suburb_name": "damak" } "state": { "state_name": "india1" } }] here is my views: class InformationList(APIView): def get(self, request): country=self.request.query_params.get('country') post = self.request.query_params.get('post') city = self.request.query_params.get('city') state = self.request.query_params.get('state') query1 = Country.objects.filter(country_code=country).values('country_name', 'country_code') query2 = Post.objects.filter(post_code=post).values('post_code') query3 = Suburb.objects.filter(suburb_name=city).values('suburb_name') query4 = State.objects.filter(state_name=state).values('state_name') return Response({"message": "success", "code":status.HTTP_200_OK,"country": query1, "postal code": query2, "suburb": query3, "state": query4}) need help. thanks in advance -
Slow query on index_together fields in Django
I've got controller input data uploading management command in Django 2.2.3 with PostgreSQL server 10.7. After profiling I've found that from 5 seconds execution time on example data in sum after 1750 iterations 3 seconds are spent on existing_variable_value = VariableValue.objects.get(variable_id=variable.id, record_id=record.id) source string. It is really bad and strange. In VariableValue model Meta subclass there is statement index_together = unique_together = ['record', 'variable']. If I execute explain analyze select * from analytics_variablevalue where record_id = '1' and variable_id = '2'; in PSQL console I see Index Scan i.e. index is used. Also PSQL shows execution time: 0.063 ms, if I multiply it on 1750 variable values count in source data file it is 110 ms, which is far less than 3 seconds that I get in Django code. Could anybody help me explain such behaviour and optimize my code? -
Django Newbie - NoReverseMatch Error - Everything looks ok in my urls.py what am I doing wrong
Have no idea what I'm doing wrong - and I swear it was working a few hours ago. urls.py: urlpatterns = [ path('create', views.create, name='create'), path('<int:bet_id>/', views.detail, name='detail'), **path('<int:bet_id>/wager/', views.wager, name='wager'),** ] this is the link the html template: a href ="{% url 'wager' bet.id %}" views.py: def wager(request, bet_id): bet = get_object_or_404(Bet, pk=bet_id) **return render (request, 'bets/wager.html', {'bet':bet})** And here's the error (6 is the specific bet_id for this case) NoReverseMatch at /bets/6/wager/ Reverse for 'wager' with no arguments not found. 1 pattern(s) tried: ['bets/(?P[0-9]+)/wager/$'] -
PermissionError Django
models.py class Review(models.Model): book = models.ForeignKey(Book, on_delete=models.CASCADE, related_name='reviews') author = models.CharField(max_length=50) text = models.TextField() grade = models.IntegerField(default=1) created_date = models.DateTimeField(default = timezone.now) def __str__(self): return self.text forms.py from django import forms from .models import Book, Review class ReviewForm(forms.ModelForm): class Meta: model = Review fields = ['author', 'text', 'grade'] views.py def add_review(request): if request.method == "POST": form = ReviewForm(request.POST) if form.is_valid(): review = form.save(commit = False) review.generate() return redirect('../') else: form = ReviewForm() return render(request, "./",{"form": form}) add_review.html {% extends 'bookstore/computer/game.html' %} {% block addreview %} <h1>New Review</h1> <form method="POST" class="post-form">{% csrf_token %} {{ form.as_p }} <button type="submit" class="save btn btn-default"> Send </button> </form> {% endblock %} I trying to make comment function. When I click button 'add comment' which in game.html, code make a error "PermissionError at /bookstore/computer/game/add_review" I have a admin id. So I think i have a permmision for my page. But code says "No, you don't have permission!!" Please let me know why I have an error -
How can I embed every image in a directory in an HTML page using Django?
I am trying to create image tags for every file in a directory located in static in my Django project. What is the best way to do this? I suppose I could write pure python with os.listdir and just use strings to concatenate the image tags together using the filenames, but I'm sure there's a better way using Django's HTML formatting. Haven't been able to figure it out. Example: In a folder there is img1.jpg and img2.jpg. How can I produce: <img src="img1.jpg" alt="img1.jpg" height="100px" width="100px"> <br> <img src="img2.jpg" alt="img2.jpg" height="100px" width="100px"> <br> -
Django: JQUERY AJAX POST doesn't call URL for POST
I'm making a post to: /listas/agregar-producto/ Using this space name: {% url 'lists:add_product_to_list' %} However, it doesn't get called at all. Even when the JS fires my alerts that I've put to DEBUG. Why? <script> $(".add-product-btn-for-{{ product.sku }}").click(function () { alert("Entra al JS"); alert("{% url 'lists:add_product_to_list' %}"); $.post("{% url 'lists:add_product_to_list' %}", { c_slug: "{{ product.category.slug }}", s_slug: "{{ product.subcategory.slug }}", product_slug: "{{ product.slug }}", }).done(function (response) { alert("DONEEE!!"); $("#AddedProduct{{ product.sku }}").modal('show'); }); }); </script> urls.py: from . import views app_name = "lists" urlpatterns = [ path('', views.AllLists.as_view(), name='my_lists'), path('agregar-producto/', views.add_product_to_list, name='add_product_to_list'), path('lista-detalles/<int:lista_id>/', views.list_details, name='list_details'), ] views.py: @csrf_exempt def add_product_to_list(request): print("Enters Add Product to List") lista_id = request.COOKIES.get('lista_id') if lista_id: lista = List.objects.get(id=lista_id) else: lista = List.objects.create(name="Lista anónima") lista_id = lista.id c_slug = request.POST.get('c_slug') s_slug = request.POST.get('s_slug') product_slug = request.POST.get('product_slug') try: product = Product.objects.get( category__slug=c_slug, subcategory__slug=s_slug, slug=product_slug) list_item = ListItem.objects.create( lista=lista, product=product, comment="") # response.set_cookie("lista_id", lista_id) # response.set_cookie("product_item_id", product_item.id) #return response return HttpResponse("post request success") except Exception as e: raise e -
Closed the terminal window running the server, but upon trying to rerun the server is says port still in use
I ran python manage.py runserver and the website was running at http://127.0.0.1:8000/. I closed the terminal window running the server, reopened terminal and tried to run python manage.py runserver again, but it says Error: That port is already in use. I can't quit the server with Control-C like I normally do, so I am not sure what do to here? Thanks for any help. -
Is there a django-avatar app with REST API support?
I am working on a django project that uses django avatar. But we also have other clients that are communicating with APIs. Does the django-avatar app have API endpoints or do I have to implement that myself? -
Django deployment on GoogleCloudPlatform
I followed this tutorial and made sure I'm typing and doing everything perfectly. However I'm on GoogleCloudPlatform and I could see the application while I was running server with 0.0.0.0:8000 but I had to enable/create firewall to let me see it. My http permissions on Google Cloud Platform is default. My http settings are these and after following that tutorial I'm not able to see the application with just the IP address. The site just doesn't load and give Gateway Timeout after a while. But even though I run server with 0.0.0.0:8000 I can see the page. Is there any settings I need to enable on GoogleCloudPlatform? I haven't followed the ufw firewall part in the video though so nothing related to firewall on the server itself. while running manage.py check --deploy I'm getting these warnings ?: (security.W004) You have not set a value for the SECURE_HSTS_SECONDS setting. If your entire site is served only over SSL, you may want to consider setting a value and enabling HTTP Strict Transport Security. Be sure to read the documentation first; enabling HSTS carelessly can cause serious, irreversible problems. ?: (security.W006) Your SECURE_CONTENT_TYPE_NOSNIFF setting is not set to True, so your pages will …