Re: Django Queries

2018-05-11 Thread Joseph Mutumi
Hello,

You need to clearly understand Python objects because the ORM maps fields
directly to that.

Please check out: https://docs.djangoproject.com/en/2.0/topics/db/queries/

So if you print out the object as a string i.e.

people = People.objects.al()
print people

OR

person = People.objects.get(pk=1)
print person

The string returned by the __str__ or __unicode__ method is what is
displayed.
To access other columns you need to access the attributes like:
person.address
or person.occupation. Through foreign keys too e.g. person.town.name.

Read through the docs and follow those examples first. You'll easily
understand
thereafter.

Kind regards

On Sat, May 12, 2018 at 9:12 AM, Gerald Brown  wrote:

> I was getting the same as you are as I had just first_name & last_name set
> in the "def __str__(self)".  I added a couple of more fields to that
> statement but they are still not showing up even after running a
> makemigration which says "No Change"
>
> I tried "p.address" but it gave me an error message, (which I don't
> remember) as I did not know about the "[]"s.  Now if I do "p.[0].address"
> it gives me the address. Also if I do "p[0].town" it show me the town name,
> which is in another table and is a FK to that table.
>
> Like I said in my original message, I am just starting to use Django
> Queries so there is a lot to learn so I thank you for your assistance.
>
> On Saturday, 12 May, 2018 01:34 PM, Mark Phillips wrote:
>
> Please provide the exact output you are seeing. It may be that the output
> has been truncated, which is correct behavior.
>
> For example, when I run this query on the command line for my model
> Document,
>
> >>> Document.objects.all()
> , ,  gg>, ]>
>
> I get a QuerySet with 4 entries, as there are 4 rows/records in the
> Document table. All the fields are there, just not shown. The __str__
> method in the Document model returns the title of the document, which is
> what is shown above for each Document in the QuerySet. I am guessing but
> your People table probably defines the __str__ method to return the first
> and last name.
>
> I can look at one of the returned rows like this:
>
> >>> d=Document.objects.all()
> >>> d[0]
> 
> >>> d[0].document_id
> 2
> >>> d[0].title
> 'a new title 2'
> >>> d[0].description
> 'a new description 2'
> >>> d[0].document_state
> 1
> >>> d[0].storage_file_name
> 
> >>>
>
> title, document_id, description, and storage_file_name are all fields
> defined in the model for Document (along with others).
>
> Read the django documentation about models and queries for more
> information.
>
> Mark
>
> On Fri, May 11, 2018 at 9:34 PM, Joseph Mutumi  wrote:
>
>> Hello,
>>
>> That's strange what does your people model look like? Notice it
>> will only populate the fields you have defined in the model not
>> the columns of the table in the database.
>>
>> Did you run migrations after adding new fields to the model?
>> $ python manage.py migrate
>>
>> Kind regards
>>
>> On Sat, May 12, 2018 at 5:15 AM, Gerald Brown 
>> wrote:
>>
>>> Greetings:
>>>
>>> I have just started to use Django Queries and I am having some problems.
>>>
>>> When i use the query: "p = People.objects.all()" & then "p" it shows
>>> just the lastname & firstname fields even though there are many more fields
>>> in the table.
>>>
>>> I thought ALL means ALL, ALL fields & ALL records!!!
>>>
>>> Only 2 records so far in the DB and it shows both of them so ALL RECORDS
>>> is working.
>>>
>>> Another table I have has a date field and a ForeignKey to the people
>>> table plus some additional fields.  The query returns the date and the
>>> firstname and lastname from the people table ONLY.
>>>
>>> It looks like it is only showing the first two fields in the table.
>>>
>>> Any ideas on how I can get it to show ALL fields?
>>>
>>> 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 post to this group, send email to django-users@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/CAN5idp8%2B4gx6_MOoXT-JAsbq4nbZLAZj%3DTL8MD
>> Md%2Bg_oQwip2A%40mail.gmail.com
>> 

Re: Django Queries

2018-05-11 Thread Gerald Brown
I was getting the same as you are as I had just first_name & last_name 
set in the "def __str__(self)".  I added a couple of more fields to that 
statement but they are still not showing up even after running a 
makemigration which says "No Change"


I tried "p.address" but it gave me an error message, (which I don't 
remember) as I did not know about the "[]"s.  Now if I do 
"p.[0].address" it gives me the address. Also if I do "p[0].town" it 
show me the town name, which is in another table and is a FK to that table.


Like I said in my original message, I am just starting to use Django 
Queries so there is a lot to learn so I thank you for your assistance.



On Saturday, 12 May, 2018 01:34 PM, Mark Phillips wrote:
Please provide the exact output you are seeing. It may be that the 
output has been truncated, which is correct behavior.


For example, when I run this query on the command line for my model 
Document,


>>> Document.objects.all()
, , 
, ]>


I get a QuerySet with 4 entries, as there are 4 rows/records in the 
Document table. All the fields are there, just not shown. The __str__ 
method in the Document model returns the title of the document, which 
is what is shown above for each Document in the QuerySet. I am 
guessing but your People table probably defines the __str__ method to 
return the first and last name.


I can look at one of the returned rows like this:

>>> d=Document.objects.all()
>>> d[0]

>>> d[0].document_id
2
>>> d[0].title
'a new title 2'
>>> d[0].description
'a new description 2'
>>> d[0].document_state
1
>>> d[0].storage_file_name

>>>

title, document_id, description, and storage_file_name are all fields 
defined in the model for Document (along with others).


Read the django documentation about models and queries for more 
information.


Mark

On Fri, May 11, 2018 at 9:34 PM, Joseph Mutumi > wrote:


Hello,

That's strange what does your people model look like? Notice it
will only populate the fields you have defined in the model not
the columns of the table in the database.

Did you run migrations after adding new fields to the model?
$ python manage.py migrate

Kind regards

On Sat, May 12, 2018 at 5:15 AM, Gerald Brown mailto:gsbrow...@gmail.com>> wrote:

Greetings:

I have just started to use Django Queries and I am having some
problems.

When i use the query: "p = People.objects.all()" & then "p" it
shows just the lastname & firstname fields even though there
are many more fields in the table.

I thought ALL means ALL, ALL fields & ALL records!!!

Only 2 records so far in the DB and it shows both of them so
ALL RECORDS is working.

Another table I have has a date field and a ForeignKey to the
people table plus some additional fields.  The query returns
the date and the firstname and lastname from the people table
ONLY.

It looks like it is only showing the first two fields in the
table.

Any ideas on how I can get it to show ALL fields?

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 post to this group, send email to
django-users@googlegroups.com
.
Visit this group at
https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com

.
For more options, visit https://groups.google.com/d/optout
.


-- 
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 post to this group, send email to django-users@googlegroups.com
.
Visit this group at https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/CAN5idp8%2B4gx6_MOoXT-JAsbq4nbZLAZj%3DTL8MDMd%2Bg_oQwip2A%40mail.gmail.com

.


For more

Re: Django Queries

2018-05-11 Thread Gerald Brown

Thanks for your reply.

My model consists of the following:

id, first_name, last_name, middle_initial, contact_num, address, town(FK 
to Town table), date_of_birth, occupation(FK to Occupation table), email 
& gender. The Django query returns ONLY first_name & last_name.


I run migrations after any changes to any models. The database has the 
same fields that are shown.


BTW, the query is being run after running ./manage.py shell.


On Saturday, 12 May, 2018 12:34 PM, Joseph Mutumi wrote:

Hello,

That's strange what does your people model look like? Notice it
will only populate the fields you have defined in the model not
the columns of the table in the database.

Did you run migrations after adding new fields to the model?
$ python manage.py migrate

Kind regards

On Sat, May 12, 2018 at 5:15 AM, Gerald Brown > wrote:


Greetings:

I have just started to use Django Queries and I am having some
problems.

When i use the query: "p = People.objects.all()" & then "p" it
shows just the lastname & firstname fields even though there are
many more fields in the table.

I thought ALL means ALL, ALL fields & ALL records!!!

Only 2 records so far in the DB and it shows both of them so ALL
RECORDS is working.

Another table I have has a date field and a ForeignKey to the
people table plus some additional fields.  The query returns the
date and the firstname and lastname from the people table ONLY.

It looks like it is only showing the first two fields in the table.

Any ideas on how I can get it to show ALL fields?

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 post to this group, send email to django-users@googlegroups.com
.
Visit this group at https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com

.
For more options, visit https://groups.google.com/d/optout
.


--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN5idp8%2B4gx6_MOoXT-JAsbq4nbZLAZj%3DTL8MDMd%2Bg_oQwip2A%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8344fa0b-9420-7d83-56ea-df30f54f6b87%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Queries

2018-05-11 Thread Mark Phillips
Please provide the exact output you are seeing. It may be that the output
has been truncated, which is correct behavior.

For example, when I run this query on the command line for my model
Document,

>>> Document.objects.all()
, , , ]>

I get a QuerySet with 4 entries, as there are 4 rows/records in the
Document table. All the fields are there, just not shown. The __str__
method in the Document model returns the title of the document, which is
what is shown above for each Document in the QuerySet. I am guessing but
your People table probably defines the __str__ method to return the first
and last name.

I can look at one of the returned rows like this:

>>> d=Document.objects.all()
>>> d[0]

>>> d[0].document_id
2
>>> d[0].title
'a new title 2'
>>> d[0].description
'a new description 2'
>>> d[0].document_state
1
>>> d[0].storage_file_name

>>>

title, document_id, description, and storage_file_name are all fields
defined in the model for Document (along with others).

Read the django documentation about models and queries for more information.

Mark

On Fri, May 11, 2018 at 9:34 PM, Joseph Mutumi  wrote:

> Hello,
>
> That's strange what does your people model look like? Notice it
> will only populate the fields you have defined in the model not
> the columns of the table in the database.
>
> Did you run migrations after adding new fields to the model?
> $ python manage.py migrate
>
> Kind regards
>
> On Sat, May 12, 2018 at 5:15 AM, Gerald Brown  wrote:
>
>> Greetings:
>>
>> I have just started to use Django Queries and I am having some problems.
>>
>> When i use the query: "p = People.objects.all()" & then "p" it shows just
>> the lastname & firstname fields even though there are many more fields in
>> the table.
>>
>> I thought ALL means ALL, ALL fields & ALL records!!!
>>
>> Only 2 records so far in the DB and it shows both of them so ALL RECORDS
>> is working.
>>
>> Another table I have has a date field and a ForeignKey to the people
>> table plus some additional fields.  The query returns the date and the
>> firstname and lastname from the people table ONLY.
>>
>> It looks like it is only showing the first two fields in the table.
>>
>> Any ideas on how I can get it to show ALL fields?
>>
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAN5idp8%2B4gx6_MOoXT-JAsbq4nbZLAZj%
> 3DTL8MDMd%2Bg_oQwip2A%40mail.gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2N-WCBwQX9s2r3E2bRKDPMbd%2B1Hg2xFN7AoSxaVDQQu2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Queries

2018-05-11 Thread Joseph Mutumi
Hello,

That's strange what does your people model look like? Notice it
will only populate the fields you have defined in the model not
the columns of the table in the database.

Did you run migrations after adding new fields to the model?
$ python manage.py migrate

Kind regards

On Sat, May 12, 2018 at 5:15 AM, Gerald Brown  wrote:

> Greetings:
>
> I have just started to use Django Queries and I am having some problems.
>
> When i use the query: "p = People.objects.all()" & then "p" it shows just
> the lastname & firstname fields even though there are many more fields in
> the table.
>
> I thought ALL means ALL, ALL fields & ALL records!!!
>
> Only 2 records so far in the DB and it shows both of them so ALL RECORDS
> is working.
>
> Another table I have has a date field and a ForeignKey to the people table
> plus some additional fields.  The query returns the date and the firstname
> and lastname from the people table ONLY.
>
> It looks like it is only showing the first two fields in the table.
>
> Any ideas on how I can get it to show ALL fields?
>
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAN5idp8%2B4gx6_MOoXT-JAsbq4nbZLAZj%3DTL8MDMd%2Bg_oQwip2A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django Queries

2018-05-11 Thread Gerald Brown

Greetings:

I have just started to use Django Queries and I am having some problems.

When i use the query: "p = People.objects.all()" & then "p" it shows 
just the lastname & firstname fields even though there are many more 
fields in the table.


I thought ALL means ALL, ALL fields & ALL records!!!

Only 2 records so far in the DB and it shows both of them so ALL RECORDS 
is working.


Another table I have has a date field and a ForeignKey to the people 
table plus some additional fields.  The query returns the date and the 
firstname and lastname from the people table ONLY.


It looks like it is only showing the first two fields in the table.

Any ideas on how I can get it to show ALL fields?

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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e90ad4d-bffe-5690-2559-ec4655fc79b6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: IOError when trying to send email in Django app

2018-05-11 Thread James Farris
You probably already have but check the docs
https://docs.djangoproject.com/en/2.0/topics/email/

And your postfix configurations (or whatever email send system you are
using)

On Fri, May 11, 2018 at 12:07 PM Tom Tanner 
wrote:

> I have a Django app running on a server with uWSGI and nginx.
>
> In my `local_settings.py` file I have this:
>
> ###
> # EMAIL SETUP #
> ###
> EMAIL_HOST = 'smtp.privateemail.com'
> EMAIL_HOST_USER = 'supp...@mydomain.com'
> EMAIL_HOST_PASSWORD = 'MY EMAIL PASSWORD'
> EMAIL_PORT = 587
> EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
> EMAIL_USE_TLS = True
>
>
> 
> # OTHER EMAIL SETTINGS #
> 
> ADMIN_EMAIL = "ad...@mydomain.com"
> SUPPORT_EMAIL = "supp...@mydomain.com"
>
>
> When I fill out the `/password_reset/` template with an email and submit
> the form, the email I enter gets no email.
>
> I see these lines in my `uwsgi.log` file after I submit the password reset
> form.
>
> Fri May 11 17:48:10 2018 - SIGPIPE: writing to a closed pipe/socket/fd
> (probably the client disconnected) on request /password_reset/ (ip
> 73.49.35.42) !!!
> Fri May 11 17:48:10 2018 - uwsgi_response_write_headers_do(): Broken
> pipe [core/writer.c line 248] during POST /password_reset/ (73.49.35.42)
> IOError: write error
>
> What error is this? Why won't the password reset email send?
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5a50ba30-9709-48a9-a937-bd9afb8bbf30%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE-E-_14LM2A8%3DPwtoAAXOKh8morKnTnaAt2HH4Pq5RT4GUeZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: python django group

2018-05-11 Thread James Farris
What errors ?

On Fri, May 11, 2018 at 4:41 PM Akinyiga Obadamilare <
akinyigaobad...@gmail.com> wrote:

> please, when I run my server in local host after creating my polls app in
> django but it did not show the presence of polls app in my local host
> instead of it to display the presence of admin and polls app, to run the
> python manage.py make migration polls was was giving me error
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/9995e4a7-2288-4e95-8f65-6caf6b5df58c%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE-E-_181du%2BrQ5T8iVRahc64nifnDCVUo5K7TaKu%2BLx9beYdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


python django group

2018-05-11 Thread Akinyiga Obadamilare
please, when I run my server in local host after creating my polls app in 
django but it did not show the presence of polls app in my local host 
instead of it to display the presence of admin and polls app, to run the 
python manage.py make migration polls was was giving me error

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9995e4a7-2288-4e95-8f65-6caf6b5df58c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to make queries using Mysql JSON field and django 2

2018-05-11 Thread Mark Phillips
I have a model Document that has a json field "metadata" containing a
dictionary of different values. One example:

{"Orientation": "Landscape",
"Address": "Bethany Home Road",
"Photo Type": "Many People",
"a boolean": false,
"Person": ["Sam Smith", "Hank Jones"],
"Date": "05/13/2018",
"Location": "Washington DC",
"Decade": "2020"}

I can write a query to find all the record(s) in the Document table that
the "Person" field contains "Sam Smith" like this

Document.objects.filter(metadata__Person__contains='Sam Smith')

Is there a way to write a query to find all the Documents that have "Sam*"
in the metadata field?

For example, if there were another document that had "Sammy Jacobs" in the
"Person" field, the query would return both that record and the record with
the "Sam Smith" in the Person field.

Either some sort of "or" condition within the query that would allow me to
search for "Sam Smith" or "Sammy Jacobs". Or, some sort of regex that I can
put in for the search criteria that says search for all the "Sam*"
occurrences in the "Person" list.

I have been googling for a solution, but have not found one yet.

Thanks!

Mark

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2Pwb8-cHXF%2B7oHkgkuG2QSr%3D%3DvQmNAN0_%2B_8ro5H9ThHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


IOError when trying to send email in Django app

2018-05-11 Thread Tom Tanner
I have a Django app running on a server with uWSGI and nginx. 

In my `local_settings.py` file I have this:

###
# EMAIL SETUP #
###
EMAIL_HOST = 'smtp.privateemail.com'
EMAIL_HOST_USER = 'supp...@mydomain.com'
EMAIL_HOST_PASSWORD = 'MY EMAIL PASSWORD'
EMAIL_PORT = 587
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True



# OTHER EMAIL SETTINGS #

ADMIN_EMAIL = "ad...@mydomain.com"
SUPPORT_EMAIL = "supp...@mydomain.com"


When I fill out the `/password_reset/` template with an email and submit 
the form, the email I enter gets no email. 

I see these lines in my `uwsgi.log` file after I submit the password reset 
form.

Fri May 11 17:48:10 2018 - SIGPIPE: writing to a closed pipe/socket/fd 
(probably the client disconnected) on request /password_reset/ (ip 
73.49.35.42) !!!
Fri May 11 17:48:10 2018 - uwsgi_response_write_headers_do(): Broken 
pipe [core/writer.c line 248] during POST /password_reset/ (73.49.35.42)
IOError: write error

What error is this? Why won't the password reset email send?

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5a50ba30-9709-48a9-a937-bd9afb8bbf30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Deploy on windows IIS

2018-05-11 Thread Matthew Pava
I just go straight to the source or Google around.
https://httpd.apache.org/docs/2.4/platform/windows.html
Apache has different flavors for Windows.  We’re either using ApacheHaus or 
Apache Lounge.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Majid Hojati
Sent: Friday, May 11, 2018 1:33 PM
To: Django users
Subject: Re: Deploy on windows IIS

Is there any good tuturial which I can use Apache? I am also using Geoserver 
which runs on tomcat port 8080 I hope it does not make any problems

On Friday, May 11, 2018 at 10:55:45 PM UTC+4:30, Matthew Pava wrote:
I know it doesn’t directly answer your question, but I have Django running on 
Windows Server 2012.  After wrestling with IIS for just a bit, I decided to 
just use Apache instead.

From: django...@googlegroups.com 
[mailto:django...@googlegroups.com] On Behalf Of Majid Hojati
Sent: Friday, May 11, 2018 12:52 PM
To: Django users
Subject: Deploy on windows IIS

Hi,
I have faced a problem while deploying django on windows server 2008 with IIS
I followed this
http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html

and it returns unexpectedly exited error. I am using python 3.6 and the 
development pythons server runs with no problem but I can not configure factcgi,
What options do I have? I can not even find the problem with this error.
--
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...@googlegroups.com.
To post to this group, send email to djang...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81d75081-c368-498d-9980-3b0e0d0feefe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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 post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52e5c404-69ff-45a1-910d-aeda09ad58f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6047546abdbe4495821d94feabb7213c%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: Deploy on windows IIS

2018-05-11 Thread Majid Hojati
Is there any good tuturial which I can use Apache? I am also using 
Geoserver which runs on tomcat port 8080 I hope it does not make any 
problems

On Friday, May 11, 2018 at 10:55:45 PM UTC+4:30, Matthew Pava wrote:
>
> I know it doesn’t directly answer your question, but I have Django running 
> on Windows Server 2012.  After wrestling with IIS for just a bit, I decided 
> to just use Apache instead.
>
>  
>
> *From:* django...@googlegroups.com  [mailto:
> django...@googlegroups.com ] *On Behalf Of *Majid Hojati
> *Sent:* Friday, May 11, 2018 12:52 PM
> *To:* Django users
> *Subject:* Deploy on windows IIS
>
>  
>
> Hi,
>
> I have faced a problem while deploying django on windows server 2008 with 
> IIS
>
> I followed this 
>
>
> http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html
>
>  
>
> and it returns unexpectedly exited error. I am using python 3.6 and the 
> development pythons server runs with no problem but I can not configure 
> factcgi,
>
> What options do I have? I can not even find the problem with this error. 
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to djang...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/81d75081-c368-498d-9980-3b0e0d0feefe%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/52e5c404-69ff-45a1-910d-aeda09ad58f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


RE: Deploy on windows IIS

2018-05-11 Thread Matthew Pava
I know it doesn’t directly answer your question, but I have Django running on 
Windows Server 2012.  After wrestling with IIS for just a bit, I decided to 
just use Apache instead.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Majid Hojati
Sent: Friday, May 11, 2018 12:52 PM
To: Django users
Subject: Deploy on windows IIS

Hi,
I have faced a problem while deploying django on windows server 2008 with IIS
I followed this
http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html

and it returns unexpectedly exited error. I am using python 3.6 and the 
development pythons server runs with no problem but I can not configure factcgi,
What options do I have? I can not even find the problem with this error.
--
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 post to this group, send email to 
django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81d75081-c368-498d-9980-3b0e0d0feefe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4c33a4b74dbf4eb68b663bdfac96cb0e%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to reso

2018-05-11 Thread Avitab Ayan Sarmah
hey Dylan, two days ago anthony said to troubleshoot myself, the answer was 
there only.Since i am a beginer i tried myself but couldn't find out the 
error also i was tired as i just reached from office and started questioning

On Friday, May 11, 2018 at 11:19:43 PM UTC+5:30, Dylan Reinhold wrote:
>
> Is it grounds hogs day, didn't this exact error get asked two days ago and 
> Daniel answered then?
>
> On Fri, May 11, 2018 at 10:40 AM, Daniel Hepper  > wrote:
>
>> The error message is a hint that Django is not properly initialized.
>>
>> My guess is that you are using a plain python shell, which you started 
>> using the command „python“.
>>
>> Use „python manage.py shell“ instead. As explained in part 2 of the 
>> tutorial, this properly initializes Django.
>>
>> Hope that helps,
>> Daniel
>>
>> P.S.: I really admire your persistence! I promise that all these error 
>> messages will make sense at some point, if you stick with it.
>>
>> Am 11.05.2018 um 19:08 schrieb Avitab Ayan Sarmah > >:
>>
>> Exceptions:
>>
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import datetime
>> >>> from django.utils import timezone
>> >>> from polls.models import Question
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
>> class Question(models.Model):
>>   File "c:\python36\lib\site-packages\django\db\models\base.py", line 
>> 100, in __new__
>> app_config = apps.get_containing_app_config(module)
>>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, 
>> in get_containing_app_config
>> self.check_apps_ready()
>>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, 
>> in check_apps_ready
>> raise AppRegistryNotReady("Apps aren't loaded yet.")
>> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>> -- 
>> 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...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/64C35250-AA7C-4C78-9E64-4AE431F87DB7%40gmail.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bcfd5c98-fe71-4d51-97e4-ac825e03cffa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploy on windows IIS

2018-05-11 Thread Majid Hojati
Hi,
I have faced a problem while deploying django on windows server 2008 with 
IIS
I followed this 
http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html

and it returns unexpectedly exited error. I am using python 3.6 and the 
development pythons server runs with no problem but I can not configure 
factcgi,
What options do I have? I can not even find the problem with this error. 

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81d75081-c368-498d-9980-3b0e0d0feefe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Deploy on windows server 2008 and IIS

2018-05-11 Thread Majid Hojati
Hi,
I followed this 
http://blog.mattwoodward.com/2016/07/running-django-application-on-windows.html
to deploy django on windows server 2008 and IIS but at the last step it 
returns 500 error, it says wfastcgi.py unexpectedly exit. What Other 
options do I have to fix this problem, I am on python 3.6 

I also tried to use 
https://github.com/antoinemartin/django-windows-tools
but the same error happened. It is a disaster to use fastcgi 

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1dbdd09c-4cd0-434a-8d1a-60772bebe0ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to reso

2018-05-11 Thread Dylan Reinhold
Is it grounds hogs day, didn't this exact error get asked two days ago and
Daniel answered then?

On Fri, May 11, 2018 at 10:40 AM, Daniel Hepper 
wrote:

> The error message is a hint that Django is not properly initialized.
>
> My guess is that you are using a plain python shell, which you started
> using the command „python“.
>
> Use „python manage.py shell“ instead. As explained in part 2 of the
> tutorial, this properly initializes Django.
>
> Hope that helps,
> Daniel
>
> P.S.: I really admire your persistence! I promise that all these error
> messages will make sense at some point, if you stick with it.
>
> Am 11.05.2018 um 19:08 schrieb Avitab Ayan Sarmah :
>
> Exceptions:
>
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
> class Question(models.Model):
>   File "c:\python36\lib\site-packages\django\db\models\base.py", line
> 100, in __new__
> app_config = apps.get_containing_app_config(module)
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244,
> in get_containing_app_config
> self.check_apps_ready()
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127,
> in check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/64C35250-AA7C-4C78-9E64-4AE431F87DB7%40gmail.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHtg44DvcDb8ZvRw_bD7krC7XhM4OK666fc%3DgPyfzeEFMQQ%3Dag%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to reso

2018-05-11 Thread Avitab Ayan Sarmah
ok ok i got it thanks

On Friday, May 11, 2018 at 11:11:00 PM UTC+5:30, Daniel Hepper wrote:
>
> The error message is a hint that Django is not properly initialized.
>
> My guess is that you are using a plain python shell, which you started 
> using the command „python“.
>
> Use „python manage.py shell“ instead. As explained in part 2 of the 
> tutorial, this properly initializes Django.
>
> Hope that helps,
> Daniel
>
> P.S.: I really admire your persistence! I promise that all these error 
> messages will make sense at some point, if you stick with it.
>
> Am 11.05.2018 um 19:08 schrieb Avitab Ayan Sarmah  >:
>
> Exceptions:
>
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
> class Question(models.Model):
>   File "c:\python36\lib\site-packages\django\db\models\base.py", line 100, 
> in __new__
> app_config = apps.get_containing_app_config(module)
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, 
> in get_containing_app_config
> self.check_apps_ready()
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, 
> in check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c4bfe92-a9f1-43f7-84f6-1fb23499c00c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to reso

2018-05-11 Thread Avitab Ayan Sarmah
i wrote the code inside mysite directory but still the error shows

On Friday, May 11, 2018 at 11:11:00 PM UTC+5:30, Daniel Hepper wrote:
>
> The error message is a hint that Django is not properly initialized.
>
> My guess is that you are using a plain python shell, which you started 
> using the command „python“.
>
> Use „python manage.py shell“ instead. As explained in part 2 of the 
> tutorial, this properly initializes Django.
>
> Hope that helps,
> Daniel
>
> P.S.: I really admire your persistence! I promise that all these error 
> messages will make sense at some point, if you stick with it.
>
> Am 11.05.2018 um 19:08 schrieb Avitab Ayan Sarmah  >:
>
> Exceptions:
>
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
> class Question(models.Model):
>   File "c:\python36\lib\site-packages\django\db\models\base.py", line 100, 
> in __new__
> app_config = apps.get_containing_app_config(module)
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, 
> in get_containing_app_config
> self.check_apps_ready()
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, 
> in check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
>
> -- 
> 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...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/182c032b-6957-4be7-a04e-26de1a7cab6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to reso

2018-05-11 Thread Daniel Hepper
The error message is a hint that Django is not properly initialized.

My guess is that you are using a plain python shell, which you started using 
the command „python“.

Use „python manage.py shell“ instead. As explained in part 2 of the tutorial, 
this properly initializes Django.

Hope that helps,
Daniel

P.S.: I really admire your persistence! I promise that all these error messages 
will make sense at some point, if you stick with it.

> Am 11.05.2018 um 19:08 schrieb Avitab Ayan Sarmah :
> 
> Exceptions:
> 
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import datetime
> >>> from django.utils import timezone
> >>> from polls.models import Question
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
> class Question(models.Model):
>   File "c:\python36\lib\site-packages\django\db\models\base.py", line 100, in 
> __new__
> app_config = apps.get_containing_app_config(module)
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, in 
> get_containing_app_config
> self.check_apps_ready()
>   File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, in 
> check_apps_ready
> raise AppRegistryNotReady("Apps aren't loaded yet.")
> django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/64C35250-AA7C-4C78-9E64-4AE431F87DB7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


While going through the django tutorial i stuck while writing a code i.e., automated test.And error is showing with some tracebacks.I tried to resolve the error but i failed.Please help me to resolve

2018-05-11 Thread Avitab Ayan Sarmah
Exceptions:

Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> from django.utils import timezone
>>> from polls.models import Question
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\AVITABAYAN\mysite\polls\models.py", line 7, in 
class Question(models.Model):
  File "c:\python36\lib\site-packages\django\db\models\base.py", line 100, 
in __new__
app_config = apps.get_containing_app_config(module)
  File "c:\python36\lib\site-packages\django\apps\registry.py", line 244, 
in get_containing_app_config
self.check_apps_ready()
  File "c:\python36\lib\site-packages\django\apps\registry.py", line 127, 
in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/01e57139-6ac4-45ac-837e-196980bec2ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 400 error, nginx debug log confusion, Django app

2018-05-11 Thread Tom Tanner
I ran `sudo reboot` and `sudo service nginx configtest && sudo service 
nginx restart`. Now the site loads just fine. I don't know which of those 
two commands did it.

On Friday, May 11, 2018 at 12:22:11 PM UTC-4, Tom Tanner wrote:
>
> Note: `mydomain.com` is not my real domain name.
>
> When I go to `test.mydomain.com`, I get a page that just says `Bad 
> Request (400)`. 
>
> I'm running a Django app located at `/home/django/product_blog`.
>
> Here are the contents of my nginx file at 
> `/etc/nginx/sites-available/BRBR2`.
>
> server {
> listen 80;
> server_name test.mydomain.com;
> error_log /var/log/nginx/debug.log debug;
> 
> location = /favicon.ico { access_log off; log_not_found off; }
> location /static/ {
> root /home/django/product_blog;
> }
> 
> location / {
> include uwsgi_params;
> uwsgi_pass  
> unix:/home/django/product_blog/product_blog.sock;
> }
> }
>
> When I go to the debug file after trying to load the site, I see this: 
> https://pastebin.com/GchPd1MD.
>
> The file at `/var/log/nginx/error.log` shows nothing.
>
> How do I find the source of the 400 error?
>
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f51f5b16-59d5-438d-8cd8-27f8264ad5c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


400 error, nginx debug log confusion, Django app

2018-05-11 Thread Tom Tanner
Note: `mydomain.com` is not my real domain name.

When I go to `test.mydomain.com`, I get a page that just says `Bad Request 
(400)`. 

I'm running a Django app located at `/home/django/product_blog`.

Here are the contents of my nginx file at 
`/etc/nginx/sites-available/BRBR2`.

server {
listen 80;
server_name test.mydomain.com;
error_log /var/log/nginx/debug.log debug;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/django/product_blog;
}

location / {
include uwsgi_params;
uwsgi_pass  
unix:/home/django/product_blog/product_blog.sock;
}
}

When I go to the debug file after trying to load the site, I see this: 
https://pastebin.com/GchPd1MD.

The file at `/var/log/nginx/error.log` shows nothing.

How do I find the source of the 400 error?

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c8f497b0-8d9c-4695-a1ff-39abddc90bf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to debug? -- DoesNotExist at /admin/login/

2018-05-11 Thread mynoveltrans

for people checking this in 2018 you need to check the settings 

INSTALLED_APPS = [
>
>
> 'django.contrib.sites', this needs to go or you need to Increment 
> SITE_ID if you really need the app to be installed
>

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4831856-a8bf-400c-8659-1b7b7cdf8732%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Display Users Posts also whether it is logged in or logged out

2018-05-11 Thread James Farris
If you want to show posts, which I assume is blog posts or something (not seen 
in your code) 
You would add an additional queryset that is passed to your template

Something like 
Posts.objects.filter(user_id=pk)

Sent from my mobile device

> On May 10, 2018, at 6:45 PM, objectiveapps...@gmail.com wrote:
> 
> I want to Display Users Posts also whether it is logged in or logged out When 
> I click the everyone User It will show me users Profile Info but I want 
> everyone user's posts also How Can I Solve This
> 
> Here is my code
> https://dpaste.de/KBcF
> 
> Thank You in Advance
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/aa97858a-71a7-4c65-b5c0-b7afe0ac0364%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7824C06B-2CFE-4382-809F-5AEF03407B58%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with debug = True/False

2018-05-11 Thread Gerald Brown
Thanks for the info. I will check it out.  I am still in development so 
it will be awhile before I need it.



On Friday, 11 May, 2018 09:06 PM, James Farris wrote:
I also recommend going through the deploy checklist. I ran into the 
same problem and then other problems after that because I didn’t 
follow this.


https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

Sent from my mobile device

On May 10, 2018, at 10:53 PM, Andréas Kühne 
mailto:andreas.ku...@hypercode.se>> wrote:



Hi,

That is the way it should be if you look in the documentation:
https://docs.djangoproject.com/en/2.0/howto/static-files/

Serving the files

In addition to these configuration steps, you’ll also need to 
actually serve the static files.


During development, if you use|django.contrib.staticfiles| 
, 
this will be done automatically by|runserver| 
when|DEBUG| 
is 
set to|True|(see|django.contrib.staticfiles.views.serve()| 
).


This method is*grossly inefficient*and probably*insecure*, so it 
is*unsuitable for production*.


SeeDeploying static files 
for 
proper strategies to serve static files in production environments.



So it is exactly like gunicorn - because you need to serve your 
static files from a webbserver instead of from django itself.


That's why it is failing.

What you could do (although I don't recommend it) - it to manually 
add the static files serving to your urls.py file. See:

https://docs.djangoproject.com/en/2.0/howto/static-files/#serving-static-files-during-development

This should be fine for a developer environment - but nothing else.

Regards,

Andréas

2018-05-11 3:09 GMT+02:00 Gerald Brown >:


On my admin site if I have Debug set to true (I have read that
for production this is a no-no) everything looks fine.  When I
change it to FALSE all of the styling goes away as if it is being
run using gunicorn.

Has anyone observed this?  If so have you found a correction?

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 post to this group, send email to
django-users@googlegroups.com .
Visit this group at https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/2fb3aff8-40ec-464e-81e1-766cf08db433%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCckZWh8hYJ6HQX-RvOAssSDmP4WCSFbh%2BGcty38GHay%2BQ%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.

--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5958579F-09A0-414D-8A21-E4690829545F%40gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received t

Re: Problem with debug = True/False

2018-05-11 Thread Gerald Brown
Thanks for the info. I will check it out.  I am still in development so 
it will be awhile before I need it.



On Friday, 11 May, 2018 01:53 PM, Andréas Kühne wrote:

Hi,

That is the way it should be if you look in the documentation:
https://docs.djangoproject.com/en/2.0/howto/static-files/

Serving the files

In addition to these configuration steps, you’ll also need to actually 
serve the static files.


During development, if you use|django.contrib.staticfiles| 
, 
this will be done automatically by|runserver| 
when|DEBUG| 
is 
set to|True|(see|django.contrib.staticfiles.views.serve()| 
).


This method is*grossly inefficient*and probably*insecure*, so it 
is*unsuitable for production*.


SeeDeploying static files 
for 
proper strategies to serve static files in production environments.



So it is exactly like gunicorn - because you need to serve your static 
files from a webbserver instead of from django itself.


That's why it is failing.

What you could do (although I don't recommend it) - it to manually add 
the static files serving to your urls.py file. See:

https://docs.djangoproject.com/en/2.0/howto/static-files/#serving-static-files-during-development

This should be fine for a developer environment - but nothing else.

Regards,

Andréas

2018-05-11 3:09 GMT+02:00 Gerald Brown >:


On my admin site if I have Debug set to true (I have read that for
production this is a no-no) everything looks fine. When I change
it to FALSE all of the styling goes away as if it is being run
using gunicorn.

Has anyone observed this?  If so have you found a correction?

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 post to this group, send email to django-users@googlegroups.com
.
Visit this group at https://groups.google.com/group/django-users
.
To view this discussion on the web visit

https://groups.google.com/d/msgid/django-users/2fb3aff8-40ec-464e-81e1-766cf08db433%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


--
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 post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCckZWh8hYJ6HQX-RvOAssSDmP4WCSFbh%2BGcty38GHay%2BQ%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/03ccfc31-0e17-5d70-c1bf-ef379cd2c033%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem with debug = True/False

2018-05-11 Thread James Farris
I also recommend going through the deploy checklist. I ran into the same 
problem and then other problems after that because I didn’t follow this. 

https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

Sent from my mobile device

> On May 10, 2018, at 10:53 PM, Andréas Kühne  
> wrote:
> 
> Hi,
> 
> That is the way it should be if you look in the documentation:
> https://docs.djangoproject.com/en/2.0/howto/static-files/
> 
> Serving the files
> 
> In addition to these configuration steps, you’ll also need to actually serve 
> the static files.
> 
> During development, if you use django.contrib.staticfiles, this will be done 
> automatically by runserver when DEBUG is set to True (see 
> django.contrib.staticfiles.views.serve()).
> 
> This method is grossly inefficient and probably insecure, so it is unsuitable 
> for production.
> 
> See Deploying static files for proper strategies to serve static files in 
> production environments.
> 
> So it is exactly like gunicorn - because you need to serve your static files 
> from a webbserver instead of from django itself.
> 
> That's why it is failing.
> 
> What you could do (although I don't recommend it) - it to manually add the 
> static files serving to your urls.py file. See:
> https://docs.djangoproject.com/en/2.0/howto/static-files/#serving-static-files-during-development
> 
> This should be fine for a developer environment - but nothing else.
> 
> Regards,
> 
> Andréas
> 
> 2018-05-11 3:09 GMT+02:00 Gerald Brown :
>> On my admin site if I have Debug set to true (I have read that for 
>> production this is a no-no) everything looks fine.  When I change it to 
>> FALSE all of the styling goes away as if it is being run using gunicorn.
>> 
>> Has anyone observed this?  If so have you found a correction?
>> 
>> 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 post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/2fb3aff8-40ec-464e-81e1-766cf08db433%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> 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 post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAK4qSCckZWh8hYJ6HQX-RvOAssSDmP4WCSFbh%2BGcty38GHay%2BQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5958579F-09A0-414D-8A21-E4690829545F%40gmail.com.
For more options, visit https://groups.google.com/d/optout.