These are chat archives for django/django

13th
Sep 2017
Esterling Accime Youtube
@accimeesterlin
Sep 13 2017 00:18 UTC
@sixtycycles it should be in the settings.py
Emmanuel Obogbaimhe
@EmmanuelObo
Sep 13 2017 00:20 UTC
I'm getting this error:
ValueError: Unhandled pending operations for models
王强
@wojunnihou
Sep 13 2017 15:19 UTC
when I run
"python setup.py extract_messages --output-file foobar/locale/messages.pot” ,
I’m getting this error:
“error: no input files or directories specified"
Ibrokola
@Ibrokola
Sep 13 2017 15:23 UTC
Does anyone have a good resource for creating email notifications with Django, I mean email notifications for a chat or forum like...
sanyam bansal
@sanyambansal76_twitter
Sep 13 2017 17:15 UTC

Hi I am trying to deploy a django application using the bitbucket-pipeline on the google cloud engine.

I am able to configure everything but getting stuck with running the migration on the prod server

here is the bitbucket-pipeline.yml

image: google/cloud-sdk

pipelines:
default:

  - step:
      script:
       #Install app & dev dependencies, test, deploy, test deployment
      - pip install -t lib -r requirements.txt
      - echo ${GOOGLE_CLIENT_SECRET} > client-secret.json
      - gcloud auth activate-service-account --key-file client-secret.json
      - gcloud --quiet --verbosity=error app deploy app.yaml --promote
sanyam bansal
@sanyambansal76_twitter
Sep 13 2017 17:54 UTC
any idea ?
Harel Malka
@harel
Sep 13 2017 22:01 UTC
HI all. Anyone has any idea how i can package an app to be pip installable and provide fixtures with it? I extracted some common immutable models from my application which i want to install across multiple services with a fixed set of fixtures . Those are packages with the app and exist in site-packages but how can I load them up?
Costantin
@Cosbgn
Sep 13 2017 23:21 UTC
Hey!
Is anyone around who can help me out a second?
I'm trying to make a foreign key work but I'm getting an error
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:21 UTC
Which error are you getting?
Costantin
@Cosbgn
Sep 13 2017 23:21 UTC
parent_key = SeoKeys.objects.get(view_id=view_id, key_nbr=key_nbr)
    if parent_key.status != 'active':
        parent_key.status = status
        parent_key.save()

    metrics, created = SeoMetrics.objects.get_or_create(
                                                        seo_url = url_sent,
                                                        date = date,
                                                        parent_key = parent_key,
                                                        defaults = {
                                                                'parent_key':parent_key,
                                                                'seo_url': url_sent,
                                                                'url_found':url_found,
                                                                'position':position,
                                                                'parent_key':parent_key,
                                                                }
                                                        )
ValueError: Cannot assign "(<SeoKeys: SeoKeys object>,)": "SeoMetrics.parent_key" must be a "SeoKeys" instance.
I thought that to pass a foreign key you pass the entire object, in my case parent_key
the models look something like this:
class SeoMetrics(models.Model):
    parent_key = models.ForeignKey('SeoKeys', on_delete=models.CASCADE)
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:24 UTC
I think your problem is related to parent_key = SeoKeys... line. You are getting the object but parameters might want the id or something.
I don't know the SeoKeys model but check the docs carefully
I mean it doesn't say parent but parent_key
Costantin
@Cosbgn
Sep 13 2017 23:25 UTC
SeoKeys is a simple model. It doesn't reference at all SeoMetrics
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:27 UTC
try 'parent_key': parent_key[0]
Costantin
@Cosbgn
Sep 13 2017 23:27 UTC
the thing is that the error says SeoMetrics.parent_key" must be a "SeoKeys" instance. but it is 🤔
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:27 UTC
Because you are sending a tuple as (<SeoKeys: SeoKeys object>,)
Costantin
@Cosbgn
Sep 13 2017 23:28 UTC
try 'parent_key': parent_key[0]
But it's a objects.get it should return me only the one object
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:28 UTC
Try it I am curious
Costantin
@Cosbgn
Sep 13 2017 23:29 UTC
one sec
it seems to work @oguzhan-yilmaz
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:31 UTC
@Cosbgn I am happy for you :)
Costantin
@Cosbgn
Sep 13 2017 23:32 UTC
do you know why it's a tuple? According to django docs I should be able to send directly the object
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:33 UTC
I have recently started to learn Django. I don't know exacly but it might have something to do with multiple parameter filters. Or you are not giving unique parameters
and Django tries to give you all the possible ones
Costantin
@Cosbgn
Sep 13 2017 23:35 UTC
Ok, Thanks a lot @oguzhan-yilmaz
really helpful !
Oğuzhan Yılmaz
@oguzhan-yilmaz
Sep 13 2017 23:36 UTC
No problem @Cosbgn , always read the errors carefully :D
Costantin
@Cosbgn
Sep 13 2017 23:37 UTC
yes! :D