I am new to Python and trying to develop a simple blog application.I am getting NoReverseMatch at / error while trying canonical url. Tried different solution to fix this but i am getting help for django versions which are old. Please help me with a solution for updated Django version. ERROR: Reverse for ‘post_details’ with arguments ‘(2020, ’08’, ’15’, ‘indian-software-industry’)’
Tag: django
Django Rest Framework With Only Function Response
I just want to make a simple API with DRF. The API going to get a “keyword” from URL, and that “keyword” will go to a function. And function response is going to be API response. Simple Example: http://127.0.0.1:8000/api/langdetect/helloworld/ RESULT: It’s all easy. How can I make this? I read the doc but every example is making with Models, serializers
Django ajax: in call does not make any changes
So I made this ajax view for my user model I extends my user model with an Integerfield of notification, but when I call the ajax it does not give +1 to my notification model, does anybody know what is going on? my urls.py and my ajax call my user profile model Answer So, change url: Then, change the view
How to fix TemplatesDoesNotExist error even after BASE_DIR has been Joined with templates in settings.py?
Image 1- Error I notice Exception Value: registration/login.html , I don’t even have that in the templates, instead, i have sign-in.html, I have no idea why it mentioned login.html. Please see my templates folder below as image 3-Templates. I’m trying to fix the above error. My project path looks like Image 2- project path Image 3- Templates The image 2
How to make one dropdown close when clicking another dropdown
I have 2 href links in one page and on click the href opens. But when I click the other href (without closing the first one) the first one stays open. How can I solve this? At first I tried to only open and close the dropdown with CSS, but that got really messy because of the two buttons. Now
How to execute tasks in parallel in Django (Asynchronous programming)?
I am developing a simple view_count. I just want to count the views if the requesting user has not seen the object for a day with its existing user account or ip address. I am using Django and djangorestframework. Here is some sample code for retrieve action. It is pretty simple. I get the requesting object from database and check
Django no module named ‘main’
I was working on a Django project on my PC, Then I created an application named “register” and I get a weird error when I try to run manage.py runserver: im using Python 3.8.3. this error occurs when i added forms for registration. my settings.py: Answer I’m guessing that you didn’t configure your WSGI app as Django’s App engine looks
How to stop having anonymous user in django
So I have a django project and there is one view(home view) which displays the posts of the followed users and that requires a user to be authenticated, if there is no user loged in, then the code returns a ‘AnonimousUser’ is not iterable error and I will like my code to redirect the anonymous user to the login page
How to hide Celery task id from structlog?
I used Structlog and Celery in my Django application and both work very well, but I would like to prevent task_id from appearing in the log when the worker executes tasks. How can I do that? The reason is that task_id is a key:value of 36 characters long so it makes log output hard to read. This is how my
Django json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I’m tyring to use the django login functionality, but ever since i added the login and sign_up route, I started getting this error. Anytime i try to access the sign_up or login route, I kept getting this error…json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) I don’t understand why the get_item function is interfering with the other functions. This