@cache_control decorator fails after update to 4.0.5

2022-06-22 Thread Matthew Hegarty
Hi All

I'm upgrading to 4.0.5 from 3.2.13

My integration test fails:

class FaviconTests(SimpleTestCase):
def test_get(self):
response = self.client.get("/favicon.ico")
self.assertEqual(response.status_code, HTTPStatus.OK)
self.assertEqual(response["Cache-Control"], "max-age=86400, 
immutable, public")
self.assertEqual(response["Content-Type"], "image/png")
content = b"".join(response.streaming_content)
self.assertGreater(len(content), 0)

Error is:

TypeError: cache_control didn't receive an HttpRequest. If you are 
decorating a classmethod, be sure to use @method_decorator.

Can anyone advise if this is a known issue?

thanks


-- 
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/663df961-c9b5-47cd-9a65-5de66bad9755n%40googlegroups.com.


Re: @cache_control decorator fails after update to 4.0.5

2022-06-22 Thread Matthew Hegarty


OK, silly me. I should have paid more attention to the message. This fixes 
it:
@method_decorator(cache_control(max_age=60 * 60 * 24, immutable=True, 
public=True), name='dispatch')

On Wednesday, 22 June 2022 at 12:51:18 UTC+1 Matthew Hegarty wrote:

> Hi All
>
> I'm upgrading to 4.0.5 from 3.2.13
>
> My integration test fails:
>
> class FaviconTests(SimpleTestCase):
> def test_get(self):
> response = self.client.get("/favicon.ico")
> self.assertEqual(response.status_code, HTTPStatus.OK)
> self.assertEqual(response["Cache-Control"], "max-age=86400, 
> immutable, public")
> self.assertEqual(response["Content-Type"], "image/png")
> content = b"".join(response.streaming_content)
> self.assertGreater(len(content), 0)
>
> Error is:
>
> TypeError: cache_control didn't receive an HttpRequest. If you are 
> decorating a classmethod, be sure to use @method_decorator.
>
> Can anyone advise if this is a known issue?
>
> thanks
>
>
>

-- 
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/6f27c19c-9ea6-4aab-84b2-e271682b07e6n%40googlegroups.com.


server can't connect in browser

2022-06-22 Thread Deep Kamal
Hi all,
I am quite new in django. Just started my first project in it.
I started an ec2 instance, setup virtual environment and run server through 
python manage.py runserver command.
Server is up with no errors. But when I copy the link and open in browser 
it says site can't be reached. Screenshots of it are attached for reference.

-- 
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/7643c462-97bf-479d-90a0-302a10255470n%40googlegroups.com.


Need help

2022-06-22 Thread Rohit Lohar
The below image consists of a form layout the main form has it's model 
defined and the subform has it's own model defined but I am getting problem 
that how should I implement and also the subform is dynamic so how can I 
implement it using htmx. Your help is appreciated. 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/bcaa754c-d946-4645-8b52-dd28de4cad41n%40googlegroups.com.


Re: server can't connect in browser

2022-06-22 Thread Antonis Christofides

Hello,

If you insist on working this way, there are two things you need to do:

1. You need to run it with "python manage.py runserver 0.0.0.0:8002".
2. 127.0.0.1 is the wrong address. Find the IP address of the server and use
   that one.

Typically, when developing (and especially when we're new), we run the Django 
development server on the local machine, not an a EC2 instance or anywhere else. 
You will be less confused if you do that, and you will have fewer problems.


Regards,

Antonis


On 22/06/2022 06.44, Deep Kamal wrote:

Hi all,
I am quite new in django. Just started my first project in it.
I started an ec2 instance, setup virtual environment and run server through
python manage.py runserver command.
Server is up with no errors. But when I copy the link and open in browser it 
says site can't be reached. Screenshots of it are attached for reference.

--
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/7643c462-97bf-479d-90a0-302a10255470n%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/0be1b239-5e14-5d89-bb93-686b86b69c0c%40antonischristofides.com.


Re: server can't connect in browser

2022-06-22 Thread Django-Admin
Try opening the link in a browser in the same EC2 instance, if you are not 
doing so.

On Wednesday, June 22, 2022 at 6:37:18 PM UTC+5:30 kamald...@gmail.com 
wrote:

> Hi all,
> I am quite new in django. Just started my first project in it.
> I started an ec2 instance, setup virtual environment and run server 
> through 
> python manage.py runserver command.
> Server is up with no errors. But when I copy the link and open in browser 
> it says site can't be reached. Screenshots of it are attached for reference.
>

-- 
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/dfe8f847-65bc-4602-b3b9-9e7a81998459n%40googlegroups.com.