Re: The SECRET_KEY setting must not be empty - os.environ.get('SECRET_KEY')

2022-03-03 Thread Adeyemi Deji
Thank u so much. A really useful information I never knew existed. Really
appreciate it.



On Thu, 3 Mar 2022, 07:41 Carsten Fuchs,  wrote:

> Am 03.03.22 um 04:43 schrieb Adeyemi Deji:
> > What do u mean by on installation @On installation, the file is then
> copied to localconfig.py, where it is *ignored* by svn, git, etc. The file
> is then customized for production, development, …
> >
> > Do u mean during deployment?
>
> During development, you create two files:
>
> localconfig.example
> This file contains only example data, comments/instructions and
> *irrelevant* data, such as *fake* secret keys, fake database passwords,
> etc. This file is committed to the repository. Its *only* purpose is to
> serve as an example and be copied to filename localconfig.py later.
>
> localconfig.py
> Created from a copy of localconfig.example, during development you must
> make sure that this file is never committed to your repository. This is
> achieved by telling the repository to ignore it, e.g. Git by editing the
> .gitignore file appropriately, Subversion with the svn:ignore property.
> Still during development, you customize the file as needed for development,
> i.e. insert the required database details, DEBUG = True, etc.
>
> For deployment, when you first clone the repository on the production
> server, it will come with the localconfig.example file, but not with the
> localconfig.py file, as intended. As part of the installation, you copy
> localconfig.example to localconfig.py and customize it for production
> (production database, etc.). Done.
>
> Variants of this approach are possible, e.g. keeping the localconfig.py
> file entirely outside of the project directory, where it is in even less
> danger to be accidentally committed. Or to store the values not in a py,
> but in a json, ini, txt, ... file that is loaded and parsed in settings.py.
>
> Best regards,
> Carsten
>
>
> > On Wed, Mar 2, 2022 at 7:49 AM Carsten Fuchs  > wrote:
> >
> > Am 02.03.22 um 04:23 schrieb Mike Dewhirst:
> > > ... where you write get_secret_key() to pull it from the
> environment or a file somewhere which is not in your repository.
> >
> > A variant of this that I like is to have a file like
> localconfig.example in the repository next to settings.py that contains e.g.
> > DATABASES = ...  # dummy or default config
> > SECRET_KEY = 'example'
> >
> > On installation, the file is then copied to localconfig.py, where it
> is *ignored* by svn, git, etc. The file is then customized for production,
> development, …
> >
> > In settings.py, there is
> >
> > from project_dir import localconfig
> > # ...
> > DEBUG = localconfig.DEBUG
> > SECRET_KEY = localconfig.SECRET_KEY
> > DATABASES = localconfig.DATABASES
> > # ...
> >
> > This works very well and is simple, safe and convenient.
> >
> > Best regards,
> > Carsten
> >
>
> --
> 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/08a9d115-235f-3538-70fa-e6e9ecdb404f%40cafu.de
> .
>

-- 
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/CAEO1GrpKsnq4D%3DmyeM%3DVfOSBXVcVwbguZ-hfKQdGJBMFeLmjSw%40mail.gmail.com.


model property optimize

2022-03-03 Thread Joseph Amiri
Hi guys. i have a property in my model like blew:

*def is_subscription(self):*

* return self.subscriptions.active().count() > 0*

and it check if course is subscription or not by reverse relation to 
subscription model.
but its not optimize and it cost me one query for each course.
i ask some one and they told me its not a right place for this method. i 
should annotate it to queryset but does anyone know how ?

-- 
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/775dc319-fb0a-43a4-9b20-08dfcfdad9e1n%40googlegroups.com.


Re: ValueError: Field 'id' expected a number but got ' '.

2022-03-03 Thread Kasper Laudrup

On 03/03/2022 04.04, Suresh_Chilukuri wrote:
Hi All,please find below images for the "ValueError: Field 'id' expected 
a number but got ' ' " as the error.


I am expecting quick response from you guys



You cannot expect a quick response or even a response at all if you 
cannot be bothered to take the time to write a proper question yourself.


This might help solve your problem:

http://www.catb.org/~esr/faqs/smart-questions.html

Kind regards,

Kasper Laudrup

--
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/1f1bc903-9746-f783-aa77-813b6fa9e5f7%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Error : Circula import

2022-03-03 Thread Ruzindana Kent
Hello everyone,

I'm new to django and also new in the group, I wanted to know how to solve 
circula import errors. here is a screenshot of the error from the terminal.

Any reply about that will be helpful, 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/a9cd0658-40f1-4d36-ad24-fc4bd162446cn%40googlegroups.com.


Re: Error : Circula import

2022-03-03 Thread Kasper Laudrup

On 03/03/2022 20.38, Ruzindana Kent wrote:

Hello everyone,

I'm new to django and also new in the group, I wanted to know how to 
solve circula import errors. here is a screenshot of the error from the 
terminal.


Any reply about that will be helpful, thank you



Remember that Django is a Python framework, so circular imports are 
mostly a Python thing not specific to Django:


https://www.pythonpool.com/python-circular-import/

Kind regards,

Kasper Laudrup

--
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/e259dd34-1578-7540-35c7-132550a1955c%40stacktrace.dk.


OpenPGP_0xE5D9CAC64AAA55EB.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


took too long to shut down and was killed.

2022-03-03 Thread ahmed elabbasy
*Application instance  
wait_for=._call_check_cancel() at 
/usr/local/lib/python3.8/asyncio/futures.py:360, ()]>> for connection  took too long to 
shut down and was killed.*

Everything has been working normally for quite some time now this appeared 
without any modification
aioredis==1.3.1
channels==3.0.4
channels-redis==3.3.1
daphne==3.0.2
Django==3.2.8
asgiref==3.4.1

-- 
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/a07ec0ca-e948-48e3-8731-719ec4adbccen%40googlegroups.com.


Re: Error : Circula import

2022-03-03 Thread Jet Ezra
But the link tells you the details and how to solve the problem.
Anyway, I think you forgot to share the said screenshots. I can't find them.

Also, when you are asking please, don't try to direct us how we should
solve this problem. Just detail your problem and wait for your answer.

Simple.
A circular import happens when you have fileA that has something say a
class A, then another file B with also a class B
Then class A imports class B from file B which is also importing class A
from B.
So the program keeps importing and never completes the cycle.

Solution,
If you have to use the two like that, then put them in the same file. It is
always my shortcut.

On Thu, Mar 3, 2022 at 11:26 PM Kasper Laudrup 
wrote:

> On 03/03/2022 20.38, Ruzindana Kent wrote:
> > Hello everyone,
> >
> > I'm new to django and also new in the group, I wanted to know how to
> > solve circula import errors. here is a screenshot of the error from the
> > terminal.
> >
> > Any reply about that will be helpful, thank you
> >
>
> Remember that Django is a Python framework, so circular imports are
> mostly a Python thing not specific to Django:
>
> https://www.pythonpool.com/python-circular-import/
>
> Kind regards,
>
> Kasper Laudrup
>
> --
> 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/e259dd34-1578-7540-35c7-132550a1955c%40stacktrace.dk
> .
>


-- 
jet

-- 
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/CAMjc0xW355jdEvJ3dRTZPpV5nDaVUWXpfOQEPLE2EdrDenriaA%40mail.gmail.com.