postgresql/operations.py @ 235 leaking memory

2020-04-01 Thread Francesco Meli


Hello,

 

I have posted a well detailed issue here on StackOverflow (it can be 
improved if asked):
https://stackoverflow.com/questions/60972577/django-postgres-memory-leak

 

   - I have a custom command that crunches jobs coming from a Postgresql 
   table jobs.
   - Since the command is multi threaded the action of “picking up the job” 
   (select oldest job with status ‘pending’ && setting status to ‘in 
   progress’) was made atomic.
   - The jobs I’m executing for this test are empty methods so the leak 
   can’t be there.
   - Using tracemalloc pip package, I tracked down the python file and line 
   that is allocating memory without ever relasing it: 
   postgresql/operations.py:222 (Django 2.0.0)
   - I also installed Django 3 thinking that could have been an old bug but 
   even with this update the problem is still there: 
   postgresql/operations.py:235 (Django 3.0.5)
   - Please help.

 

Thanks 

 

FM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/05c2ecda-95de-469d-977a-d0410df8899c%40googlegroups.com.


Re: heroku goddaddy domain config

2020-04-01 Thread Makori Breens.
Try pointing through your heroku A records from godaddy.also make sure you
domain is added on heroku panel.it should work

On Wednesday, April 1, 2020, John McClain  wrote:

> Hello,
>
> I am trying to point my GoDaddy hosted domain to my heroku app but am not
> getting any love.
>
> Trying to get the https version configured
>
> Any suggestions?
>
> Thanks
>
> --
> John McClain
>
> Cell: 085-1977-823
> Skype: jmcclain0129
> Email: jmcclain0...@gmail.com
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAN-hv_rgdai-%2Bp0RCsMvXMtrGC6DMkn%
> 3DphcuQWiUVoD3humTAw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOz9w2FcBwXu0qZ7_AGyEauiOfs0Wd-7KhNMs3KXZV9GsTP-Vg%40mail.gmail.com.


Populate script not working

2020-04-01 Thread Jeff Waters
I've created a population script to test my website - please see below - but I 
get the following error message: django.contrib.auth.models.DoesNotExist: User 
matching query does not exist.

Given that I've created a hypothetical user, I'm not sure why this is?

Any suggestions would much appreciated.

Thank you.

Jeff

EDIT : I have done both makemigrations and migrate.

import os
import django

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mynowandthen.settings')
django.setup()

from django.contrib.auth.models import User
from nowandthen.models import Picture, Comment, UserProfile

def populate():
banana_user = [{'username': 'Banana','email': 'ban...@cat.com', 
'password': 'Banana1234'},]
johann_user = [{'username': 'Banana', 'email': 'ban...@cat.com', 
'password': 'Banana1234'},]
wmffre_user = [{'username': 'Wmffre', 'email': 'wmf...@cat.com', 
'password': 'Wmffre1234'},]


maryhill_comments = [{'user': banana_user,
'body': 'wowo I love this photo - reminds me of when I used to live 
there!'},
{'user': johann_user,'body': 'I love Maryhill - its such a pretty part 
of Glasgow lol'},
{'user': wmffre_user,'body': 'gonnae no dae that lol', 'user_id': 3}]

fireworks_comments = [{'user': banana_user,'body': 'amazing fireworks - 
thanks for sharing :)'},
{'user': johann_user,'body': 'love fireworks, love this, love YOU!'},
{'user': wmffre_user,'body': 'whoop!'}]

cityscape_comments = [{'user': banana_user,'body': 'more pics like this one 
please!!'},
{'user': johann_user,'body': 'what a sucky picture hahah'},
{'user': wmffre_user,'body': 'great - love it!'}]

pics = {'Maryhill': {'comments': maryhill_comments,
 'image': 
'shared_pics/View-from-kitchen-window-of-Maryhill-tenements.1970.jpg',
 'title': 'Maryhill Laundry',
 'description': 'back view',
 'tag_one': 'Maryhill',
 'tag_two': 'Laundry',
 'era': '1970s',
 'likes': 64},
'Fireworks': {'comments': fireworks_comments,
  'image': 'shared_pics/fireworks.jpg',
  'title': 'Glasgow Fireworks',
  'description': 'Fireworks at Glasgow Green',
  'tag_one': 'Glasgow',
  'tag_two': 'Fireworks',
  'era': '2010s',
  'likes': 32},
'Cityscape': {'comments': cityscape_comments,
  'image': 'shared_pics/glasgow_cityscape_copy.jpg',
  'title': 'Glasgow Cityscape',
  'descrpition': 'View over Glasgow',
  'tag_one': 'Cityscape',
  'tag_two': 'Glasgow',
  'era': '1990s',
  'likes': 16}}

for pic, pic_data in pics.items():
p = add_picture(pic,
pic_data['image'],
pic_data['title'],
pic_data['description'],
pic_data['tag_one'],
pic_data['tag_two'],
pic_data['era'])
for c in pic_data['comments']:
add_comment(c[0], c[1])

for p in Picture.objects.all():
for c in Comment.objects.filter(picture=p):
print(f' - {p}: {c}')


def add_user(name, email, password):
u = User.objects.get_or_create(username=name, first_name='Test', 
last_name='User', email=email)[0]
u.set_password(password)
up = UserProfile.objects.get_or_create(user=u)[0]
u.save()
return up


def add_picture(image, title, description, tag_one, tag_two, era, likes=0):
p = Picture.objects.get_or_create(image=image, title=title)[0]
p.description = description
p.tag_one = tag_one
p.tag_two = tag_two
p.era = era
p.like = likes
p.save()
return p


def add_comment(user, body):
u = User.objects.get(username=user)
up = UserProfile.objects.get(user=u)
c = Comment.objects.get_or_create(user=up, body=body)[0]
c.save()
return c


if __name__ == '__main__':
print('Starting Now And Then population script...')
populate()

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d5bfae89-4351-4760-9539-923c1b398a13%40googlegroups.com.


heroku goddaddy domain config

2020-04-01 Thread John McClain
Hello,

I am trying to point my GoDaddy hosted domain to my heroku app but am not
getting any love.

Trying to get the https version configured

Any suggestions?

Thanks

-- 
John McClain

Cell: 085-1977-823
Skype: jmcclain0129
Email: jmcclain0...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN-hv_rgdai-%2Bp0RCsMvXMtrGC6DMkn%3DphcuQWiUVoD3humTAw%40mail.gmail.com.


Re: Creating test databases in parallel

2020-04-01 Thread Thomas Lockhart
If you are trying to optimize the test flow, then you may want to spend some 
time shrinking your test databases to a more manageable size. Or have two sets; 
abbreviated and full, with the larger one to exercise your (unknown) edge cases.

hth

- Tom

> On Apr 1, 2020, at 2:25 AM, cool-RR  wrote:
> 
> Hi guys,
> 
> I'm trying to optimize our Django testing workflow.
> 
> We have 7 different databases, and Django spends a lot of time on these 
> lines: 
> 
> Creating test database for alias 'main_database'...
> Creating test database for alias 'foo_database'...
> Creating test database for alias 'bar_database'...
> Creating test database for alias 'baz_database'...
> 
> This is especially annoying when you're running just one test, but have to 
> wait 1:30 minutes just for these test databases.
> 
> Is there any way to speed this up? Either by parallelizing it or in any other 
> way. A few months ago I tried some naive code that parallelizes these 
> actions, but it failed. (Unfortunately I don't have the error message saved.)
> 
> 
> Thanks,
> Ram.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/43DDD6E9-EAA8-4162-BDB3-665F3CCA00E0%40gmail.com.


Re: Extending Django admin delete confirmation page

2020-04-01 Thread Gagan Deep
That doesn't work either. 😅

On Tue, Mar 31, 2020 at 12:19 PM Klaus Laube  wrote:

> Hi, Gagan.
>
> Try removing the "admin:" from your instruction: `{% extends
> "admin/delete_confirmation.html" %}`
>
> Here is the template with a possible blocks that you might overwrite:
> https://github.com/django/django/blob/master/django/contrib/admin/templates/admin/delete_confirmation.html
>
> Cheers.
>
>
> Em seg., 30 de mar. de 2020 às 23:20, Gagan Deep <
> the.one.above.all.ti...@gmail.com> escreveu:
>
>> Greetings,
>>
>> I am wondering if it is possible to extend Django Admin's delete
>> confirmation page. I tried the following but the received template does not
>> exist error page.
>>
>>> % extends 'admin:admin/delete_confirmation.html' %}
>>>
>> I refer to this website which stated it is possible to do so
>> https://book.huihoo.com/django/en/1.0/chapter17/index.html
>> I want to add a few custom actions which should require confirmation
>> before proceeding.
>>
>> Thanks and Regards
>> Gagan Deep
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/c71f8c6c-c218-4dbc-ab4f-6c5c814d5a3a%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAE89-bcfPg9oTJGfy%2B4Hi1oAipJK5NTjuVkHvm9UVOM%3D0JURMw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAOX69xokS7qABk_PMWaRc4-NLN4mnMQ%3DmZBC_nY-7G557jLZJQ%40mail.gmail.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thanks Andreas

When I do that, I get an error message: NoReverseMatch at /photo_feed/

Could the problem be with my add_comment.html?

The code for that is as follows:

{% extends 'nowandthen/base.html' %}
{% load staticfiles %}
{% block title_block %}
Add self
{% endblock %}
{% block body_block %}
Add a Comment


{% csrf_token %}
{{ form.as_p }}



{% endblock %}

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/493eaf33-0918-4f6c-9dcb-59465ff2c616%40googlegroups.com.


Re: Associating comments with images

2020-04-01 Thread Andréas Kühne
Yeah ok - so you should use the pictures variable to iterate over to get
the pictures and you should be fine!

Regards,

Andréas


Den ons 1 apr. 2020 kl 15:26 skrev Jeff Waters :

> Thank you Andreas.
>
> This is the views.py -
> https://github.com/EmilyQuimby/my_now_and_then/blob/master/nowandthen/views.py
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/944c9708-34f5-497a-a877-ecd66cd0fbca%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCecVxhDbs8H0vqOg_O7hdeFb60JnsSfdbhjF5zd6_J-6Q%40mail.gmail.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thank you Andreas.

This is the views.py - 
https://github.com/EmilyQuimby/my_now_and_then/blob/master/nowandthen/views.py

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/944c9708-34f5-497a-a877-ecd66cd0fbca%40googlegroups.com.


Re: Associating comments with images

2020-04-01 Thread Andréas Kühne
Ok - so you are not really doing this correctly - I am guessing now.

Can you send the code for your view as well. Because I am guessing that you
aren't sending anything to the context variable "pictures".

I think the other things are more or less correct (even though there are
some issues with the html as well)

But if we start with the context variable:
{% if pictures %}

This means that you need to send a variable called pictures with the
pictures you want to display on the page. This should be populated in
your view with the pictures you want to display. The reason I don't think
this is done, is because you then use the following for loop:
 {% for p in Picture.objects.all %}

You shouldn't use the models in the templates that way - but it would be
better to do:
 {% for p in pictures %} (if you have set the variable) :)

Other than that - you have a ul tag there that seems a bit out of place :)

Regards,

Andréas


Den ons 1 apr. 2020 kl 13:43 skrev Jeff Waters :

> Thanks Andreas
>
> I think that one of the mistakes I'd made previously was to not associate
> particular comments with particular pictures.
>
> I've tried to rectify that using the code below. However, when I do this,
> the page I get is empty.
>
> Any advice would be appreciated:
>
> {% extends 'nowandthen/base.html' %}
> {% block body_block %}
> 
> 
> {% if pictures %}
> 
> {% for p in Picture.objects.all %}
> 
>   
> 
> 
>
>   
> 
>
> 
> 
>
>   
> {{
> p.title }}
>   
> {{ p.when_added }}
> 
> 
>
>   
> 
> 
> 
> 
> 
> 
>
>   
> 
> 
>
>   
> {{
> p.description }}
>   
>  aria-expanded="false" aria-controls="collapseContent">Click for
> description
> 
> 
>
> 
> 
> 
> 
> comments
> {% if not p.comments %}
> No comments
> {% endif %}
> {% for x in p.comment %}
> 
> 
> Comment by {{ x.user }}
> 
> {{ x.created_on }}
> 
> 
> {{ x.body | linebreaks }}
> 
> {% endfor %}
> 
> 
> {% if new_comment %}
> Your comment has been posted.
> {% else %}
> Leave a comment
> 
> {{ comment_form.as_p }}
> {% csrf_token %}
> Submit
> {% endif %}
> 
> 
>   
> 
> 
> {% endfor %}
> 
> {% else %}
> There are no photographs present.
> {% endif %}
>
> {% endblock %}
>
>
> Thanks
>
> Jeff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/7a56b57b-42e9-42be-bc9f-3ed8714cf444%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCfY878xRaOLbODrp1%2BoY60exZC3BZ8h%3DDkQmsS5LB4NkA%40mail.gmail.com.


Re: Associating comments with images

2020-04-01 Thread Jeff Waters
Thanks Andreas

I think that one of the mistakes I'd made previously was to not associate 
particular comments with particular pictures. 

I've tried to rectify that using the code below. However, when I do this, the 
page I get is empty. 

Any advice would be appreciated:

{% extends 'nowandthen/base.html' %}
{% block body_block %}


{% if pictures %}

{% for p in Picture.objects.all %}

  



  





  
{{ p.title 
}}
  
{{ 
p.when_added }}



  







  



  
{{ 
p.description }}
  
Click for description







comments
{% if not p.comments %}
No comments
{% endif %}
{% for x in p.comment %}


Comment by {{ x.user }}

{{ x.created_on }}


{{ x.body | linebreaks }}

{% endfor %}


{% if new_comment %}
Your comment has been posted.
{% else %}
Leave a comment

{{ comment_form.as_p }}
{% csrf_token %}
Submit
{% endif %}


  


{% endfor %}

{% else %}
There are no photographs present.
{% endif %}

{% endblock %}


Thanks

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7a56b57b-42e9-42be-bc9f-3ed8714cf444%40googlegroups.com.


Getting one view function context into another view

2020-04-01 Thread Irfan Khan
Hi all,

I have detailview template there detailview view all description like
title. Date etc..,
>From that function detailview I wanted to get that title into another view
Can any one guide me

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALKGViotTp_cbZgvOZ-rKe4K0Gq0529_VRZxNs2uK-NnExaBrw%40mail.gmail.com.


Re: Creating test databases in parallel

2020-04-01 Thread Ram Rachum
This is a general article about concurrency in Python. I'm very good with
concurrency in Python, I'm asking about a specific case here.

On Wed, Apr 1, 2020 at 1:20 PM Motaz Hejaze  wrote:

> Long article somehow , but very informative ...
>
> https://realpython.com/python-concurrency/
>
> On Wed, 1 Apr 2020, 11:25 am cool-RR,  wrote:
>
>> Hi guys,
>>
>> I'm trying to optimize our Django testing workflow.
>>
>> We have 7 different databases, and Django spends a lot of time on these
>> lines:
>>
>>
>> Creating test database for alias 'main_database'...
>> Creating test database for alias 'foo_database'...
>> Creating test database for alias 'bar_database'...
>> Creating test database for alias 'baz_database'...
>>
>>
>> This is especially annoying when you're running just one test, but have
>> to wait 1:30 minutes just for these test databases.
>>
>> *Is there any way to speed this up? *Either by parallelizing it or in
>> any other way. A few months ago I tried some naive code that parallelizes
>> these actions, but it failed. (Unfortunately I don't have the error message
>> saved.)
>>
>>
>> Thanks,
>> Ram.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/-djWwBB5xac/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHV4E-c9dGVSG69K%3DNN3GUuVDrAGacLijQeDD6ZFUU3LXNPL3Q%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANXboVZdXOhz1G2ja%2B0MPxE9USfU-6UhROufy%2BHVVTc-GYhZDA%40mail.gmail.com.


Re: Mobile friendly admin

2020-04-01 Thread Motaz Hejaze
Why dont we implement bootstrap for better responsive view ?

On Wed, 1 Apr 2020, 10:19 am Mike Dewhirst,  wrote:

> On 1/04/2020 7:02 pm, guettli wrote:
> > I know there a several third party packages which try to improve the
> > great django admin:
> >
> > See: https://djangopackages.org/grids/g/admin-interface/
> >
> > A lot of packages are already outdated. AFAIK no sane and simple
> > default package exists.
> >
> > I think the only solution to this would be an improvement which is not
> > a third party package.
> >
> > With other words: An update of the original admin. AFAIK no major
> > change is planed by
> > the core developers, or am I missing something?
> >
> > My goal: mobile friendly admin interface.
>
> My admin site works well on my phone. I think it is all done with clever
> smoke and mirrors in css.
>
> I have used a bit of my own css for widening some fields and that
> defeats some of the browser capabilities in both the phone and desktop.
> I mostly use Firefox.
>
> What part of it is not mobile friendly for you?
>
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> > an email to django-users+unsubscr...@googlegroups.com
> > .
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/7dd55582-ad0a-4967-9abf-aa7f93d6e5d6%40googlegroups.com
> > <
> https://groups.google.com/d/msgid/django-users/7dd55582-ad0a-4967-9abf-aa7f93d6e5d6%40googlegroups.com?utm_medium=email&utm_source=footer
> >.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/b175b960-c5ad-e4a8-0d53-ada3ec64ff66%40dewhirst.com.au
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-e-xAHT3mW%2Bz19jPi_ODZNogt2_X%3Dj9vHRdujiN5VnR8Q%40mail.gmail.com.


Re: Creating test databases in parallel

2020-04-01 Thread Motaz Hejaze
Long article somehow , but very informative ...

https://realpython.com/python-concurrency/

On Wed, 1 Apr 2020, 11:25 am cool-RR,  wrote:

> Hi guys,
>
> I'm trying to optimize our Django testing workflow.
>
> We have 7 different databases, and Django spends a lot of time on these
> lines:
>
>
> Creating test database for alias 'main_database'...
> Creating test database for alias 'foo_database'...
> Creating test database for alias 'bar_database'...
> Creating test database for alias 'baz_database'...
>
>
> This is especially annoying when you're running just one test, but have to
> wait 1:30 minutes just for these test databases.
>
> *Is there any way to speed this up? *Either by parallelizing it or in any
> other way. A few months ago I tried some naive code that parallelizes these
> actions, but it failed. (Unfortunately I don't have the error message
> saved.)
>
>
> Thanks,
> Ram.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-c9dGVSG69K%3DNN3GUuVDrAGacLijQeDD6ZFUU3LXNPL3Q%40mail.gmail.com.


Creating test databases in parallel

2020-04-01 Thread cool-RR
Hi guys,

I'm trying to optimize our Django testing workflow.

We have 7 different databases, and Django spends a lot of time on these 
lines: 


Creating test database for alias 'main_database'...
Creating test database for alias 'foo_database'...
Creating test database for alias 'bar_database'...
Creating test database for alias 'baz_database'...


This is especially annoying when you're running just one test, but have to 
wait 1:30 minutes just for these test databases.

*Is there any way to speed this up? *Either by parallelizing it or in any 
other way. A few months ago I tried some naive code that parallelizes these 
actions, but it failed. (Unfortunately I don't have the error message 
saved.)


Thanks,
Ram.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6619ce10-6a0e-4fde-8d2c-fb81e6e2bd2c%40googlegroups.com.


Re: Issue with passing parameters in urls

2020-04-01 Thread aniket kamthe
hey Antje,
Let me check and get back. I think I have got the problem, I will get back
if I have further issues.

On Wed, Apr 1, 2020 at 2:32 PM Antje Kazimiers  wrote:

> Hi Aniket,
>
> Your thread object in your template is actually a message since your
> passing messages to context in your view.
>
> but when you initialize messages you don't set a name attribute.
>
> So I would double check your Message model if it has a name attribute.
>
> btw your error message didn't display for me.
>
> Antje
> On 3/30/20 4:50 PM, aniket kamthe wrote:
>
> Hey All,
> I have been watching your youtube tutorials and have been stuck on an
> issue for a while now. Can you help me out pls -
>
> I am trying to pass a parameter via a button in an HTML file and using
> that in the next link to access a specific set of entries from the database
> -
>
> HTML File code -
>
> {% for thread in object %}
>  role="button">{{ thread.name }}  Something  {% endfor 
> %}
>
> URLs files code -
>
> path('message//', views.message, name='message'),
>
> Views files code
>
> def message(request, threadid):
>   if request.method == 'POST':
> print(request.POST.get('message'))
> m = messages(message=request.POST.get('message'), thread_id='00', 
> likes='00', Message_flags='00')
> m.save();
> if (request.method == 'POST') and ("like" in request.POST):
>   print("hi")
> data = messages.objects.all()
> context = {
>   'object': data
> }
> return render(request, 'mysite/message.html', context)
>   else:
> data = messages.objects.all()
> context = {
>   'object': data
> }
> return render(request, 'mysite/message.html', context)
>
> But I get this error, idk how to resolve this one -
>
> [image: image.png]
> Pls let me know If you are able to figure out the problem.
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/deae3154-4d36-438a-9669-5698d319ed27%40googlegroups.com
> 
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/879b4154-a801-9080-96a3-0f28e5e38ac1%40gmail.com
> 
> .
>


-- 
Aniket Kamthe
Final year Student | Dual Degree
Department of Mechanical Engineering
Masters in Robotics
Indian Institute Of Technology Madras.
Contact : +91-9970320507
Mail id : aniketkamthe...@gmail.com

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKFu1CFy9eZhm1oCk3YC8yof220t__J%2BtEx%2B9Yjnto%3Dk8hMOtQ%40mail.gmail.com.


Re: Issue with passing parameters in urls

2020-04-01 Thread Antje Kazimiers
Hi Aniket,

Your thread object in your template is actually a message since your
passing messages to context in your view.

but when you initialize messages you don't set a name attribute.

So I would double check your Message model if it has a name attribute.

btw your error message didn't display for me.

Antje

On 3/30/20 4:50 PM, aniket kamthe wrote:
> Hey All, 
> I have been watching your youtube tutorials and have been stuck on an
> issue for a while now. Can you help me out pls - 
>
> I am trying to pass a parameter via a button in an HTML file and using
> that in the next link to access a specific set of entries from the
> database - 
>
> HTML File code - 
>
> {% for thread in object %}
> role="button">{{ thread.name }} Something  {% endfor %}
> URLs files code - 
> path('message//', views.message, name='message'),
> Views files code 
> def message(request, threadid):
>   if request.method == 'POST':
> print(request.POST.get('message'))
> m = messages(message=request.POST.get('message'), thread_id='00', 
> likes='00', Message_flags='00')
> m.save();
> if (request.method == 'POST') and ("like" in request.POST):
>   print("hi")
> data = messages.objects.all()
> context = {
>   'object': data
> }
> return render(request, 'mysite/message.html', context)
>   else:
> data = messages.objects.all()
> context = {
>   'object': data
> }
> return render(request, 'mysite/message.html', context)
> But I get this error, idk how to resolve this one - 
>
> image.png
> Pls let me know If you are able to figure out the problem. 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com
> .
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/deae3154-4d36-438a-9669-5698d319ed27%40googlegroups.com
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/879b4154-a801-9080-96a3-0f28e5e38ac1%40gmail.com.


Re: Mobile friendly admin

2020-04-01 Thread Mike Dewhirst

On 1/04/2020 7:02 pm, guettli wrote:
I know there a several third party packages which try to improve the 
great django admin:


See: https://djangopackages.org/grids/g/admin-interface/

A lot of packages are already outdated. AFAIK no sane and simple 
default package exists.


I think the only solution to this would be an improvement which is not 
a third party package.


With other words: An update of the original admin. AFAIK no major 
change is planed by

the core developers, or am I missing something?

My goal: mobile friendly admin interface.


My admin site works well on my phone. I think it is all done with clever 
smoke and mirrors in css.


I have used a bit of my own css for widening some fields and that 
defeats some of the browser capabilities in both the phone and desktop. 
I mostly use Firefox.


What part of it is not mobile friendly for you?



--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7dd55582-ad0a-4967-9abf-aa7f93d6e5d6%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b175b960-c5ad-e4a8-0d53-ada3ec64ff66%40dewhirst.com.au.


Django bugfix releases: 3.0.5 and 2.2.12.

2020-04-01 Thread Carlton Gibson
Details are available on the Django project weblog:

https://www.djangoproject.com/weblog/2020/apr/01/bugfix-releases/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/F01C866D-39EA-4C61-A777-FABC3863FA5F%40gmail.com.


Mobile friendly admin

2020-04-01 Thread guettli
I know there a several third party packages which try to improve the great 
django admin:

See: https://djangopackages.org/grids/g/admin-interface/

A lot of packages are already outdated. AFAIK no sane and simple default 
package exists.

I think the only solution to this would be an improvement which is not a 
third party package.

With other words: An update of the original admin. AFAIK no major change is 
planed by
the core developers, or am I missing something?

My goal: mobile friendly admin interface.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7dd55582-ad0a-4967-9abf-aa7f93d6e5d6%40googlegroups.com.