Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
How do I illiterate in Django template
''' {% for j in listOfStoresUsed %} <div class="col-sm-8" style="display: none; margin-left: 6em;" id = "store-{{j}}"> {% for i in itemsOrganizedByStore %} <img width="200em" height="200em" src={{i.item.imgURL}}> <p>{{i.item.name}} Q:{{i.quantity}}</p><br> {% endfor %} {% endfor %} ''' itemsOrganizedByStore is a list, and I want to do for i in itemsOrganizedByStore[x] x being an index that would be declared in a for loop above. How can I use a number for x in Django -
Django filter with replace
Let's say I have the following model which have a method variants(): class Example(models.Model): text = models.CharField(max_length=255) def variants(self): return Example.objects.filter(text=remove('xy', self.text)) The idea is to get all objects where texts are the same after certain characters are removed from the text. For example, if self.text is 'axxyy', it should match with the object which have text 'a'. Function remove() doesn't touch to the database, it returns a new string which have given characters removed. This works fine. However, I have a need to perform the same operation on both sides of the comparison, so that variants() would behave like following: def variants(self): return Example.objects.filter(remove('xy', text)=remove('xy', self.text)) In that case, if self.txt is 'axxyy' it should match with 'a', 'ax, 'axx', 'xayy', etc. but shouldn't match with 'aa' for example, since 'a' != 'aa' after removals. Once again, I don't want to remove 'xy' from the database, only for the comparison. I could do this with Python, but I'm wondering if there is a way to do this on database level? I've been reading docs about Func() expressions, for example Replace, but haven't found a solution yet. -
Django Error "django.db.utils.ProgrammingError: subquery has too many columns "
The raw query itself is correct and I am able to get retrieve the rawqueryset from the db. I need to convert this into queryset for further processing and I am facing below error. Creating corresponding django query was hard for me and that is why I created SQL query, got the raw query set and now attempting to convert it to query set for further processing. I have changed django model names and table names for anonymity. Here is the output of what I tried in django shell. I was able to execute the below query but getting the error "django.db.utils.ProgrammingError: subquery has too many columns" when I try to access "queryset" below. from django.db.models.expressions import RawSQL from xyz.models import * value = '1.2.3.4' queryset = Test1.objects.filter(id__in=RawSQL("SELECT DISTINCT ON (test1.start_time, test1.id) test1.id, test1.name, test1.start_time FROM test1 WHERE EXISTS (SELECT * FROM test2 JOIN test3 ON test2.test3_id = test3.id AND test3.value = %s JOIN test4 ON test2.test4_id = test4.id AND test4.test1_id = test1.id) ORDER BY test1.start_time DESC", params=[value])) For readability I have formatted the query used below. SELECT DISTINCT ON (test1.start_time, test1.id) test1.id, test1.name, test1.start_time FROM test1 WHERE EXISTS ( SELECT * FROM test2 JOIN test3 ON test2.test3_id = test3.id … -
ModuleNotFoundError: No module named 'admin_interface
I'm making a project in my school and works well in the school pc, but today when I'm pass the project to my pc and type: python manage.py runservice This appears: (venv) PS C:\> cd MiColegio (venv) PS C:\MiColegio> python manage.py runservice Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line utility.execute() File "C:\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute django.setup() File "C:\venv\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\venv\lib\site-packages\django\apps\registry.py", line 91, in populate app_config = AppConfig.create(entry) File "C:\venv\lib\site-packages\django\apps\config.py", line 224, in create import_module(entry) File "C:\Users\DANIEL\AppData\Local\Programs\Python\Python38\lib\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 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'admin_interface' (venv) PS C:\MiColegio> -
Django Channels App Websocket Connection Failing
I believe I have a similar issue to the one found here and here. The gist is that I'm running a Django app with channels on an Amazon-ec2 instance and the websockets are failing to connect. Most of my code regarding the websockets comes from the django-channels tutorial here. Traffic is being directed though secured dns name behind an application load balancer. I'm running this entirely on Daphne (handling both https and websocket traffic) with pretty minimal configurations: daphne -b <server_url> -p <port> test_app.asgi:application I'm also authenticating with openID-connect using the mozilla-django-oidc module. However for the websocket test I'm not expecting authentication. I feel it's worth pointing out if the issue is related to websocket authentication in any way. In development I'm running a local redis cluster as my channel layer. My dev app (all http:// and ws://) has no issues connecting to websockets. The chat app works as expected. I can connect to my websockets and is confirmed with a 127.0.0.1:60779 - - [07/Apr/2021:12:06:05] "WSCONNECTING /ws/chat/lobby/" In production I'm using an elasticache redis cluster as my channel layer. I can test this in the django shell and it connects/sends/receives. However in the production chat I am unable to reach … -
Tracking date/time of page hits on a Wagtail site
Is there a best practice for tracking page hits in Wagtail (or Django)? I've seen some installable Django modules that track a simple hit count per page, but what I'm looking for is something more like a log of individual hits with the date/time and page URL for each (and possibly other information such as the user's IP address). I could probably build this myself and customize it to meet my app's needs; I'm just unsure of how to set up the model for the hit records in a way that Wagtail doesn't register it as a "page" and make all those individual records editable in the admin, which would be a nightmare. I figure once it's set up, I can build some custom admin logic to generate reports by querying from the database; it's just matter of setting up the data structure properly in the first place. -
url issues with django
I can't get my urls to work for django no matter what I try from django.contrib import admin from django.urls import include, re_path from django.conf.urls import url from catalog import views urlpatterns = [ re_path(r'^admin/', admin.site.urls), re_path(r'^fruit/?$', views.fruit_catalogue, name='fruit_catalogue'), re_path(r'^fruit/?$', views.fruit_details), re_path(r'^fruit/(?P<fruit_id>[1-7]{1})/?$', views.fruit_details), ] -
Grouping and counting Item in my database
I am creating an app that keeps track of stock data. How can I write a query to group any items stored in a column? (ie the name column). Also, I would like to count the grouped items. Any help would be appreciated. class Stock (models.Model): category = models.ForeignKey(Category, on_delete=models.CASCADE) name = models.CharField(max_length= 100) quantity = models.IntegerField(defualt=0) price = models.IntegerField(default = 0) -
Extending with plugins remotely -at least from a frontend
Hi guys I have a question just one, but it houses a series of smaller questions for clarity. So I'm building a django app that creates virtual organizations, I'm planning on hosting with digitalocean for reasons. My app just creates a droplet and host a site ( already done that) Now I want my users ( mainly people with zero coding knowledge or ability) to be able to install plugins to their django site using the frontend. How do I get this working without users tampering with the settings.py file is it possible? what packages would I need? how would I setup the installation process? an example would be how shopify handles its plugins and installation from the frontend remotely - if shopify were built on django. Cheers! -
Django admin: custom action template, button to redirect to another admin action
I have a custom action on one of my admin models which renders a view, the 'check' action. This view has two buttons that should call two different actions: 'Approve' and 'Reject'. How do I register these two actions 'Reject' and 'Approve' to be able to redirect from the view to it? When trying to render the html I get the following error: django.urls.exceptions.NoReverseMatch: Reverse for 'reject' not found. 'reject' is not a valid view function or pattern name. template.html <div class="flex" style="justify-content: center"> <button> <a href="{% url 'reject' %}">Reject</a> </button> <button> <a href="{% url 'approve' %}">Approve</a> </button> </div> admin.py @admin.register(Model) class Model(admin.ModelAdmin): def get_urls(self): urls = super().get_urls() my_urls = [ url(r'^(?P<user_id>.+)/check/$', self.admin_site.admin_view(self.check), name='check'), url(r'^(?P<user_id>.+)/approve/$', self.admin_site.admin_view(self.approve), name='approve'), url(r'^(?P<user_id>.+)/reject/$', self.admin_site.admin_view(self.reject), name='reject'), ] return my_urls + urls -
How to Access Data Within Django ManytoMany with SQL Query
I have two models in a Django site as follows, one of which is a many to many relationship: class Seller(models.Model): account = models.ForeignKey(Account, related_name='sellers',null=True, on_delete=models.SET_NULL) bio = models.TextField(null=True, blank=True) city = models.CharField(max_length=50, null=True, blank=True) and class Account(models.Model): username = models.CharField(max_length=50, blank=True, null=True, unique=True) password = models.CharField(max_length=64) name = models.CharField(max_length=50, blank=True, null=True) I am trying to run an SQL query on my Postgresql database, but I cannot find a clear way to to write an SQL query to access information within the many to many relationship. I have the seller ID, and I want to get the username within Account. If I try the following, which clearly is not correct, it won't work but I'm stumped as what to do next: SELECT seller_seller.bio, seller_seller.account.id FROM seller_seller, admin_account WHERE ...no clue! Can someone point me in the right direction? Thank you! -
How to serialize a list of data in ManyToMany relantionship in Django RESTful API and properly create nested objects?
i think is a silly question but for few days I cann't hadle with it... I've go a a two models: Book and Authors. Book can have many Authors, and Authors can have many Book(s). I;m POST-ing a new Book, and i'm passing a "title" and a list of Authors (i'm passing a list of dictionaries like in example below). I want to create new Authors from this list but wihout overwriting old ones. models.py: class Authors(models.Model): name = models.CharField(max_length=50, blank=True) class Book(models.Model): title = models.CharField(max_length=60, blank=False, null=False) authors = models.ManyToManyField(Authors) serielizers.py: class AuthorsSerializer(serializers.ModelSerializer): class Meta: model = Authors fields = '__all__' class BookSerializer(serializers.ModelSerializer): authors = AuthorsSerializer(many=True) class Meta: model = Book fields = ['id', 'title', 'authors'] depth = 1 def create(self, validated_data): authors_data = validated_data.pop('authors') book = Book.objects.create(**validated_data) for autor in authors_data: Authors.objects.create(book=book, **autor) return book views.py: class BooksList(viewsets.ModelViewSet): queryset = Book.objects.all() serializer_class = BookSerializer urls.py: book_list = BooksList.as_view({ 'get': 'list', 'post': 'create', }) book_detail = BookDetails.as_view({ 'get': 'retrieve', 'put': 'update', 'patch': 'partial_update', 'delete': 'destroy'}) authors_list = AuthorsList.as_view({ 'get': 'list', 'post': 'create'}) urlpatterns = format_suffix_patterns([ path('books/', book_list, name='book_list'), path('books/<int:pk>', book_detail, name='book_detail'), path('authors/', authors_list, name='authors_list'), ]) When I'm POST-ing a new object in webrowser in RESTful API like this: { … -
I got an error in my project when I want start django
I'm making a project in my school and works well in the school pc, but today when I'm pass the project to my pc and type: python manage.py runservice This appears: (venv) PS C:\> cd MiColegio (venv) PS C:\MiColegio> python manage.py runservice Traceback (most recent call last): File "manage.py", line 22, in <module> main() File "manage.py", line 18, in main execute_from_command_line(sys.argv) File "C:\venv\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line utility.execute() File "C:\venv\lib\site-packages\django\core\management\__init__.py", line 395, in execute django.setup() File "C:\venv\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\venv\lib\site-packages\django\apps\registry.py", line 91, in populate app_config = AppConfig.create(entry) File "C:\venv\lib\site-packages\django\apps\config.py", line 224, in create import_module(entry) File "C:\Users\DANIEL\AppData\Local\Programs\Python\Python38\lib\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 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'admin_interface' (venv) PS C:\MiColegio> Any Idea? -
Saving to values to model that extends the user model when creating a new record
I have a model that extends the default Django User model. It is intended to store user information pulled from an API, particularly the UUID associated with the user. This is the model: # Django dependencies from django.contrib.auth.models import User from django.db import models class Oid(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) oid = models.UUIDField() class Meta: db_table = 'auth_user_oid' constraints = [ models.UniqueConstraint(fields=['oid'], name='unique_oid') ] This is where to record is being created: # serializers.py email = user_validations['graph_response']['mail'].lower() first_name = user_validations['graph_response']['givenName'] last_name = user_validations['graph_response']['surname'] oid = user_validations['graph_response']['id'] obj, created = models.User.objects.get_or_create( username = email, first_name = first_name, last_name = last_name, email = email, is_staff = True, oid = oid ) The oid = oid is just one of a number of different things I've tried. This iteration in particular just says: ValueError: Field 'id' expected a number but got 'UUID'. I'm just wondering: how an I'm supposed to be saving records to the extended model when a new User record is being created? -
Filtering Datetime field by date not working in Django
I'm trying to filter a Datetime model field by date only and have tried: Content.objects.filter(created_at__date=params.get("event_date")) The event_date parameter is formed like 2021-04-07. I've tried creating a datetime object and have also tried this: search_params["created_at__lte"] = datetime.datetime(int(date[0]), int(date[1]), int(date[2]), 0, 0, 0) search_params["created_at__gte"] = datetime.datetime(int(date[0]), int(date[1])+1, int(date[2]), 0, 0, 0) However, all of these methods return an empty query set and they should return one result. The result has a Datetime field (2021-04-07 23:00). -
how can i get always data based on the logged user?
I'm Working with Django / Rest Framework and I have multiple applications and I would like to avoid repeaters in my situation, I would like to get the logged user data without repeating this line each time : queryset = queryset.filter(user = self.request.user) -
How to convert raw queryset to queryset?
The raw query itself is correct and I am able to get retrieve the raw query set from the db. I need to convert this into query set for further processing and I am facing below error. Creating corresponding django query was hard for me and that is why I created SQL query, got the raw query set and now attempting to convert it to query set for further processing. I have changed django model names and table names for anonymity. Here is the output of what I tried in django shell. The "test3.value" will be dynamically set and I am doing that in the raw query statement. from django.db.models.expressions import RawSQL from xyz.models import * value = '1.2.3.4' queryset = Test1.objects.filter(id__in=RawSQL("SELECT DISTINCT ON (test1.start_time, test1.id) test1.id, test1.name, test1.start_time FROM test1 WHERE EXISTS (SELECT * FROM test2 JOIN test3 ON test2.test3_id = test3.id AND test3.value = {} JOIN test4 ON test2.test4_id = test4.id AND test4.test1_id = test1.id) ORDER BY test1.start_time DESC".format(value))) Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: __init__() missing 1 required positional argument: 'params' For readability I have formatted the raw sql query used above. SELECT DISTINCT ON (test1.start_time, test1.id) test1.id, test1.name, test1.start_time FROM … -
request.POST.get(variable) returns None when trying to receive by id
Ok so, help me out here I'm going crazy! I have 4 questions each with a radio button name set to the question id and the value set to the answer id to get the answer's id and use it to get the user's submitted answer to check if it is correct or not. views.py def sampleQuestions(request): if request.method == 'POST': user = request.user userInformation = UserInformation.objects.get(user=user) allAnswers = Answers.objects.all() allQuestions = Questions.objects.all() i = 0 for q in Questions.objects.all(): print(q.id) #returns 1 answerID = request.POST.get(q.id) #returns None print(answerID) answer = Answers.objects.get(id=answerID) print(answer) template.html {% for q in questions %} <table> <tr> <td> {{q.question}}</td> </tr> {% for a in answers %} {% if a.answerForQuestion == q%} <tr> <td> <input type="radio" name = "{{q.id}}" value="{{a.id}}"> {{a.answer}}</td> {{q.id}} </tr> {% endif %} {% endfor %} </fieldset> </table> {% endfor %} -
django ckeditor codesnippet is not responsive
I am using the Django-CKEditor and the problem that I have is that the code area (codesnippet plugin) is not responsive and some of the code gets out of the highlighted area as I make the page smaller. Also, I am using bootstrap in my project too. It's okay on larger screens: But as I make the size smaller The problem happens: I have done the following configuration in my settings.py and on the HTML page: INSTALLED_APPS = [ # other apps 'ckeditor', 'ckeditor_uploader', ] # ckeditor CKEDITOR_UPLOAD_PATH = "ckeditor_uploads/" CKEDITOR_CONFIGS = { 'default': { 'toolbar': 'full', # 'height': 300, # 'width': 960, 'width': 'auto', 'height': '600', 'extraPlugins': ','.join([ 'codesnippet', 'div', 'autolink', 'autoembed', 'embedsemantic', 'autogrow', 'widget', 'lineutils', 'clipboard', 'dialog', 'dialogui', 'elementspath', 'mathjax', ]), }, } {% load static %} <script type="text/javascript" src="{% static 'ckeditor/ckeditor-init.js' %}"></script> <script type="text/javascript" src="{% static 'ckeditor/ckeditor/ckeditor.js' %}"></script> <link rel="stylesheet" href="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/styles/default.css' %}"/> <script src="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js' %}"></script> <script>hljs.initHighlightingOnLoad();</script> And also I have collected the static files: Thank you for anything you can do to help. -
Using Bitcash Function on Django Queryset
I am using the Bitcash library and attempting to call the balance function on a private key. The problem is that I am storing the private key as a SlugField and retrieving it as a Queryset. How can I store is as a type of the Bitcash class PrivateKey? storing priv_key = models.SlugField(max_length=200, null=True) retrieving priv_key = KeyStore.objects.values('priv_key') how I want to use it bal = priv_key.balance the error message 'QuerySet' object has no attribute 'balance' the bitcash type that I would like to store <class 'bitcash.wallet.PrivateKey'> -
Restart django on linux
Ive deployed a django app on linux using nginx, supervisor and gunicorn. I have made updates (using GIT and manually in settings.py). The files changed but the application has not changed (i.e. it still functions the same as before the changes were added). I've tried lots of commands but none of them work e.g. //reload/restart nginx sudo service nginx restart sudo systemctl reload nginx sudo systemctl restart nginx //reload supervisor sudo supervisorctl reload //restart gunicorn (supervisor) sudo supervisorctl restart gunicorn //reboot ubuntu using systemctl sudo systemctl reboot //reboot ubuntu sudo reboot now //force reboot ubuntu sudo reboot -f Any help is greatly appreciated. -
How to force_authenticate in Django Rest Framework tests
I have problem with testing API built in DRF tutorial: https://www.django-rest-framework.org/tutorial/1-serialization/ I have view: class SnippetList(generics.ListCreateAPIView): permission_classes = [permissions.IsAuthenticatedOrReadOnly] queryset = Snippet.objects.all() serializer_class = SnippetSerializer def perform_create(self, serializer): serializer.save(owner=self.request.user) And test class for testing that view: class SnippetsList(APITestCase): def setUp(self): self.user = User.objects.create_superuser(username='testowy', password='test') self.client = APIClient() Snippet.objects.create(code="print('hello')", owner=self.user) Snippet.objects.create(code="print('world')", owner=self.user) self.payload = { "code": "print(edit)" } def test_get_snippets_list(self): response = self.client.get(reverse('snippet_list')) snippets = Snippet.objects.all() serializer = SnippetSerializer(snippets, many=True) self.assertEqual(response.data, serializer.data) self.assertEqual(response.status_code, status.HTTP_200_OK) def test_post_snippets_list(self): self.client.force_authenticate(self.user) response = self.client.post(reverse('snippet_list'), json.dumps(self.payload), format='json') self.assertEqual(response.status_code, status.HTTP_201_CREATED) When I run my tests with python manage.py test first test (for get method) is passing but for the second I get this output: self.assertEqual(response.status_code, status.HTTP_201_CREATED) AssertionError: 400 != 201 In manual tests after login in everything works perfectly, does anyone knows what am I missing here? -
Django - hide button if condition is true
Please help me solve a question! I'm using Django. I have a page where I listed all the questionnaires I made. Every questionnaires has a button next to it that links to a questionnaire on my main site. I like to make every questionnaires to can be filled just one time to every authenticated user but I can't figure out what is the best way to do this. Now I think that I create a hidden field into every questionnaires with a TRUE value and when the user clicks the submit button it stores in the db with the other answers. I query and retrieve the value and grab it with Javascript. If the value is TRUE it hides the button on the main site so it can't be clickable. Is this solutions good or it can be made easier? -
creating a profile for a user in django failed
I'm trying to create a profile for a user in django using signals when the user profile is created I need to create a profile automatically. from django.db import models from django.contrib.auth.models import User # Create your models here. class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) picture = models.ImageField(default='default.png',upload_to='profile_pics') bio = models.CharField(max_length=200,blank=True) def __str__(self): return self.user.username this is in the signals.py file: from django.db.models.signals import post_save from django.contrib.auth.models import User from django.dispatch import receiver from .models import Profile @receiver(post_save, sender=User) def create_profile(sender,instance,created,**kwargs): if created: Profile.objects.create(user=instance) @receiver(post_save, sender=User) def create_profile(sender,instance,created,**kwargs): instance.profile.save() and here is the register view: def registerUserView(request): """ this is for registring a new user""" if request.method == "POST": form = UserRegisterForm(request.POST) if form.is_valid(): form.save() username = form.cleaned_data.get('username') messages.success(request,f'your account has been created successfully! you are able to login') return redirect("login") else: form = UserRegisterForm() return render(request,"users/register.html",{"form":form}) now I don't know the error that has been occured this time. django version 2.2 and python 3.8. -
How come Apache2 isn't recognizing the Django module installed to a virtual environment?
I'm using Ubuntu 18.04, and have libapache2-mod-wsgi-py3 and apache2 installed. I have a Django project located at /home/usr/django_project/ and I created a python 3.8 virtual environment inside the django_project folder. I used pip3 install -r requirments.txt inside the virtual environment to install all the necessary dependencies. My settings.py is as follows: import os import json with open('/etc/django_personal_website-config.json') as config_file: config = json.load(config_file) # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = config['SECRET_KEY'] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'blog.apps.BlogConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', '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 = 'django_personal_website.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [TEMPLATE_DIR] , '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', ], }, }, ] WSGI_APPLICATION = 'django_personal_website.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ …