Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
What happened if I delete images upload_to in django
So, I made an Image Field model that upload my image to a folder in my computer, the question is I know that this image will use many space in a moment, so what happened if I delete the images of my folder but I already upload it in my website? -
What exactly is rabbitmq heartbeat? How it is used in rabbitmq?
I am having difficulty to understand what is heartbeat in rabbitmq? Does it used at publisher side or consumer side? What would happen is i dont use it while creating connection connection with rabbitmq. I am using python with pika. Please clear my doubts and help me to understand it in simple terms. -
reverse_lazy returns registration/login instead of accounts/login
#url.py (app's url.py) from django.conf.urls import url from django.urls import path from django.contrib.auth import views as auth_views from . import views app_name = 'accounts' urlpatterns = [ path('login', auth_views.LoginView.as_view(template_name='accounts/login.html') , name='login' ), path('logout' , auth_views.LogoutView.as_view() , name='logout'), path('signup', views.SignUp.as_view() , name='signup'), ] #views.py from django.shortcuts import render , redirect from django.views.generic import TemplateView , CreateView from django.urls import reverse_lazy from accounts import forms # Create your views here. class HomePage(TemplateView): template_name = 'index.html' class SignUp(CreateView): form_class = forms.UserCreationForm success_url = reverse_lazy('login') template_name = 'accounts/signup.html' class ThanksPage(TemplateView): template_name = 'thanks.html' class TestPage(TemplateView): template_name = 'test.html' Error TemplateDoesNotExist at /accounts/login/ registration/login.html Request Method: GET Request URL: http://127.0.0.1:8000/accounts/login/ Django Version: 3.0.3 Exception Type: TemplateDoesNotExist Exception Value: registration/login.html Exception Location: C:\Users\dell\miniconda3\envs\myDjangoEnv\lib\site-packages\django\template\loader.py in select_template, line 47 Python Executable: C:\Users\dell\miniconda3\envs\myDjangoEnv\python.exe Python Version: 3.8.3 Python Path: ['E:\django\simplesocial', 'C:\Users\dell\miniconda3\envs\myDjangoEnv\python38.zip', 'C:\Users\dell\miniconda3\envs\myDjangoEnv\DLLs', 'C:\Users\dell\miniconda3\envs\myDjangoEnv\lib', 'C:\Users\dell\miniconda3\envs\myDjangoEnv', 'C:\Users\dell\AppData\Roaming\Python\Python38\site-packages', 'C:\Users\dell\miniconda3\envs\myDjangoEnv\lib\site-packages'] Server time: Sat, 8 Aug 2020 16:56:32 +0000 Template-loader postmortem Django tried loading these templates, in this order: Using engine django: django.template.loaders.filesystem.Loader: E:\django\simplesocial\templates\registration\login.html (Source does not exist) django.template.loaders.app_directories.Loader: C:\Users\dell\miniconda3\envs\myDjangoEnv\lib\site-packages\django\contrib\admin\templates\registration\login.html (Source does not exist) django.template.loaders.app_directories.Loader: C:\Users\dell\miniconda3\envs\myDjangoEnv\lib\site-packages\django\contrib\auth\templates\registration\login.html (Source does not exist) django.template.loaders.app_directories.Loader: C:\Users\dell\miniconda3\envs\myDjangoEnv\lib\site-packages\bootstrap4\templates\registration\login.html (Source does not exist) django.template.loaders.app_directories.Loader: E:\django\simplesocial\accounts\templates\registration\login.html (Source does not exist) -
TypeError: FormListView() missing 1 required positional argument: 'request'
I am newbie in django and i have a problem. When starting the server, the following error occurs: File "/home/user/Portfolio/web_project/web_page/urls.py", line 5, in <module> path('', FormListView(), name = 'home'), TypeError: FormListView() missing 1 required positional argument: 'request' I understand that I am not writing the requests correctly, but now I do not understand what exactly the problem is. urls.py: from django.urls import path from .views import FormListView urlpatterns = [ path('', FormListView(), name = 'home'), path('success/', Success(), name = 'success') ] views.py: from django.core.mail import send_mail, BadHeaderError from django.shortcuts import render, redirect from django.http import HttpResponse, HttpResponseRedirect from .models import Form from django.views.generic import TemplateView def FormListView(request): if request.method == 'GET': form = FormListView() else: form = FormListView(request.POST) if form.is_valid(): name = form.cleaned_data['name'] surname = form.cleaned_data['surname'] email = form.cleaned_data['email'] try: send_mail(name, surname, email, ['kirill_popov_000@mail.ru']) except BadHeaderError: return HttpResponse('Invalid') return redirect('success') return render(request, "index.html", {'form': form}) def Success(request): return HttpResponse('Success!') -
How to publish posts on the home page?
I have some code: models.py (model Posts): STATUS = ( (0,"Draft"), (1,"Publish") ) class Post(models.Model): title = models.CharField(max_length=200, unique=True db_index=True ) slug = models.SlugField(max_length=200, unique=True) updated_on = models.DateTimeField(auto_now= True) publish = models.DateTimeField(auto_now_add=True) status = models.IntegerField(choices=STATUS, default=0) views.py class PostList(generic.ListView): queryset= Post.objects.filter(status=1).order_by('-publish') template_name = 'index.html' paginate_by = 6 urls.py path('', views.PostList.as_view(), name='home'), After I create an article in the admin panel, I click publish, the article is not displayed on the main page. But if you restart the server (manage.py run server), then the article appears on the main page. Question: How to make the article appear on page reload and does not require server reboot? -
Get Foreign Objects instead of QuerySet of List of ID's
single line of code to get the Foreign Key objects instead of QuerySet of UUID's. I have three Models, Student, College, Member Models are defined similar to below class Student(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name=models.CharField(max_length=128) class College(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name=models.CharField(max_length=128) class Member(models.Model): student= models.ForeignKey(Student, related_name="students", on_delete=models.CASCADE) college= models.ForeignKey(College, related_name="colleges", on_delete=models.CASCADE) Where Member contains of Student and College as Foreign Key fields Now I want to get all the Students who belong to a particular College based on college_id which should be filtered from the Member model How I am doing now student_ids = Member.objects.filter(college_id=college_id).values("student") Now students is a QuerySet of list of UUID's of Student As I need actual Student objects instead of QuerySet List of UUID's students = Student.objects.filter(id__in=[str(uid) for uid in student_ids]) I feel this is an improper way. Can anyone suggest a single line of code to get the Foreign Key objects instead of QuerySet of UUID's. Thanks in advance -
Efficient Count of Related Models in Django
In my Django app, when I add the host_count field to my serializer to get the number of hosts for each domain, the performance of the API response suffers dramatically. Without host_count: 300ms With host_count: 15s I tried adding 'host_set' to the prefetch_related method but it did not help. Would an annotation using Count help me here? How can I optimize the fetching of this value? serializers.py class DomainSerializer(serializers.Serializer): name = serializers.CharField(read_only=True) org_name = serializers.CharField(source='org.name', read_only=True) created = serializers.DateTimeField(read_only=True) last_host_search = serializers.DateTimeField(read_only=True) host_count = serializers.SerializerMethodField() def get_host_count(self, obj): return Host.objects.filter(domain=obj).count() views.py class DomainList(generics.ListAPIView): def get(self, request, format=None): domains = Domain.objects.prefetch_related('org').all() serializer = DomainSerializer(domains, many=True) return Response(serializer.data) models.py class Domain(models.Model): created = models.DateTimeField(auto_now_add=True) last_host_search = models.DateTimeField(auto_now=True) name = models.CharField(unique=True, max_length=settings.MAX_CHAR_COUNT, blank=False, null=False) org = models.ForeignKey(Org, on_delete=models.CASCADE, blank=True, null=True) -
AttributeError at /handlerequest/ 'AnonymousUser' object has no attribute 'customer' Even when the user is logged in and has the customer attribute
This is my views.py: @csrf_exempt def handlerequest(request): customer=request.user.customer order, created=Order.objects.get_or_create(customer=customer, complete=False) form = request.POST response_dict = {} for i in form.keys(): response_dict[i] = form[i] if i == 'CHECKSUMHASH': checksum = form[i] verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum) if verify: if response_dict['RESPCODE'] == '01': print('order successful') else: print('order was not successful because' + response_dict['RESPMSG']) return render(request, 'paymentstatus.html', {'response': response_dict,'types':Category.objects.all()}) Even when the user is logged in and has customer attribute(shows logged in on other pages of the site and also in admin I have checked that everything is fine) It gives me this error. I have tried several times to check the mistake but I cant figure out what the problem is. Only the page paymentstatus.html is showing this error(rendered by above view) else in all other pages user is being showed logged in. -
How do I get this python program into an HTML user interface?
This is a program for a twitter bot. I am trying to figure out how I can display it in a user friendly html interface. I think the interface will only need several input forms and a display. It would need four inputs for API key, API secret key, Access token, and Access token secret. It would also need inputs for "search" and "numberOfTweets". Finally it would just need a display to show "Tweet liked". I have some experience with Django so I think I could create the interface using it, but I have no idea where to start. Any help would be awesome. Thanks import tweepy import time auth = tweepy.OAuthHandler('API key', 'API secret key') auth.set_access_token('Access token', 'Access token secret') api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True) user = api.me() search = '#InternationalBeerDay' numberOfTweets = 500 for tweet in tweepy.Cursor(api.search, search).items(numberOfTweets): try: print('Tweet Liked') tweet.favorite() #print('Retweeted') #tweet.retweet() time.sleep(10) except tweepy.TweepError as e: print(e.reason) except StopIteration: break -
Why can't I iterate through object in get_queryset?
If i use Station.objects.last() in get_queryset method i will get an error TypeError at /data-show/ 'Station' object is not iterable. Why is that and how can i fix it? views.py class ShowStationAndSensorsView(ListAPIView): serializer_class = StationSerializer def get_queryset(self): queryset = Station.objects.last() return queryset serializers.py class SensorSerializer(serializers.ModelSerializer): class Meta: model = Sensor fields = '__all__' def create(self, validated_data): sensor_data = validated_data.pop('sensors') station = Station.objects.create(**validated_data) station.save() for sensor in sensor_data: s = Sensor.objects.create(**sensor) station.sensors.add(s.id) return station -
Error on a django-uwsgi-nginx example on Github
Im starting studying the django-uwsgi-nginx deploy, I have a doubt about an example posted on Github a time ago I will be glad if someone can help me solving my doubts although it may sound pretty noob: In this part: "Generate a Django secret key using the supplied script (python django-uwsgi-nginx/tools/django_secret_keygen.py), and put it in the uwsgi.ini file." I generate the key running the little script is provided (the KEY is umivu6his0a@dtovlw5_*17+pv6)f^=lof+&!e##&4xe2)bi**), and I copy and paste it into uwsgi.ini file, but when I try the part: Copy all static folders into the STATIC_ROOT directory: python manage.py collectstatic --settings=djangosite.settings.prod The shell answer me back with: File "/var/www/django-uwsgi-nginx/djangosite/djangosite/settings/prod.py", line 1, in <module> from .base import * File "/var/www/django-uwsgi-nginx/djangosite/djangosite/settings/base.py", line 22, in <module> SECRET_KEY = os.environ['umivu6his0a@dtovlw5_*17+pv**6)f^=lof+&!e##&4xe2)bi'] File "/usr/lib/python2.7/UserDict.py", line 40, in __getitem__ raise KeyError(key) KeyError: 'umivu6his0a@dtovlw5_*17+pv**6)f^=lof+&!e##&4xe2)bi' I have tracked down the base.py and prod.py files, copy and paste the Key inside them, but I get the exact same answer... What am I doing wrong? Greetings -
Allow choosing among a set of models in Django admin inline
I am trying to build an app to manage government forms in Django. I have structured it like so: A Question represents a field, or a set of fields, of a Form. Forms are made up of many Questions. Procedures are composed of one or more Forms. For example, you may have a Tax Procedure that has two forms: A Form where the user may declare their assets, and A Form where they may declare their wage. Each one of those Forms can have multiple Questions: bank account number, name, telephone number... So, in Django, I started by creating both the Procedure and Form models. For the Question model, I used inheritance: class Question(models.Model): #Parent model title = models.CharField(max_length=100) form = models.ForeignKey(Form, on_delete=models.CASCADE) class Meta: abstract = True class NameSurnameQuestion(Question): name = models.CharField(max_length=100) #Name of the user surname = models.CharField(max_length=100) #Surname Now, on the Form object page in the admin site, they should be able to add any Question to the Form object that is currently being edited, using something like a dropdown menu that has a set of predefined Question types (name, address, phone...). (It's like the process of creation in Google Forms). I can't find a way to … -
Django 3.1: StreamingHttpResponse with an async generator
Documentation for Django 3.1 says this about async views: The main benefits are the ability to service hundreds of connections without using Python threads. This allows you to use slow streaming, long-polling, and other exciting response types. I believe that "slow streaming" means we could implement an SSE view without monopolizing a thread per client, so I tried to sketch a simple view, like so: async def stream(request): async def event_stream(): while True: yield 'data: The server time is: %s\n\n' % datetime.datetime.now() await asyncio.sleep(1) return StreamingHttpResponse(event_stream(), content_type='text/event-stream') (note: I adapted the code from this response) Unfortunately, when this view is invoked, it raises the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/asgiref/sync.py", line 330, in thread_handler raise exc_info[1] File "/usr/local/lib/python3.7/site-packages/django/core/handlers/exception.py", line 38, in inner response = await get_response(request) File "/usr/local/lib/python3.7/site-packages/django/core/handlers/base.py", line 231, in _get_response_async response = await wrapped_callback(request, *callback_args, **callback_kwargs) File "./chat/views.py", line 144, in watch return StreamingHttpResponse(event_stream(), content_type='text/event-stream') File "/usr/local/lib/python3.7/site-packages/django/http/response.py", line 367, in __init__ self.streaming_content = streaming_content File "/usr/local/lib/python3.7/site-packages/django/http/response.py", line 382, in streaming_content self._set_streaming_content(value) File "/usr/local/lib/python3.7/site-packages/django/http/response.py", line 386, in _set_streaming_content self._iterator = iter(value) TypeError: 'async_generator' object is not iterable To me, this shows that StreamingHttpResponse doesn't currently support async generators. I tried to modify StreamingHttpResponse to use async … -
Django video streaming
greetings! I'm trying to implement a video streaming application in django. the consumer of the video will be a mobile application which would stream and display the video. My requirement is to ensure that I stream the video (like in youtube), rather than downloading the video file and playing it on the device. I did go through the various resources available. I have the following implemented currently. urls.py from django.contrib import admin from django.urls import path from django.conf import settings from django.conf.urls.static import static from .views import video_stream urlpatterns = [ path('admin/', admin.site.urls), path(r'videos/', video_stream, name='v_stream'), #url(r'^media/', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) views.py import os, mimetypes from django.http import HttpResponseNotFound from ranged_response import RangedFileResponse from django.core.files.storage import default_storage from django.http import HttpResponse from django.core.files.storage import FileSystemStorage from django.conf import settings import urllib, mimetypes from django.http import HttpResponse, Http404, StreamingHttpResponse, FileResponse import os from django.conf import settings from wsgiref.util import FileWrapper import requests def video_stream(request): r = requests.get('http://127.0.0.1:8000/media/watermark.mp4', stream=True) response = StreamingHttpResponse(streaming_content=r) return response when I run the application, I do not get the video playing, however, I get the following: I tried using the vlc media player's stream from url function. I got the following error. System check … -
``` SECRET_KEY = config('SECRET_KEY') NameError: name 'config' is not defined```
I get that error when try to ```heroku run python manage.py migrate tree enter image description here i followed this tutorial Traceback C:\Users\Notnik-kg\Desktop\test\task-4-course-app-master>heroku run python manage.py migrate Running python manage.py migrate on ⬢ second-2... up, run.1359 (Free) Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 345, in execute settings.INSTALLED_APPS File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__ self._setup(name) File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 70, in _setup self._wrapped = Settings(settings_module) File "/app/.heroku/python/lib/python3.8/site-packages/django/conf/__init__.py", line 177, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/app/.heroku/python/lib/python3.8/importlib/__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 "/app/courses/settings.py", line 25, in <module> SECRET_KEY = config('SECRET_KEY') NameError: name 'config' is not defined -
Fill Django list based on another list selection
Is it possible to fill one form drop down list based on the selected item from another list? if possible How can I do this. Or should I use Java script? -
Django Site in Iframe, Setting Cookies Issue
I am using Django 1.8. I have a site which I built, embedding into third-party sites. I have lately been experiencing CSRF issues, and ultimately have traced all issues to the fact that my Django site is not setting cookies within the iframed embed. I do not need to access cookies from the host site which I've placed the iframed Django app in, I just need to set cookies within the iframe and use them within that scope. I have read pretty much every thread I could find on this subject in Stackoverflow, and cannot seem to find anything which works for me. Does anyone have any advice here, please? -
i want to save my district filed in my postcreateapiview like bellow but i dont know how to get my area field?
infact user chooses all filed with area exept district i dont want to get district fields in Postcreateview from user also i want create and save it with area relationship like this def perform_create(self,serializer): area = self.request('area') area2 = Area.objects.filter(id=area) for d in area2: district = d.district serializer.save(user=self.request.user,district=district) but this line is wrong area = self.request('area') my model is: class District(models.Model): title = models.CharField(max_length=50) city = models.ForeignKey(City, related_name='district', on_delete= models.CASCADE) def __str__(self): return self.title @property def get_posts(self): return self.posts.all() @property def get_areas(self): return self.areas.all() class Area(models.Model): title = models.CharField(max_length=50) district = models.ForeignKey(District, related_name='district', on_delete=models.SET_NULL , null=True, blank=True) city = models.ForeignKey(City, related_name='areas', on_delete= models.CASCADE) def __str__(self): return self.title @property def get_posts(self): return self.posts.all() my views.py is: class PostCreateAPIView(generics.CreateAPIView): queryset = Post.objects.all() serializer_class = PostCreateSerializer permission_classes = [IsAuthenticated,] def perform_create(self,serializer): area = self.request('area') area2 = Area.objects.filter(id=area) for d in area2: district = d.district serializer.save(user=self.request.user,district=district) and my serializers.py is: class PostUpateSerializer(ModelSerializer): featured = serializers.SerializerMethodField(method_name="change_boolean") class Meta: model = Post # fields ='__all__' exclude =('user','lader','vip','tamdid','previous_post','next_post','post_views','lader_num', 'slug','view_count','amount_morethan','amount_lessthan','profile','comment_count') -
Is it possible to get a list of imported things from a module in Python?
Is it possible to get the list of imported classes from a module? My code is something like this: from .models import Food, Drink, Topping for m in (Food, Drink, Topping): admin.site.register(m) where I always have to repeat the imported elements. Is it possible to do something like: from .models import Food, Drink, Topping for m in list_of_things_imported_from[".models"]: admin.site.register(m) I tried looking up on google and SO without good results. -
Failed to load resource: net::ERR_INSUFFICIENT_RESOURCES when creating Infinite Scroll
In my front page, I made it for the webpage to load more results when the user scrolls to the bottom of the page. It's paginated so that it loads 15 results at a time. When I'm testing, I have almost 400 in total, and it shows Failed to load resource: net::ERR_INSUFFICIENT_RESOURCES at about 9th page and the page kind of freezes. Why does this happen even though I'm only loading 15 at a time? Do you think I have to use multiple webpage pagination (the "ordinary" pagination where you get redirected to next page)? By the way, I use pure javascript for front-end, and django rest framework in the back-end. I'm kind of a beginner, so my explanation might not be clear, so please be patient with me. -
How to update field and not refresh the template
I am making the polls app in the first Django tutorial. I see each time you vote, the page refresh and goes to the top of the page, I want it to just stay where it is and only update the paragraph tag. detail.html: <html dir="rtl"> <h1>{{ article.title }}</h1> <h2>{{ article.author }}</h2> <h1>{{ article.text }}</h1> <p>I have {{article.votes}}</p> {% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %} <form action="{% url 'main:vote' article.id %}" method="post"> {% csrf_token %} <input type="submit" value="Vote"> </form> </html> vote function in views.py: def vote(request, article_id): article = get_object_or_404(Article, pk=article_id) article.votes += 1 article.save() # TODO: Change it so it doesnt return new refreshed html return render(request, 'main/detail.html', {'article': article}) -
Inconsistent MEDIA URLs in Django 3.0 vs 3.1 in tests
I have a Django project whose models have a thumbnail image, and I have some tests to check the generated paths of the images. # myapp/models.py from django.db import models def thumbnail_upload_path(instance, filename): # There's more happening in this method, but to simplify: return f"books/{filename}" class Book(models.Model): thumbnail = models.ImageField( upload_to=thumbnail_upload_path, null=False, blank=True, default="" ) # tests/myapp/test_models.py from django.test import TestCase from myapp.factories import BookFactory # using factoryboy class BookTestCase(TestCase): def test_thumbnail_url(self): book = BookFactory(thumbnail__filename="tester.jpg") self.assertTrue(book.thumbnail.url.startswith("books/tester")) That test passes in Django 2.2 and 3.0. But when running it in Django 3.1 the thumbnail URL starts with a slash: "/books/tester..." I'm guessing it's this change in 3.1... The STATIC_URL and MEDIA_URL settings set to relative paths are now prefixed by the server-provided value of SCRIPT_NAME (or / if not set). This change should not affect settings set to valid URLs or absolute paths. I'm not sure how to make the test behaviour consistent in all Django versions. When running the tests I set MEDIA_ROOT to tempfile.mkdtemp(). I've tried appending a "/" to the end of that. I've tried setting FORCE_SCRIPT_NAME to "/". On the actual website - not in the tests - I have MEDIA_ROOT = "/" and the image paths … -
Showing Anonymous user error and also not able to check whether user is authenticated only on one page.Working fine on all others in django
My views.py was working fine for every function except the below one(handlerequest).It is showing me error that Anonymous user has no object customer on website even when there is (working correctly on other pages). This is my views.py: @csrf_exempt def handlerequest(request): customer=request.customer.user order, created=Order.objects.get_or_create(customer=customer, complete=False) form = request.POST response_dict = {} for i in form.keys(): response_dict[i] = form[i] if i == 'CHECKSUMHASH': checksum = form[i] verify = Checksum.verify_checksum(response_dict, MERCHANT_KEY, checksum) if verify: if response_dict['RESPCODE'] == '01': print('order successful') else: print('order was not successful because' + response_dict['RESPMSG']) return render(request, 'paymentstatus.html', {'response': response_dict,'types':Category.objects.all()}) Also in my html which I have given below even after writing the if else conditions it is not showing whether the user is logged in or not and it is working correctly for all other pages but not the html page under this view.Below is my html which is working fine for all html files except paymentstatus.html(from the view above) {% if user.is_authenticated %} <li class="d-none d-xl-block"> <div class="alert alert-success" role="alert"> Hello , {{user.first_name}} </div> </li> <li class="d-none d-xl-block"> <a href="/logout/" class="btn header-btn">Logout</a> </li> {% else %} <li class="d-none d-xl-block"> <a href="/signup/" class="btn header-btn">Sign Up</a> </li> <li class="d-none d-xl-block"> <a href="/login/" class="btn header-btn">Login</a> </li> {% endif %} Please … -
I tried using makemigrations to connect the website to the server but got the "password authentication failed for user 'postgres'"error message
I think the problem might be where I saved my local_settings.py but not too sure about that. Does anyone have any idea on what I could do here? Picture of Error Message -
Django: No route found for path 'messages/'
So I have a django project that includes websockets, it works perfect, then I decided to add to another html file script the websockets code to have in two pages the same websockets, the problem is that the websockets of the second page is giving me this error No route found for path 'messages/'. What I think the problem is that I did not add the other url page "messages" to my routing. does anyone know what is going on?