Abdulloh
Hi everyone I am connecting django to postgresql but don't know what to write in settings.py: DATABASES = { ‘default’: { ‘ENGINE’: ‘django.db.backends.postgresql_psycopg2’, ‘NAME’: ‘yourproject’, < ———- ‘USER’: ‘yourprojectuser’, < ———- ‘PASSWORD’: ‘password’, ‘HOST’: ‘localhost’, ‘PORT’: ‘’, } } # shown with < ——
Abdulloh
they are same thing I think
Abdulloh
I got username from property of postgresql 13 in pgAdmin in browser username: postgres
Abdulloh
Official docs ? Anyway name -> db name , user -> db user etc etc
Are you telling: "yourproject" is "db_name" ?
Mirco
Are you telling: "yourproject" is "db_name" ?
First create a database with Postgres Than you can set all the info into Django settings
Abdulloh
I created
Mirco
I created
Nice so the database name goes into NAME property
Abdulloh
ok
Mirco
USER is the user that is able to access your database PASSWORD the user's pwd
Abdulloh
Just type the problem !
Aram
i have a problem any one can help me? " backend = load_backend(db['ENGINE']) File "C:\Users\Saba\AppData\Local\Programs\Python\Python38\lib\site-packages\django\db\utils.py", line 122, in load_backend raise ImproperlyConfigured( django.core.exceptions.ImproperlyConfigured: 'django.db.backends.postgresql' isn't an available database backend. Try using 'django.db.backends.XXX', where XXX is one of: 'mysql', 'oracle', 'sqlite3'"
Abdulloh
Thank you very much @pyflare
Doragonsureiyā
Thank you very much @pyflare
You're welcome! 😊
Abdulloh
it doesn't work
did you install psycopg2
Mirco
it doesn't work
it's not an answer, give the error or more details
Leonardo
https://docs.djangoproject.com/en/3.1/ref/models/fields/#django.db.models.fields.files.FieldFile
hummm, i've missed it! so I have to write the file and open as a File(), I'll try it, thanks a lot
Anurag
$ scp -r $(pwd)/{app,nginx,.env.staging,.env.staging.db,.env.staging.proxy-companion,docker-compose.staging.yml} user@your-ip-or-domain:/path/to/django-on-docker This command should be run in my local computer or remote ec2 instance
Abdulloh
I have table in my connected postgresql but don't know how to use it is there any documentation for this ?
Mirco
I have table in my connected postgresql but don't know how to use it is there any documentation for this ?
did u create the model in Django ? or you wanna make a model from the existing table ?
Abdulloh
from existing table
Mirco
from existing table
there is the official Django doc that explains it to u
Abdulloh
any tutorial?
Mirco
learn how to read documentation
Mirco
any tutorial?
https://docs.djangoproject.com/en/3.1/ref/django-admin/#inspectdb
Sadra
i have problem with these commands : su postgres createuser -dP blog
hold on..! Postgres has its own default username. user: postgresql pass: postgresql Are u running the postgresql as a docker container? If so, you can disable the authentication part by creating an environment variable in your docker-compose file as follow. POSTGRES_HOST_AUTH_METHOD=trust
Sadra
Google for how you can authenticate in postgresql. You'll find a ton of results.
Mirco
complex to me
if u cannot read you cannot start a journey with Django documentation has all info u always need
Abdulloh
ok thanks
Abdulloh
I will try
Sadra
I have table in my connected postgresql but don't know how to use it is there any documentation for this ?
If there is no model, you need to first, serialize the data and then, use it.
Sadra
https://django-star-ratings.readthedocs.io/en/latest/?badge=latest/
Sadra
clean it up dude. really confusing. rated -1! separate the codes and the errors you get. explain more about what you wanna do.
Igor
Hello! I need to copy information from one database and roll it into another, but I have an error. What I did: python3 manage.py dumpdata> out.json python3 manage.py loaddata out.json Error: django.core.serializers.base.DeserializationError: Problem installing fixture '/home/igor/prom/projects/django/nginx_unit/mysite/out.json': Invalid model identifier: 'small_parser.dailydata' I would be grateful for any help!
Rushikesh
What do I do to automate django tasks??
Rushikesh
Or schedule tasks in django??
Omair
Or schedule tasks in django??
Celery has some nice integration with django
Rushikesh
Celery has some nice integration with django
Does celery have inbuilt queues???
Sadra
Or schedule tasks in django??
http://quberty.pythonanywhere.com/authors/@lnxpy/Simplest%20Celery%20Task%20on%20Django/
Omair
Does celery have inbuilt queues???
You will need a separate message broker for that
Lipau3n
Hi guys! I need help with formsets! I want use inlineformset_factory and edit: 1. parent form 2. many child objects in one page Like django admin uses inlines
SkyLord
Hi to all. Help please to solve the problem. I have this model structure: Model1: Name= charfield Model2: Title = charfiel Etity = manytomany(model1) To model2 i added post_save reciever and in this reciever i try to get the values of entity field but in instance.entity is equal null. This values i need for save it in other models Eg. Model1 = <v1, v2, v3> Model2 = < Title = t1, Entity = [v1,v2, v3] > In post_save(sender=Model2): Model3 = v1, v2, v3
Enes
Hi
Enes
I am trying to add comments section for my blog project. I have an error in views.py but i cannot solve. Can anyone help me
Enes
https://dpaste.com/47QPY4PQ8 This is views.py
Enes
https://dpaste.com/42KDBY4C8 This is browser side
Enes
Exception Value: render() got an unexpected keyword argument 'pk'
Enes
Please help me guys thank you
Sadra
https://dpaste.com/42KDBY4C8 This is browser side
hey. take a look at the difference between line 23 and line 26.
Sadra
You need to change the parameter pk=post.pk to context={'pk': post.pk} explained more here: https://docs.djangoproject.com/en/3.1/topics/http/shortcuts/
Pavel
Hey friends, help me please!! “End of extended support” - what does it mean? our’s company project based on django 2.2 within about 70 3rd party libraries. Do i understand correct that after 2022 this version of django becomes unsupported (by whom?) and my webapp, including 3rd party libraries won’t be workable anymore?? It’s very important!!! I often say to my ctf, that we should upgrade permanently our tools, but he has opposite point of view on this case.
cj
Hey friends, help me please!! “End of extended support” - what does it mean? our’s company project based on django 2.2 within about 70 3rd party libraries. Do i understand correct that after 2022 this version of django becomes unsupported (by whom?) and my webapp, including 3rd party libraries won’t be workable anymore?? It’s very important!!! I often say to my ctf, that we should upgrade permanently our tools, but he has opposite point of view on this case.
after its end of support, Django 2.2 won't receive any new bugfixes neither security updates, so you should move your project to the next 3.2 LTS if you want to receive bugfixes and security updates, although your projects will continue running, just if you decide to stick on 2.2 before that date, it's your responsibility to keep your project free of bugs and security flaws if there are any then
cj
check this graphic to see the versions and their release/end dates
cj
also if you have dependency on over 70 3rd party libraries, check the support date for each of them 🤷🏻‍♂️
Firdaus
Salutations, Long time lurker, first time asking question here. Anyone can help regarding django-import-export dealing with self-referring model? # Model class Location(models.Model): name = models.CharField(max_length=40) parent = models.ForeignKey( to="self", on_delete=models.CASCADE, related_name="children", blank=True, null=True, default=None, ) depth = models.PositiveSmallIntegerField(default=0, editable=False) def save(self, *args, **kwargs): if self.parent and self.parent.depth < 6: self.depth = self.parent.depth + 1 super().save(*args, **kwargs) # Resource class LocationResource(resources.ModelResource): parent = fields.Field( column_name="parent", attribute="parent", widget=ForeignKeyWidget(Location, "id"), ) class Meta: model = Location # Error location.location.models.DoesNotExist: Location matching query does not exist. python: 3.8.5 django: 3.1.2 django-import-export: 2.4.0
Pavel
check this graphic to see the versions and their release/end dates
yes, i’ve begun searching some strong reason for upgrading our app right from thic pic..
Pavel
i need some strong reason to ensure my chief than we definitely need to upgrade both django and all of packages.. What is the best way to do it? What should i say him in 4 hours?)
Pavel
here they talk briefly about supported Django versions https://www.djangoproject.com/download/
yeah, thnx) but i started my challenge right from this page😅
Leonardo
guys, i'm doing a update on a model, but my FileField is saving just the file name without upload_to path
Firdaus
Hey friends, help me please!! “End of extended support” - what does it mean? our’s company project based on django 2.2 within about 70 3rd party libraries. Do i understand correct that after 2022 this version of django becomes unsupported (by whom?) and my webapp, including 3rd party libraries won’t be workable anymore?? It’s very important!!! I often say to my ctf, that we should upgrade permanently our tools, but he has opposite point of view on this case.
after 2022 this version of django becomes unsupported (by whom?) Unsupported == no more bug fix or security patches by Django project official developers and my webapp, including 3rd party libraries won’t be workable anymore?? Your app will still continue to work. But if you do encounter any new bugs, you will have to patch it by yourself. And as time goes by, the safety and stability of your all will continue to decrease. 3rd party libraries developers are also less inclined to maintain their libraries for Django version that has reached it's official end of support.
Random
any refrences for SEO in django
Random
?
Jimmies San
any refrences for SEO in django
django seo on google, first page, first 5 links, you are welcome
Jimmies San
googling... advanced stuff for most people
i think there isn't any videotutorial about it on udemy or such
Jimmies San
badumtss :P