The Inspired
What is createview?
Used to create a new entry of model https://docs.djangoproject.com/en/5.0/ref/class-based-views/generic-editing/#django.views.generic.edit.CreateView
Isaac
I need help but I can't send the picture the page
Charly
I need help but I can't send the picture the page
Code and errors are text, there is no need to send images to describe an issue here
khaled
I am facing a problem but not in my django project I have a certbot container in my ddocker compose file and I amm runnning it using docker-compose run --rm certbot certonly --webroot -w /var/www/certbot/ --force-renewal -d [domain]--email [email] --agree-tos but it keeps refusing to create the ssl secure connection do I have to do anything other than this ? i followed many tutorials but still the same result
khaled
well my django application won't run correctly if this still appear
Isaac
PS C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS> cd flashprime PS C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS\flashprime> python manage.py runserver Traceback (most recent call last): File "C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS\flashprime\manage.py", line 10, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS\flashprime\manage.py", line 21, in <module> main() File "C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS\flashprime\manage.py", line 12, in main raise ImportError( ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? PS C:\Users\COMPUTEX GHANA\OneDrive\Documents\FLASH LMS\flashprime>
Isaac
Whenever I try to start the server this is what I get
Isaac
And I am not even using a virtual envelope
Charly
And I am not even using a virtual envelope
Have you installed Django? Are you using Pycharm?
Isaac
Yes No I use vscode
Charly
Yes No I use vscode
Install Django again in the same terminal
khaled
What does appear?
Creating development_certbot_dev_run ... done Saving debug log to /var/log/letsencrypt/letsencrypt.log Requesting a certificate for doctors.sy and www.doctors.sy Certbot failed to authenticate some domains (authenticator: webroot). The Certificate Authority reported these problems: Domain: www.doctors.sy Type: connection Detail: 37.27.97.58: Fetching http://www.doctors.sy/.well-known/acme-challenge/qRL83mhMNiks_GygAFOTzsdeSMafRhJIV0QB6nbfCO0: Connection refused Domain: doctors.sy Type: connection Detail: 37.27.97.58: Fetching http://doctors.sy/.well-known/acme-challenge/2u5b0V5HcYJwRTJEcFz3NYeSh_1hNgYHptT9GnmHyaw: Connection refused Hint: The Certificate Authority failed to download the temporary challenge files created by Certbot. Ensure that the listed domains serve their content from the provided --webroot-path/-w and that files created there can be downloaded from the internet. Some challenges have failed.
khaled
ok
Isaac
Install Django again in the same terminal
Yeah they keep telling requirements Alresford satisfied
Isaac
What command did you use?
Pip install django
Charly
Pip install django
Do you have multiple python versions installed?
Charly
Yes
So thats the issue, you are not installing it in the right python version
Charly
Charly
python vs python3 command for example
Charly
i dont know what versionns you have or what version you want to use so I can't give you the exact vcommand
Isaac
I have python 3.12.1 and 3.11.3
khaled
Pip install django
try python -m pip install Django
Isaac
try python -m pip install Django
Error The term -m not recognised
Isaac
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'flashprime.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if name == 'main': main()
Isaac
And this is from my mange.py file
Isaac
@Carlangueitor are you there
Charly
Error The term -m not recognised
You have something very broken, ho do you installed python?
Isaac
The normal way
Isaac
You have something very broken, ho do you installed python?
I have use the same python to run flask apps
Charly
The normal way
Then you may wrote a different command that the one written there
Isaac
Then you may wrote a different command that the one written there
But I can also run python3.12 manage.py runserver
Xzz
What's is this x module that project asks to download
Xzz
Code: execute_from_command_line(sys.atgv)
Xzz
Shows no module named x
Isaac
With the same error?
I haven't tried that yet
Charly
Code: execute_from_command_line(sys.atgv)
Is that your code? I doubt it
Auc
Yes u can . But u need to sign up on postman first
There are many of us that uses postman without registering. Including me
Charly
Ортонормированная
class Vendor(model.Model): name = models.CharField( unique=True, max_length=100, help_text='Enter the name of the company (supplier)', db_comment='Name of the company (supplier)' ) class Delivery(models.Model): storage = models.ForeignKey('Storage', on_delete=models.CASCADE, help_text='Connection to the main warehouse') vendor = models.ForeignKey('Vendor', on_delete=models.CASCADE, help_text='Communication with the supplier') delivery_date = models.DateField(help_text='Delivery date') [2024-05-01 08:28:05] [23503] ERROR: update or delete on table "vendors" violates foreign key constraint "deliveries_vendor_id_0fea7d79_fk_vendors_id" on table "deliveries" [2024-05-01 08:28:05] Details: Key (id)=(1) is still referenced from table "deliveries". Deleting an entry from the vendor table What the hell is this? The cascade is worth it
Patil
If Anyone master in django please reply me
Doragonsureiyā
.
Hello everyone, please help me write the correct loop in the template for display. The code and details of the information on the link https://dpaste.org/XSk8E
The Inspired
that or you need to delete the entry that it says... i.e. the table with id=1. as simple as that
Ортонормированная
I'm guessing you didn't run makemigrations and migrate after making your models
yes, you are right because django only cascade when delete using orm, not "clean" sql queries to database 😩
Ортонормированная
I'm guessing you didn't run makemigrations and migrate after making your models
InternalError at /admin/entities/branch/add/ The type of building does not match the expected type: Филиал CONTEXT: PL/pgSQL function check_outlet_type_consistency() line 9 at RAISE How in admin handle triggers exceptions and show to user?
The Inspired
those errors are only for admin side. It wont show to user. for showing error to user, either use a frontend notification library, if you are using a framework like react or vue, or of using vanilla django, use Django's in-built messaging framework system https://docs.djangoproject.com/en/5.0/ref/contrib/messages/
The Inspired
😅 that is error of postgres, not django... you cannot show a database error in a framework... at least, not to my knowledge
Vitaly
😅 that is error of postgres, not django... you cannot show a database error in a framework... at least, not to my knowledge
Psycopg was updated, so u can access pgcode in python exception. By this code u can google what exception was thrown by postgres
Vitaly
e.orig.pgcode
nyctophile
hi guys! i have a question, can i create serializer for a custom action that contains only one field(which is year)? i am trying this way https://hastebin.com/share/lexolavabo.python, but no input is showing up. can you help me with that? my goal is that to return some data according to the year which will be received
Farman
Hey is there any free hosting for django project
Dj - 505
Yes u can . But u need to sign up on postman first
Do you have link to tutorial to learn how do that after sign up ?
Abhi
I am creating a e commerce site where I created mostly the frontend part and I am a little confused about the backend i already created a function when the user clicks on but option it shows in the cart icon can any tell me some steps about backend like what I have to do
Auc
Do you have link to tutorial to learn how do that after sign up ?
You can search on youtube , you will definitely get a tutorial there .
Pablo
Hi guys, please who has worked with the django-quill library before? I am trying to get syntax highlighting to work but it isn’t working. The syntax highlighting gets displayed in the form when I am creating a new blog post, but when I render out the blog post, the syntax highlighting doesn’t work. Please I need help
Pablo
Impossible to help without details. Read this please: http://www.catb.org/~esr/faqs/smart-questions.html
Only those who have worked with Django-quill-editor or quill can help. Note that I have combed through the documentation severally and several stackovwrflow answers I am building a blog. Now in this blog, I am making use of a wysiwyg form called quill. It has a Django library wrapped around it called django-quill-editor. Now when I am filling this form from the admin dashboard, I can clearly see that syntax of whatever code I put in being highlighted. So I fill the form and save it. When I display the contents of the blog in an html file, I see the contents but the syntax isn’t highlighted.