Category "django"

ImportError: Couldn't import Django ... Did you forget to activate a virtual environment?

I know there are several questions/answers about this, but I can;t figure out what I should do. I wanted to get started with Django and installed it with pip i

ConnectionRefusedError at /password-reset/ [WinError 10061] No connection could be made because the target machine actively refused it

When user enter email for password reset then error arise connection failure which is related to server failure error .

how to serve static files through nginx and django in windows

I am a newbie. Just got setup the apache server in windows. But now I need nginx to serve my static files and I think I have searched almost everywhere how to c

Backend docker image does not wait until db becomes available

I am trying to docker-compose up my containers, one for backend and another one for the database (postgis). If I docker-compose up db, I see db_1 | 2021-11-23

URLError: urlopen error timed out

Whenever i try to make a HTTP request to some url through my django application which is running on top of apache mod_python (Machine: Ubuntu 10.04 server editi

Django 'pip install django-heroku'(psycopg2) error is blocking deployment to Heroku

I am setting up a new Django project to deploy on Heroku, however when I am following the Django Heroku deployment guide I come across an error during 'pip inst

Django - multi-level table challenge

I'm new to Django, but an older programmer ;o) I've managed to create a functionally working site that has 5 tables. Where each one is a 1-to-M relationship to

'User' object has no attribute 'get'

I am trying to construct a ModelForm from this solution here, however i am getting this error: 'User' object has no attribute 'get' The idea is to get ModelF

Cannot login a normal user in a django website having a custom user model

I have made a Custom user model for my website. I have used AbstractBaseUser to make the model and also set it up at the settings. The creation of user and supe

How to test authenticated POST request with Pytest in Django

I want to test an authenticated post request on an API using Pytest. This is what I am doing so far: def test_auth_user_can_create(self, client):

Django CSRF Cookie Not Set

I have some problem for a while now, I'm experiencing CSRF Cookie not set. Please look at the codes below Python def deposit(request, account_num): if reque

{% load static %} Shown as a text line in html opened on browser

Im trying to use templatetags, but when i write {% load static %} on top of html document and run, it takes this as a text, and does not load the static. I set

PyCharm doesn't autocomplete Django model queries anymore in 2016.1.2

The 2016.1.2 version of PyCharm doesn't seem to autocomplete queries on Django models anymore. For example on Foo.objects.filter(some-field-lookup) the filter m

django.core.exceptions.ValidationError: ['“” value must be a decimal number.']

I got this error while migrating here is my models.py file: from django.db import models from django.conf import settings from decimal import Decimal # Create y

ValueError The QuerySet value for an exact lookup must be limited to one result using slicing on django views

am Getting this error i cant figure a way to solve it here are the views.py class SellerTransactionListView(ListView): model = Transaction template_na

Override save method of Django Admin

Well, I want to save any instance of a model without taking care about DDBB structure. So I decide to override def save in every model´s class. Kind of:

Took too long to shut down and was killed

WARNING Application instance <Task pending coro=<__call__() running at /home/developer/projects/tabcon/tabcon_env/lib/python3.5/site-packages/channels/h

How to automatically login a user after registration in django

This is what I am currently using for registration: def register(request): if request.method == 'POST': form = UserCreationForm(request.POST)

How do I install an old version of Django on virtualenv?

I want to install some specific version of a package (in this case Django) inside the virtual environment. I can't figure it out. I'm on Windows XP, and I creat

django: invalid syntax path('details/<int:id>/', views.details, name='details')

views.py file def details(request, id): post = Posts.objects.get(id=id) context = { 'post': post } return render(request, 'posts/details.html', context)