Monday, August 23, 2021

Django admin - how to change breadcrumbs 'Home' into 'Main menu'

We are using 'Home' in a different, more public, part of the site and
have to adjust that first item in the Admin breadcrumbs to 'Menu' or
'Main menu' in order to keep the UX masters happy. Some of the Admin is
public facing.

Looking at the source, I would have to override an awful lot of
templates with ...

<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>

It looks impossible to do elegantly. I shudder at scripting a global
search and replace.

Is this worth putting in the effort to make 'Home' a setting - if that
is even possible.

If so, how do I get started on that?

Thanks

Mike

--
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.


--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3306675c-6079-324e-0fad-b0857a9140a8%40dewhirst.com.au.

Friday, August 20, 2021

Strange Errors when Using MySQL DB

I have a Django (v2.2.23) application connected to a MySQL (v5.7) database. Every now and then, for a few minutes at a time, all my DB queries start to fail with one of the following errors: "Unknown MySQL Error" (error code 2000), "InterfaceError", or "Malformed Packet" (error code 2027). The errors resolve themselves on their own after a few minutes, but then they pop up again a some time later (on average, every few hours). These errors happen seemingly at random and I haven't found any reliable way to reproduce them till now. There is nothing wrong with the code as far as I can see because when the queries do execute, they work as expected and give the correct results.

I have already made several attempts to fix the issue to no avail, including :-

This error is occuring both on local and staging environments.

In order to debug this further, I create a custom exception handler and logged the error as well as the last 3 SQL queries executed (which I got using connection.queries[-3:]).

The result is given below:

'EXCEPTION': InterfaceError(0, ''), 'LAST_QUERIES': [{'sql': 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED', 'time': '0.000'}, {'sql': None, 'time': '0.000'}]

Notice that for the second query, the value of 'sql' is coming as None. Is Django trying to execute a null query? Could this be the cause of the strange, intermittent errors? Is this a bug inside Django or have I configured something incorrectly?


--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f81df377-2ddf-4b18-89e1-8991b028dea2n%40googlegroups.com.

Thursday, August 19, 2021

Re: Python code changes are not reflecting on Django-based web server.

Yes systemctl stop and start httpd, i verified by checking the web page. How can i check pid? 

Regards
Hasan

On Aug 19, 2021, at 8:55 AM, Ryan Nowakowski <tubaman@fattuba.com> wrote:

I'd verify that the systemctl commands are actually starting and stopping httpd. Does the pid change?

On August 18, 2021 11:04:07 AM CDT, Hasan Baig <hasanbaigg@gmail.com> wrote:
Hi,

I have been hosting a django-based web server (httpd with mod_wsgi package) on Linux CentOS 7. I used to reflect the changes made in my code by restarting the web server using the following commands:

sudo systemctl stop httpd
sudo systemctl start httpd


and it would reflect the changes smoothly. Since few days back, this strategy has not been work at all. That is, whenever I make any changes in my python code, even simply printing a message in log file, it is not reflected. To reflect the changes every time, I have to reboot the VM. I tried the following things already which did not help at all:

• Clearing .pyc files
• Restarting/Reloading httpd server
• touch wsgi file
• http is running without caching or proxying (modules have been commented out)


All of the above mentioned tries did not appear to work. The changes are only reflected once when the VM is rebooted. 

What do I need to do to make the code changes reflected without rebooting the VM every time? Any clues, help or suggestions are highly appreciated.

Thanks.

regards
HB

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/06AA5FDA-FF21-498E-A2B5-AE3AC7252333%40fattuba.com.

Re: Python code changes are not reflecting on Django-based web server.

I have been using the apachectl command instead and it works without an issue.

sudo apachectl stop
sudo apachectl start
sudo apachectl restart

On Thu, Aug 19, 2021 at 2:54 PM Ryan Nowakowski <tubaman@fattuba.com> wrote:
I'd verify that the systemctl commands are actually starting and stopping httpd. Does the pid change?

On August 18, 2021 11:04:07 AM CDT, Hasan Baig <hasanbaigg@gmail.com> wrote:
Hi,

I have been hosting a django-based web server (httpd with mod_wsgi package) on Linux CentOS 7. I used to reflect the changes made in my code by restarting the web server using the following commands:

sudo systemctl stop httpd
sudo systemctl start httpd


and it would reflect the changes smoothly. Since few days back, this strategy has not been work at all. That is, whenever I make any changes in my python code, even simply printing a message in log file, it is not reflected. To reflect the changes every time, I have to reboot the VM. I tried the following things already which did not help at all:

• Clearing .pyc files
• Restarting/Reloading httpd server
• touch wsgi file
• http is running without caching or proxying (modules have been commented out)


All of the above mentioned tries did not appear to work. The changes are only reflected once when the VM is rebooted. 

What do I need to do to make the code changes reflected without rebooting the VM every time? Any clues, help or suggestions are highly appreciated.

Thanks.

regards
HB

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/06AA5FDA-FF21-498E-A2B5-AE3AC7252333%40fattuba.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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACbngZd259COib5Vs_N_iOazqmgjrJj5scbYV-M244pgfhUUZg%40mail.gmail.com.

Re: Python code changes are not reflecting on Django-based web server.

I'd verify that the systemctl commands are actually starting and stopping httpd. Does the pid change?

On August 18, 2021 11:04:07 AM CDT, Hasan Baig <hasanbaigg@gmail.com> wrote:
Hi,

I have been hosting a django-based web server (httpd with mod_wsgi package) on Linux CentOS 7. I used to reflect the changes made in my code by restarting the web server using the following commands:

sudo systemctl stop httpd
sudo systemctl start httpd


and it would reflect the changes smoothly. Since few days back, this strategy has not been work at all. That is, whenever I make any changes in my python code, even simply printing a message in log file, it is not reflected. To reflect the changes every time, I have to reboot the VM. I tried the following things already which did not help at all:

• Clearing .pyc files
• Restarting/Reloading httpd server
• touch wsgi file
• http is running without caching or proxying (modules have been commented out)


All of the above mentioned tries did not appear to work. The changes are only reflected once when the VM is rebooted. 

What do I need to do to make the code changes reflected without rebooting the VM every time? Any clues, help or suggestions are highly appreciated.

Thanks.

regards
HB

Wednesday, August 18, 2021

Python code changes are not reflecting on Django-based web server.

Hi,

I have been hosting a django-based web server (httpd with mod_wsgi package) on Linux CentOS 7. I used to reflect the changes made in my code by restarting the web server using the following commands:

sudo systemctl stop httpd
sudo systemctl start httpd


and it would reflect the changes smoothly. Since few days back, this strategy has not been work at all. That is, whenever I make any changes in my python code, even simply printing a message in log file, it is not reflected. To reflect the changes every time, I have to reboot the VM. I tried the following things already which did not help at all:

• Clearing .pyc files
• Restarting/Reloading httpd server
• touch wsgi file
• http is running without caching or proxying (modules have been commented out)


All of the above mentioned tries did not appear to work. The changes are only reflected once when the VM is rebooted. 

What do I need to do to make the code changes reflected without rebooting the VM every time? Any clues, help or suggestions are highly appreciated.

Thanks.

regards
HB

Monday, August 16, 2021

Re: Error: NoReverseMatch at

Add an absolute url to your model.


El lun., 16 de agosto de 2021 3:57 a. m., 'Rahul Chauhan' via Django users <django-users@googlegroups.com> escribió:
Hi All,

I have a customized/override "changelist_view.html" to display hierarchical data in Django admin panel.

The problem is that the default form to add the Model data throws below error when clicked the button "add category". Please refer to the attached screenshot.



NoReverseMatch at /admin/category/category/add/

Reverse for 'app_list' with keyword arguments '{'app_label': ''}' not found. 1 pattern(s) tried: ['admin/(?P<app_label>category|auth)/$']



If I remove the function "def changelist_view(self, request, extra_context={}):", the model starts appearing fine. Please refer to the screenshot below. But then I loose the functionality to display custom hierarchical data.



How can I still show the default form to add data to the model and override the  changelist_view.html" .

Appreciate any help in advance.

Thanks
Rahul

This e-mail is intended only for the named person or entity to which it is addressed and contains valuable business information that is privileged, confidential and/or otherwise protected from disclosure. If you received this e-mail in error, any review, use, dissemination, distribution or copying of this e-mail is strictly prohibited. Please notify us immediately of the error via e-mail to disclaimer@email-abuse.com and please delete the e-mail from your system, retaining no copies in any media. We appreciate your cooperation.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a3088233-47f7-4433-ae5c-3cd37b1fd9dbn%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHRQUHmqqZEXH0bshLVbKnOSDkV2L%3DCVKv_wa3rKx6%3DbxAgnpA%40mail.gmail.com.