packtpublishing / django-4-by-example Goto Github PK
View Code? Open in Web Editor NEWDjango 4 by example (4th Edition) published by Packt
Home Page: https://djangobyexample.com/
License: MIT License
Django 4 by example (4th Edition) published by Packt
Home Page: https://djangobyexample.com/
License: MIT License
I kept getting this error when trying to access the 'Post' model from the Python shell.
from blog.models import Post
Post.Status.choices
Traceback (most recent call last):
File "", line 1, in
AttributeError: type object 'Post' has no attribute 'Status'
After several failed attempts, I decided to run the 'python manage.py make migrations blog' command on terminal and it worked. I don't understand why the book instructs you to run the 'makemigrations' command afterwards (as shown on page 21).
I'm just a newbie so I don't quite understand what I could have possibly done wrong as I followed the instructions to the dot and double checked everything a million times. Luckily, I tried some other tutorials and they were making migrations to make the model take effect.
I would appreciate any clarifications, thank you ๐
I get this error when I launch the docker container. web-1 is constantly being restarted, the rest is working
2023-06-23 20:20:03 wait-for-it.sh: waiting 15 seconds for db:5432
2023-06-23 20:20:03 wait-for-it.sh: db:5432 is available after 0 seconds
2023-06-23 20:20:03 [uWSGI] getting INI configuration from /code/config/uwsgi/uwsgi.ini
2023-06-23 20:20:03 *** Starting uWSGI 2.0.21 (64bit) on [Fri Jun 23 16:20:03 2023] ***
2023-06-23 20:20:03 compiled with version: 12.2.0 on 20 June 2023 11:42:42
2023-06-23 20:20:03 os: Linux-5.15.49-linuxkit #1 SMP Tue Sep 13 07:51:46 UTC 2022
2023-06-23 20:20:03 nodename: cf0d8a59b5ce
2023-06-23 20:20:03 machine: x86_64
2023-06-23 20:20:03 clock source: unix
2023-06-23 20:20:03 detected number of CPU cores: 2
2023-06-23 20:20:03 current working directory: /code
2023-06-23 20:20:03 detected binary path: /usr/local/bin/uwsgi
2023-06-23 20:20:03 !!! no internal routing support, rebuild with pcre support !!!
2023-06-23 20:20:03 setgid() to 33
2023-06-23 20:20:03 setuid() to 33
2023-06-23 20:20:03 chdir() to /code/educa/
2023-06-23 20:20:03 your memory page size is 4096 bytes
2023-06-23 20:20:03 detected max file descriptor number: 1048576
2023-06-23 20:20:03 lock engine: pthread robust mutexes
2023-06-23 20:20:03 thunder lock: disabled (you can enable it with --thunder-lock)
2023-06-23 20:20:03 bind(): Input/output error [core/socket.c line 230]
this is the first time I'm doing this, I think it's in the last line
I will be grateful for any answers
os: win10
Hi, has anyone experienced this issue and found a fix? "Exception Value: 'set' object has no attribute 'values'".
Any help would be great. Thanks in advance
Error
Request Method: GET
Request URL: http://127.0.0.1:8000/sitemap.xml
Django Version: 4.1.2
Python Version: 3.11.1
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'blog.apps.BlogConfig',
'taggit',
'django.contrib.sites',
'django.contrib.sitemaps']
Traceback (most recent call last):
File "C:\Python\venvs\311_all\Lib\site-packages\django\core\handlers\exception.py", line 55, in inner
response = get_response(request)
File "C:\Python\venvs\311_all\Lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Python\venvs\311_all\Lib\site-packages\django\contrib\sitemaps\views.py", line 34, in inner
response = func(request, *args, **kwargs)
File "C:\Python\venvs\311_all\Lib\site-packages\django\contrib\sitemaps\views.py", line 120, in sitemap
maps = sitemaps.values()
Exception Type: AttributeError at /sitemap.xml
Exception Value: 'set' object has no attribute 'values'
sitemaps.py:
from django.contrib.sitemaps import Sitemap
from .models import Post
class PostSitemap(Sitemap):
changefreq = 'weekly'
priority = 0.9
def items(self):
return Post.published.all()
def lastmod(self, obj):
return obj.updated_at
urls.py (main):
from django.contrib import admin
from django.urls import path, include
from django.contrib.sitemaps.views import sitemap
from blog.sitemaps import PostSitemap
sitemaps = {
'posts', PostSitemap,
}
urlpatterns = [
path('admin/', admin.site.urls),
path('blog/', include('blog.urls', namespace='blog')),
path('sitemap.xml', sitemap, {'sitemaps': sitemaps},
name='django.contrib.sitemaps.views.sitemap')
]
sorry for my english
on chapter 13 when adding eventlistener 'sortupdate' fetch query sends every run on cycle:
sortable('#course-modules', {
forcePlaceholderSize: true,
placeholderClass: 'placeholder'
})[0].addEventListener('sortupdate', function(e) {
modulesOrder = {};
var modules = document.querySelectorAll('#course-modules li');
modules.forEach(function (module, index) {
modulesOrder[module.dataset.id] = index;
module.querySelector('.order').innerHTML = index + 1;
options['body'] = JSON.stringify(modulesOrder);
fetch(moduleOrderUrl, options);
});
});
. it is not right.
Right:
sortable('#course-modules', {
forcePlaceholderSize: true,
placeholderClass: 'placeholder'
})[0].addEventListener('sortupdate', function(e) {
modulesOrder = {};
var modules = document.querySelectorAll('#course-modules li');
modules.forEach(function (module, index) {
modulesOrder[module.dataset.id] = index;
module.querySelector('.order').innerHTML = index + 1;
});
options['body'] = JSON.stringify(modulesOrder);
fetch(moduleOrderUrl, options);
});
fetch query must be send when cycle is finish!
When I try to migrate data after setting up postgresql and running this command:
I run into this error:
django.db.utils.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "blog"
Hello,
I am experiencing an issue where the addition of id=chat to the
that holds the content of the message in room.html is appearing in the header's space. As a result of this the first message is appearing in the header and the top of the scroll bar is above the chat container space and into the header's space as well. I am using windows and across multiple web browsers I am having an issue where changes in my css file whether to the chat class or not are not being reflected on the browser. I was wondering what may be causing this issue?All the best,
Gavin
Hi everyone! I'm getting this kind of response
[500] POST http://localhost:8000/payment/webhook
no matter during the debug session or just when the development server is running. My webhook_view does not run therefore I cannot change the order status to 'paid'.
Does someone know why this happens?
Hi there,
I'm in chapter 17 trying to create the docker image, but when it tries to install the uwsgi image it shows the following error:
#0 17.93 Failed to build uwsgi
#0 17.93 ERROR: Could not build wheels for uwsgi, which is required to install pyproject.toml-based projects
I have tried to install it in the virtual environment as well but i get:
AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?
I did some search which explains that i should run the command via cygwin, but i don't know how it will be possible to run it from docker...
Where is the trick to install it?
Kind regards
Roberto
Request Method: | GET |
---|---|
http://127.0.0.1:8000/account/login/ | |
4.2.1 | |
TemplateSyntaxError | |
Could not parse the remainder: '=="dashboard"' from 'section=="dashboard"' | |
D:\Code\Web\Projects\Social Media App.venv\lib\site-packages\django\template\base.py, line 703, in init | |
django.contrib.auth.views.LoginView |
the whole base.html is giving me errors, ANY UPDATES? when i runserver to accounts/login , it gets stack there even when i go to accounts/logout the page still remains in the login. the errors are only in base.html starting from the {% load static %}
'coupon_id' should be removed from session after checkout is complete.
Steps to replicate
This is not an issue with the repository but Chrome doesn't like to load an unsafe page. I found the answer with this:
chrome://flags/#allow-insecure-localhost
Hello,
I have been noticing an issue in cases where a student tries to enroll in a course with no modules. When this occurs I receive a "list index out of range" error pointing to:
context['module'] = course.modules.all()[0]
I was wondering if there was an elif statement or some other solution to this issue that I missed?
Thank you.
Hello, on page 312 it states that you can add the AJAX paginator that you used in the image_list view to the activity stream. I'm wondering how that is done? Do you create a whole new view in actions in order to allow infinite pagination? Or is there a way to use the existing code to implement the same feature but for the activity stream? Any help would be appreciated!
Working thru the example in the book, on pages 19 and 20, when adding the author, I have run in to errors. Please advise.
My system is windows, Windows 10 64bit. My Python is 3.8.9 My Django is 4.2.4
I followed building the blog example exactly word for word from pages 1 thru 19. Everything is fine. At Page 19 you add the author names to the post.
Bottom of page 19 you add : "from django.contrib.auth.models import User" to models.py and on page 20 you add:
author = models.ForeignKey(User, on_delete=models.CASCADE, related_name= 'blog_posts')
(note: If I hashtag out the second line above the web page works fine. So the second statement, added on page 20 is causing the error. Please advise what is causing this and advise a correction for your book for other readers.
John O'Grady
This (page 20) causes an error / exception as shown below when I load the blog site into my browser:
Hello,
I have been trying to send emails using gmail smtp with celery and rabbitmq. Currently, I am receiving the following error in my celery shell:
[2022-12-03 22:22:57,022: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2022-12-03 22:22:57,040: INFO/MainProcess] mingle: searching for neighbors
[2022-12-03 22:22:57,055: WARNING/MainProcess] No hostname was supplied. Reverting to default 'localhost'
[2022-12-03 22:22:57,419: INFO/SpawnPoolWorker-1] child process 26596 calling self.run()
...
and then down the console:
[2022-12-03 22:23:31,615: INFO/MainProcess] Task orders.tasks.order_created[386624de-daa4-41e2-b3ed-ada61d24af0e] received
[2022-12-03 22:23:32,430: INFO/SpawnPoolWorker-17] child process 5664 calling self.run()
[2022-12-03 22:23:32,431: INFO/SpawnPoolWorker-18] child process 5072 calling self.run()
[2022-12-03 22:23:32,434: INFO/SpawnPoolWorker-20] child process 4692 calling self.run()
[2022-12-03 22:23:32,434: INFO/SpawnPoolWorker-19] child process 3700 calling self.run()
[2022-12-03 22:23:32,436: INFO/SpawnPoolWorker-21] child process 24296 calling self.run()
[2022-12-03 22:23:32,441: INFO/SpawnPoolWorker-22] child process 7460 calling self.run()
[2022-12-03 22:23:32,441: INFO/SpawnPoolWorker-23] child process 16564 calling self.run()
[2022-12-03 22:23:32,444: INFO/SpawnPoolWorker-24] child process 12252 calling self.run()
[2022-12-03 22:23:34,011: INFO/SpawnPoolWorker-25] child process 13780 calling self.run()
But it never reaches success.
I have all of the files the way you have it in the book. However, I'm wondering if I may need some extra specifications for the settings.py file.
For example I currently have:
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
As well as the appropriate gmail app password for EMAIL_HOST_PASSWORD and my email as EMAIL_HOST_USER.
Any help you could provide would be appreciated.
Hi, I encountered this error when I tried to bookmark the images on a website running under HTTPS using Chrome.
My assumption is that the error is caused by using an SSL certificate that a CA does not issue.
I then switched to Firefox and on my first try to bookmark images I got an error that stated that
the script was not loading but further investigation showed me that what prevented the file from loading was the following error MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT, it seems like it's the same cert problem with the Chrome browser.
All the following test was done under https://mysite.com:8000.
chrome version: 112.0.5615.137 (64 bits)
firefox version: 112.0.2 (64 bits)
The code that is used to save automatically to drafts is not yet found and I wish to ask about, this
Specifically is this possible? with special fields or unique fields in a blog Post model
and if yes. does periodic saves of it cause an exception or error ??
The API of Stripe had changing:
So in the payment_process function , i change to:
def payment_process(request):
#......
# add order items to the Stripe checkout session
for item in order.items.all():
session_data['line_items'].append({
'price_data': {
'unit_amount_decimal': int(item.price * Decimal('100')),
'currency': 'usd',
'product_data': {
'name': item.product.name,
},
},
'quantity': item.quantity,
})
# after change this, i can create Stripe checkout session
session = stripe.checkout.Session.create(**session_data)
# But
# link checkout session with order >> my current problem is "session.payment_intent" is None
order.stripe_id = session.payment_intent
order.save()
# Please solve this problem.
I'm trying to add custom Manager to the Post model and getting the next traceback:
\Traceback (most recent call last):
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/options.py", line 654, in get_field
return self._forward_fields_map[field_name]
KeyError: 'published'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/alex/Code/django_4_by_example/blog/mysite/manage.py", line 22, in <module>
main()
File "/home/alex/Code/django_4_by_example/blog/mysite/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/core/management/__init__.py", line 420, in execute
django.setup()
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/alex/Code/django_4_by_example/blog/mysite/blog/models.py", line 12, in <module>
class Post(models.Model):
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/base.py", line 363, in __new__
new_class._prepare()
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/base.py", line 424, in _prepare
index.set_name_with_model(cls)
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/indexes.py", line 165, in set_name_with_model
column_names = [
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/indexes.py", line 166, in <listcomp>
model._meta.get_field(field_name).column
File "/home/alex/Code/django_4_by_example/blog/env/lib/python3.10/site-packages/django/db/models/options.py", line 659, in get_field
raise FieldDoesNotExist(
django.core.exceptions.FieldDoesNotExist: Post has no field named 'published'. The app cache isn't ready yet, so if this is an auto-created related field, it won't be available yet.
This is my models.py file:
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
class PublishedManager(models.Manager):
def get_queryset(self):
return super().get_queryset()\
.filter(status=Post.Status.PUBLISHED)
class Post(models.Model):
class Status(models.TextChoices):
DRAFT = 'DF', 'Draft'
PUBLISHED = 'PB', 'Published'
title = models.CharField(max_length=250)
slug = models.SlugField(max_length=250)
body = models.TextField()
published = models.DateTimeField(default=timezone.now)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
status = models.CharField(max_length=2,
choices=Status.choices,
default=Status.DRAFT)
author = models.ForeignKey(User,
on_delete=models.CASCADE,
related_name="blog_posts")
objects = models.Manager()
published = PublishedManager()
class Meta:
ordering = ['-published']
indexes = [
models.Index(fields=['-published']),
]
def __str__(self):
return self.title
pip freeze
asgiref==3.5.2
autopep8==2.0.0
Django==4.1.3
pycodestyle==2.9.1
sqlparse==0.4.3
tomli==2.0.1
I've changed the status of one of my posts to 'published' in admin interface, so I have no idea why it is not working. The code is exactly as in the book.
Just wondering how the code is formatted. It's definitely not Black.
hi
Where is password of admin panel
the user is is [email protected]
Unable to apply django-parler magrations.
My code looks exactly as in the book. RabbitMQ is running, Celery as well but when I'm trying to complete my order Celery's CLI
throws a bunch of errors:
[2023-02-26 12:50:39,243: INFO/MainProcess] [email protected] ready.
[2023-02-26 12:52:13,824: INFO/MainProcess] Task orders.tasks.order_created[fff989e3-98e6-4ac3-adbc-9c791eea31d2] received
[2023-02-26 12:52:14,020: WARNING/ForkPoolWorker-8] --- Logging error ---
[2023-02-26 12:52:14,023: WARNING/ForkPoolWorker-8] Traceback (most recent call last):
[2023-02-26 12:52:14,024: WARNING/ForkPoolWorker-8] File "/Users/el/Documents/Code/django_by_example/shop/env/shop/lib/python3.11/site-packages/celery/app/trace.py", line 451, in trace_task
R = retval = fun(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
...
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 851, in create_connection\n raise exceptions[0]\n File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 836, in create_connection\n sock.connect(sa)\nConnectionRefusedError: [Errno 61] Connection refused\n', 'args': '[9]', 'kwargs': '{}', 'description': 'raised unexpected', 'internal': False}
My system is MacOS Ventura 13.2.1 maybe it is related somehow. Did someone faced such problem? Any help is really appreciated.
Server (Docker) is not responding requests and don't show any kind of messages.
My project directory is call 'project' instead 'educa'.
Attached DockeFile , docker-compose.yml and settings files... and a screenshot
Could you give me some help?
Thank you !!!
It seems that using 127.0.0.1 mysite.com
in hosts file isn't good idea, because mysite.com is real site.
In my opinion better use something ugly, but understandable for the developer, for example, <your_computer_name>.com
.
In any case, it is recommended to check the potential address before using it in hosts file.
Hi,
I cannot print the translated invoice that is sent by email in the payment process.
It always comes out with the source language.
Template process.html is fully adapted.
Does anyone else have this problem?
Maybe Celery needs some parameters about the language active... I don't know.
I would appreciate some help,
Thank you.
In templates/base.html
, the use of an <a>
hypertext element when calling authviews.LogoutView
is causing an http 405 error because a GET request to LogoutView
is being sent. LogoutView
expects POST.
Why did you guys use the hypertext link to activate LogoutView?
from django.core.mail import send_mail
send_mail('Django mail', 'This e-mail was sent with Django', '[email protected]', ['[email protected]'],fail_silently=False)
Traceback (most recent call last):
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 398, in getreply
line = self.file.readline(_MAXLINE + 1)
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\socket.py", line 705, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Eddie\blogEnv\lib\site-packages\django\core\mail_init_.py", line 87, in send_mail
return mail.send()
File "C:\Users\Eddie\blogEnv\lib\site-packages\django\core\mail\message.py", line 298, in send
return self.get_connection(fail_silently).send_messages([self])
File "C:\Users\Eddie\blogEnv\lib\site-packages\django\core\mail\backends\smtp.py", line 124, in send_messages
new_conn_created = self.open()
File "C:\Users\Eddie\blogEnv\lib\site-packages\django\core\mail\backends\smtp.py", line 87, in open
self.connection.starttls(
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 769, in starttls
self.ehlo_or_helo_if_needed()
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 611, in ehlo_or_helo_if_needed
if not (200 <= self.ehlo()[0] <= 299):
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 452, in ehlo
(code, msg) = self.getreply()
File "C:\Users\Eddie\AppData\Local\Programs\Python\Python310\lib\smtplib.py", line 401, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed: "
smtplib.SMTPServerDisconnected: Connection unexpectedly closed: [WinError 10054] An existing connection was forcibly closed by the remote host
options['body'] = JSON.stringify(modulesOrder); on line 96
fetch(moduleOrderUrl, options) on line 99
options['body'] = JSON.stringify(contentOrder); on line 116
fetch(contentOrderUrl, options) on line 119
must be outside of cycle
When I try to migrate data after setting up postgresql and running this command:
I run into this error:
django.db.utils.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "blog"
when running this command
docker run -it --rm --name rabbitmq -P 5672:5672 -P 15672:15672 rabbitmq:management
I have this error
Unable to find image '5672:5672' locally
docker: Error response from daemon: pull access denied for 5672, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
It can't respond httpResponse, it shows None instead.
In chapter 17 I'm getting the following error related to daphne:
CRITICAL Listen failure: Couldn't listen on any:b'/code/educa/daphne.sock': Cannot acquire lock.
I tried stoping the docker-compose deleting the daphne.sock and restarting docker-compose and get the same error. A daphne.sock.lock file is also created, which is actually link to: daphne.sock.lock --> 1. I remove that as well before starting docker-compose again.
Jim
Hi @zenx , I'm trying to use the bookmarklet bookmark in firefox on amazon to get pictures, but the container does not even load. When I checked the console for issues, it said that the bookmarkLaunch() function is not working. This is maybe because the two js files are not 'connected' well, but I do not know how to solve that. I already tried changing the urls to include 'https://" instead of just '//127...' but that did not work. What should I do?
helIo, I want to change the labels of the login form, but this does not happen. When running, these labels show their default state, "login" and "password". This is in the bookmarks example in the login form. thanks for your guide.
from django import forms
from django.contrib.auth.models import User
from .models import Profile
class LoginForm(forms.Form):
username = forms.CharField(label='Enter username')
password = forms.CharField(widget=forms.PasswordInput, label='Enter your pass')
Hi there, wanting to get some help with this issue.
I am trying to migrate to postgres but am encountering this exception when I migrate
File "D:\Documents\workspaces\vscode_workspace\projects\my_env\Lib\site-packages\django\db\backends\postgresql\base.py", line 28, in <module> raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: DLL load failed while importing _psycopg: The specified module could not be found.
i looked at some of the previous issues and tried to see if their solutions could help me.
this is in my settings.py
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'blog', 'USER': 'blog', 'PASSWORD': '', 'HOST': 'localhost', 'PORT': 5432 } }
I have also tried running "pip install postgres" to try and see if there was something else i was missing but no success there either.
I'm goint through the book through the O'Reilly site.
It comes with the follwoing line to add to settings.py
ASGI_APPLICATION = 'educa.routing.application'
But the code on this repository has got:
ASGI_APPLICATION = 'educa.asgi.application'
which works.
Hello
I am new to web dev, and I have been following this book and I am learning a lot from it . But for the past few days I have been stuck trying to get my like button to like the image post and it hasn't been working I have done everything I can think of but still no luck please what should I do?
Hi,
While trying run 'docker compose up' show this error ...
2022-12-30 12:35:06 wait-for-it.sh: waiting 15 seconds for db:5432
2022-12-30 12:35:06 wait-for-it.sh: db:5432 is available after 0 seconds
2022-12-30 12:35:06 [uWSGI] getting INI configuration from /code/config/uwsgi/uwsgi.ini
2022-12-30 12:35:06 *** Starting uWSGI 2.0.20 (64bit) on [Fri Dec 30 11:35:06 2022] ***
2022-12-30 12:35:06 compiled with version: 10.2.1 20210110 on 30 December 2022 11:20:44
2022-12-30 12:35:06 os: Linux-5.15.49-linuxkit #1 SMP Tue Sep 13 07:51:46 UTC 2022
2022-12-30 12:35:06 nodename: e4b72c90bfb7
2022-12-30 12:35:06 machine: x86_64
2022-12-30 12:35:06 clock source: unix
2022-12-30 12:35:06 pcre jit disabled
2022-12-30 12:35:06 detected number of CPU cores: 10
2022-12-30 12:35:06 current working directory: /code
2022-12-30 12:35:06 detected binary path: /usr/local/bin/uwsgi
2022-12-30 12:35:06 setgid() to 33
2022-12-30 12:35:06 setuid() to 33
2022-12-30 12:35:06 chdir() to /code/project/
2022-12-30 12:35:06 your memory page size is 4096 bytes
2022-12-30 12:35:06 detected max file descriptor number: 1048576
2022-12-30 12:35:06 lock engine: pthread robust mutexes
2022-12-30 12:35:06 thunder lock: disabled (you can enable it with --thunder-lock)
2022-12-30 12:35:06 bind(): Permission denied [core/socket.c line 230]
The OS is Ubuntu 22.04 LTS
Do not hesitate to ask for all the information you think you need...
Could you give me some help?
Thank you !!!
Do you know why django's templates display prices and amounts starting with a dollar sign ?
like ... $ 12.096,00
Do you know how avoid this behaviour ?
Do you know how display the sign of base_currency ?
Thank you ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.